Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deduplicate and sort error codes #15876

Merged
merged 28 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1dc6018
Deduplicate and sort error codes
Happypig375 Aug 27, 2023
11c9fa5
Update test
Happypig375 Aug 27, 2023
5c4f924
3570 -> 3573
Happypig375 Aug 27, 2023
b7b29ec
1503 -> 1003
Happypig375 Aug 27, 2023
b111c7c
3570 -> 3573
Happypig375 Aug 27, 2023
447e14c
3217 -> 999
Happypig375 Aug 28, 2023
00faa3b
Update output.1000.stderr.bsl
Happypig375 Aug 28, 2023
a22e2f3
Update output.200.stderr.bsl
Happypig375 Aug 28, 2023
5b86d77
Update output.47.stderr.bsl
Happypig375 Aug 28, 2023
32f356c
Update output.multiemit.stderr.bsl
Happypig375 Aug 28, 2023
f791369
Update output.off.stderr.bsl
Happypig375 Aug 28, 2023
e6716d5
Update output.quiet.stderr.bsl
Happypig375 Aug 28, 2023
0990216
Update output.stderr.bsl
Happypig375 Aug 28, 2023
d1ca738
Update output.stderr.bsl
Happypig375 Aug 28, 2023
9678094
Update output.off.stderr.bsl
Happypig375 Aug 28, 2023
a001a7d
Update output.multiemit.stderr.bsl
Happypig375 Aug 28, 2023
1aae03f
Update output.47.stderr.bsl
Happypig375 Aug 28, 2023
a665ae3
Update output.200.stderr.bsl
Happypig375 Aug 28, 2023
5d007eb
Update output.1000.stderr.bsl
Happypig375 Aug 28, 2023
9368513
Update FSComp.txt
Happypig375 Aug 28, 2023
1ec0750
Update FSComp.txt
Happypig375 Aug 28, 2023
1d522b1
Update pdb04.fs
Happypig375 Aug 28, 2023
6410500
Update output.quiet.stderr.bsl
Happypig375 Aug 28, 2023
585a0c0
Merge branch 'main' into patch-18
Happypig375 Aug 28, 2023
fede209
Add a error code sorting check
Happypig375 Aug 28, 2023
ee5281e
Fix wording
Happypig375 Aug 28, 2023
e0bef8f
Update the script
Happypig375 Aug 28, 2023
07220fd
Merge branch 'main' into patch-18
Happypig375 Aug 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ stages:
continueOnError: true
condition: not(succeeded())

# Check code formatting
# Check FSComp.txt error code sorting code formatting
- job: CheckCodeFormatting
pool:
vmImage: $(UbuntuMachineQueueName)
Expand All @@ -270,6 +270,10 @@ stages:
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Install tools
- script: dotnet fsi src/Compiler/FSCompCheck.fsx
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Check error code sorting in src/Compiler/FSComp.txt
psfinaki marked this conversation as resolved.
Show resolved Hide resolved
- script: dotnet fantomas . -r --check
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
Expand Down
10 changes: 5 additions & 5 deletions src/Compiler/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ ExceptionDefsNotCompatibleFieldOrderDiffers,"The exception definitions are not c
363,typrelNeedExplicitImplementation,"The interface '%s' is included in multiple explicitly implemented interface types. Add an explicit implementation of this interface."
364,typrelNamedArgumentHasBeenAssignedMoreThenOnce,"The named argument '%s' has been assigned more than one value"
365,typrelNoImplementationGiven,"No implementation was given for '%s'"
366,typrelNoImplementationGivenWithSuggestion,"No implementation was given for '%s'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'."
365,typrelNoImplementationGivenSeveral,"No implementation was given for those members: %s"
366,typrelNoImplementationGivenSeveralWithSuggestion,"No implementation was given for those members: %sNote that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'."
365,typrelNoImplementationGivenSeveralTruncated,"No implementation was given for those members (some results omitted): %s"
366,typrelNoImplementationGivenWithSuggestion,"No implementation was given for '%s'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'."
366,typrelNoImplementationGivenSeveralWithSuggestion,"No implementation was given for those members: %sNote that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'."
366,typrelNoImplementationGivenSeveralTruncatedWithSuggestion,"No implementation was given for those members (some results omitted): %sNote that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'."
367,typrelMemberDoesNotHaveCorrectNumberOfArguments,"The member '%s' does not have the correct number of arguments. The required signature is '%s'."
368,typrelMemberDoesNotHaveCorrectNumberOfTypeParameters,"The member '%s' does not have the correct number of method type parameters. The required signature is '%s'."
Expand Down Expand Up @@ -908,9 +908,6 @@ optsStaticlink,"Statically link the given assembly and all referenced DLLs that
optsResident,"Use a resident background compilation service to improve compiler startup times."
optsPdb,"Name the output debug file"
optsSimpleresolution,"Resolve assembly references using directory-based rules rather than MSBuild resolution"
1048,optsUnrecognizedTarget,"Unrecognized target '%s', expected 'exe', 'winexe', 'library' or 'module'"
1049,optsUnrecognizedDebugType,"Unrecognized debug type '%s', expected 'pdbonly' or 'full'"
1050,optsInvalidWarningLevel,"Invalid warning level '%d'"
optsShortFormOf,"Short form of '%s'"
optsClirootDeprecatedMsg,"The command-line option '--cliroot' has been deprecated. Use an explicit reference to a specific copy of mscorlib.dll instead."
optsClirootDescription,"Use to override where the compiler looks for mscorlib.dll and framework components"
Expand All @@ -937,6 +934,9 @@ optsSignatureData,"Include F# interface information, the default is file. Essent
1046,optsUnknownSignatureData,"Invalid value '%s' for --interfacedata, valid value are: none, file, compress."
optsOptimizationData,"Specify included optimization information, the default is file. Important for distributed libraries."
1047,optsUnknownOptimizationData,"Invalid value '%s' for --optimizationdata, valid value are: none, file, compress."
1048,optsUnrecognizedTarget,"Unrecognized target '%s', expected 'exe', 'winexe', 'library' or 'module'"
1049,optsUnrecognizedDebugType,"Unrecognized debug type '%s', expected 'pdbonly' or 'full'"
1050,optsInvalidWarningLevel,"Invalid warning level '%d'"
1051,optsInvalidSubSystemVersion,"Invalid version '%s' for '--subsystemversion'. The version must be 4.00 or greater."
1052,optsInvalidTargetProfile,"Invalid value '%s' for '--targetprofile', valid values are 'mscorlib', 'netcore' or 'netstandard'."
1063,optsUnknownArgumentToTheTestSwitch,"Unknown --test argument: '%s'"
Expand Down
22 changes: 22 additions & 0 deletions src/Compiler/FSCompCheck.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#r "nuget: FSharpPlus, 1.4.1"
psfinaki marked this conversation as resolved.
Show resolved Hide resolved
let inline (|Matches|_|) format = FSharpPlus.Parsing.trySscanf format

__SOURCE_DIRECTORY__ + "/FSComp.txt"
|> System.IO.File.ReadAllLines
|> Seq.fold
(fun counters line ->
match line with
| Matches "%d,%s" (errorCode, _)
| Matches "#%d %s" (errorCode, _)
| Matches "#%d,%s" (errorCode, _) ->
match counters with
| [] -> [ errorCode ] // Initialise a counter
| head :: tail when errorCode >= head -> errorCode :: tail // Increment current counter
psfinaki marked this conversation as resolved.
Show resolved Hide resolved
| _ -> errorCode :: counters // Start a new counter
| _ -> counters)
[]
|> function
| [] -> failwith "FSComp.txt contained no error codes but expected at least one"
| [ _finalErrorCode ] -> () // Expected: One counter counted to the end
| _finalErrorCode :: counters ->
failwith $"Error codes not sorted in FSComp.txt, breaks happened after {List.rev counters}"