From 1dc6018b41ec00e4e9e984385ce8a4c3359f7088 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Sun, 27 Aug 2023 22:17:46 +0800 Subject: [PATCH 01/26] Deduplicate and sort error codes --- src/Compiler/FSComp.txt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 5776afc82f3..6d4efa26af5 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -36,6 +36,8 @@ buildUnexpectedTypeArgs,"The non-generic type '%s' does not expect any type argu returnUsedInsteadOfReturnBang,"Consider using 'return!' instead of 'return'." yieldUsedInsteadOfYieldBang,"Consider using 'yield!' instead of 'yield'." tupleRequiredInAbstractMethod,"\nA tuple type is required for one or more arguments. Consider wrapping the given arguments in additional parentheses or review the definition of the interface." +10,parsUnexpectedSymbolDot,"Unexpected symbol '.' in member definition. Expected 'with', '=' or other token." +201,tcNamespaceCannotContainValues,"Namespaces cannot contain values. Consider using a module to hold your value declarations." 202,unsupportedAttribute,"This attribute is currently unsupported by the F# compiler. Applying it will not achieve its intended effect." 203,buildInvalidWarningNumber,"Invalid warning number '%s'" 204,buildInvalidVersionString,"Invalid version string '%s'" @@ -435,7 +437,6 @@ parsAttributesMustComeBeforeVal,"Attributes should be placed before 'val'" 568,parsAllEnumFieldsRequireValues,"All enum fields must be given values" 569,parsInlineAssemblyCannotHaveVisibilityDeclarations,"Accessibility modifiers are not permitted on inline assembly code types" 571,parsUnexpectedIdentifier,"Unexpected identifier: '%s'" -10,parsUnexpectedSymbolDot,"Unexpected symbol '.' in member definition. Expected 'with', '=' or other token." 572,parsUnionCasesCannotHaveVisibilityDeclarations,"Accessibility modifiers are not permitted on union cases. Use 'type U = internal ...' or 'type U = private ...' to give an accessibility to the whole representation." 573,parsEnumFieldsCannotHaveVisibilityDeclarations,"Accessibility modifiers are not permitted on enumeration fields" parsConsiderUsingSeparateRecordType,"Consider using a separate record type instead" @@ -492,7 +493,6 @@ tcUnexpectedConstByteArray,"Unexpected Const_bytearray" 640,tcParameterRequiresName,"A parameter with attributes must also be given a name, e.g. '[] Name : Type'" 641,tcReturnValuesCannotHaveNames,"Return values cannot have names" tcMemberKindPropertyGetSetNotExpected,"SynMemberKind.PropertyGetSet only expected in parse trees" -201,tcNamespaceCannotContainValues,"Namespaces cannot contain values. Consider using a module to hold your value declarations." 644,tcNamespaceCannotContainExtensionMembers,"Namespaces cannot contain extension members except in the same file and namespace declaration group where the type is defined. Consider using a module to hold declarations of extension members." 645,tcMultipleVisibilityAttributes,"Multiple visibility attributes have been specified for this identifier" 646,tcMultipleVisibilityAttributesWithLet,"Multiple visibility attributes have been specified for this identifier. 'let' bindings in classes are always private, as are any 'let' bindings inside expressions." @@ -838,6 +838,9 @@ ilDynamicInvocationNotSupported,"Dynamic invocation of %s is not supported" 992,ilStructLayoutAttributeCouldNotBeDecoded,"The StructLayout attribute could not be decoded" 993,ilDefaultAugmentationAttributeCouldNotBeDecoded,"The DefaultAugmentation attribute could not be decoded" 994,ilReflectedDefinitionsCannotUseSliceOperator,"Reflected definitions cannot contain uses of the prefix splice operator '%%'" +997,fsiInvalidDirective,"Invalid directive '#%s %s'" +998,packageManagerUnknown,"Package manager key '%s' was not registered in %s. Currently registered: %s. To learn more about extensions, visit: https://aka.ms/dotnetdepmanager" +999,packageManagerError,"%s" 1000,optsProblemWithCodepage,"Problem with codepage '%d': %s" optsCopyright,"Copyright (c) Microsoft Corporation. All Rights Reserved." optsCopyrightCommunity,"Freely distributed under the MIT Open Source License. https://github.com/Microsoft/visualfsharp/blob/master/License.txt" @@ -866,7 +869,7 @@ optsNowin32manifest,"Do not include the default Win32 manifest" optsEmbedAllSource,"Embed all source files in the portable PDB file" optsEmbedSource,"Embed specific source files in the portable PDB file" optsSourceLink,"Source link information file to embed in the portable PDB file" -1503,optsPdbMatchesOutputFileName,"The pdb output file name cannot match the build output filename use --pdb:filename.pdb" +1003,optsPdbMatchesOutputFileName,"The pdb output file name cannot match the build output filename use --pdb:filename.pdb" srcFileTooLarge,"Source file is too large to embed in a portable PDB" optsResource,"Embed the specified managed resource" optsLinkresource,"Link the specified resource to this assembly where the resinfo format is [,[,public|private]]" @@ -919,9 +922,6 @@ optsHelpBannerAdvanced,"- ADVANCED -" optsHelpBannerMisc,"- MISCELLANEOUS -" optsHelpBannerLanguage,"- LANGUAGE -" optsHelpBannerErrsAndWarns,"- ERRORS AND WARNINGS -" -1063,optsUnknownArgumentToTheTestSwitch,"Unknown --test argument: '%s'" -1064,optsUnknownPlatform,"Unrecognized platform '%s', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu." -1065,optsUnknownChecksumAlgorithm,"Algorithm '%s' is not supported" optsInternalNoDescription,"The command-line option '%s' is for test purposes only" optsDCLONoDescription,"The command-line option '%s' has been deprecated" optsDCLODeprecatedSuggestAlternative,"The command-line option '%s' has been deprecated. Use '%s' instead." @@ -939,6 +939,9 @@ optsOptimizationData,"Specify included optimization information, the default is 1047,optsUnknownOptimizationData,"Invalid value '%s' for --optimizationdata, valid value are: none, file, compress." 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'" +1064,optsUnknownPlatform,"Unrecognized platform '%s', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu." +1065,optsUnknownChecksumAlgorithm,"Algorithm '%s' is not supported" typeInfoFullName,"Full name" # typeInfoType,"type" # typeInfoInherits,"inherits" @@ -1389,8 +1392,6 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced 3213,typrelMemberHasMultiplePossibleDispatchSlots,"The member '%s' matches multiple overloads of the same method.\nPlease restrict it to one of the following:%s." 3214,methodIsNotStatic,"Method or object constructor '%s' is not static" 3215,parsUnexpectedSymbolEqualsInsteadOfIn,"Unexpected symbol '=' in expression. Did you intend to use 'for x in y .. z do' instead?" -3216,packageManagerUnknown,"Package manager key '%s' was not registered in %s. Currently registered: %s. To learn more about extensions, visit: https://aka.ms/dotnetdepmanager" -3217,packageManagerError,"%s" tcAnonRecdInvalid,"Invalid Anonymous Record type declaration." tcAnonRecdCcuMismatch,"Two anonymous record types are from different assemblies '%s' and '%s'" tcAnonRecdFieldNameMismatch,"This anonymous record does not exactly match the expected shape. Add the missing fields %s and remove the extra fields %s." @@ -1587,7 +1588,6 @@ featureChkNotTailRecursive,"Raises warnings if a member or function has the 'Tai featureWhileBang,"'while!' expression" featureExtendedFixedBindings,"extended fixed bindings for byref and GetPinnableReference" featurePreferStringGetPinnableReference,"prefer String.GetPinnableReference in fixed bindings" -3353,fsiInvalidDirective,"Invalid directive '#%s %s'" 3354,tcNotAFunctionButIndexerNamedIndexingNotYetEnabled,"This value supports indexing, e.g. '%s.[index]'. The syntax '%s[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." 3354,tcNotAFunctionButIndexerIndexingNotYetEnabled,"This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." 3355,tcNotAnIndexerNamedIndexingNotYetEnabled,"The value '%s' is not a function and does not support index notation." @@ -1634,7 +1634,6 @@ forFormatInvalidForInterpolated4,"Interpolated strings used as type IFormattable 3387,tcAmbiguousImplicitConversion,"This expression has type '%s' and is only made compatible with type '%s' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:%s" 3388,tcSubsumptionImplicitConversionUsed,"This expression implicitly converts type '%s' to type '%s'. See https://aka.ms/fsharp-implicit-convs." 3389,tcBuiltInImplicitConversionUsed,"This expression uses a built-in implicit conversion to convert type '%s' to type '%s'. See https://aka.ms/fsharp-implicit-convs." -3391,tcImplicitConversionUsedForNonMethodArg,"This expression uses the implicit conversion '%s' to convert type '%s' to type '%s'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\"." 3390,xmlDocBadlyFormed,"This XML comment is invalid: '%s'" 3390,xmlDocMissingParameterName,"This XML comment is invalid: missing 'name' attribute for parameter or parameter reference" 3390,xmlDocMissingCrossReference,"This XML comment is invalid: missing 'cref' attribute for cross-reference" @@ -1642,6 +1641,7 @@ forFormatInvalidForInterpolated4,"Interpolated strings used as type IFormattable 3390,xmlDocDuplicateParameter,"This XML comment is invalid: multiple documentation entries for parameter '%s'" 3390,xmlDocUnresolvedCrossReference,"This XML comment is invalid: unresolved cross-reference '%s'" 3390,xmlDocMissingParameter,"This XML comment is incomplete: no documentation for parameter '%s'" +3391,tcImplicitConversionUsedForNonMethodArg,"This expression uses the implicit conversion '%s' to convert type '%s' to type '%s'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\"." 3392,containerDeprecated,"The 'AssemblyKeyNameAttribute' has been deprecated. Use 'AssemblyKeyFileAttribute' instead." 3393,containerSigningUnsupportedOnThisPlatform,"Key container signing is not supported on this platform." 3394,parsNewExprMemberAccess,"This member access is ambiguous. Please use parentheses around the object creation, e.g. '(new SomeType(args)).MemberName'" @@ -1711,16 +1711,16 @@ featureInformationalObjInferenceDiagnostic,"Diagnostic 3559 (warn when obj infer featureStaticLetInRecordsDusEmptyTypes,"Allow static let bindings in union, record, struct, non-incremental-class types" 3566,tcMultipleRecdTypeChoice,"Multiple type matches were found:\n%s\nThe type '%s' was used. Due to the overlapping field names\n%s\nconsider using type annotations or change the order of open statements." 3567,parsMissingMemberBody,"Expecting member body" -3572,parsConstraintIntersectionSyntaxUsedWithNonFlexibleType,"Constraint intersection syntax may only be used with flexible types, e.g. '#IDisposable & #ISomeInterface'." 3568,parsMissingKeyword,"Missing keyword '%s'" +3569,chkNotTailRecursive,"The member or function '%s' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." 3570,tcAmbiguousDiscardDotLambda,"The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope." 3571,parsUnderScoreDotLambdaNonAtomic," _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses." featureAccessorFunctionShorthand,"underscore dot shorthand for accessor only function" -3569,chkNotTailRecursive,"The member or function '%s' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." -3570,tcStaticBindingInExtrinsicAugmentation,"Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead." -3571,pickleFsharpCoreBackwardsCompatible,"Newly added pickle state cannot be used in FSharp.Core, since it must be working in older compilers+tooling as well. The time window is at least 3 years after feature introduction. Violation: %s . Context: \n %s " +3572,parsConstraintIntersectionSyntaxUsedWithNonFlexibleType,"Constraint intersection syntax may only be used with flexible types, e.g. '#IDisposable & #ISomeInterface'." +3573,tcStaticBindingInExtrinsicAugmentation,"Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead." +3574,pickleFsharpCoreBackwardsCompatible,"Newly added pickle state cannot be used in FSharp.Core, since it must be working in older compilers+tooling as well. The time window is at least 3 years after feature introduction. Violation: %s . Context: \n %s " 3577,tcOverrideUsesMultipleArgumentsInsteadOfTuple,"This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c')." featureUnmanagedConstraintCsharpInterop,"Interop between C#'s and F#'s unmanaged generic constraint (emit additional modreq)" 3578,chkCopyUpdateSyntaxInAnonRecords,"This expression is an anonymous record, use {{|...|}} instead of {{...}}." 3579,alwaysUseTypedStringInterpolation,"Interpolated string contains untyped identifiers. Adding typed format specifiers is recommended." -3580,tcUnexpectedFunTypeInUnionCaseField,"Unexpected function type in union case field definition. If you intend the field to be a function, consider wrapping the function signature with parens, e.g. | Case of a -> b into | Case of (a -> b)." \ No newline at end of file +3580,tcUnexpectedFunTypeInUnionCaseField,"Unexpected function type in union case field definition. If you intend the field to be a function, consider wrapping the function signature with parens, e.g. | Case of a -> b into | Case of (a -> b)." From 11c9fa5a0538517ab30ee8f2f3b9f9367449caf2 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Sun, 27 Aug 2023 22:27:25 +0800 Subject: [PATCH 02/26] Update test --- .../Misc/UnknownDependencyManager/script1.fsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fsharpqa/Source/InteractiveSession/Misc/UnknownDependencyManager/script1.fsx b/tests/fsharpqa/Source/InteractiveSession/Misc/UnknownDependencyManager/script1.fsx index 2c30ed8ff15..152b5686252 100644 --- a/tests/fsharpqa/Source/InteractiveSession/Misc/UnknownDependencyManager/script1.fsx +++ b/tests/fsharpqa/Source/InteractiveSession/Misc/UnknownDependencyManager/script1.fsx @@ -1,5 +1,5 @@ -//Package manager key 'unk' was not registered -//Processing of a script fragment has stopped because an exception has been raised +//Package manager key 'unk' was not registered +//Processing of a script fragment has stopped because an exception has been raised #r "unk: blubblub" From 5c4f924a09fd4cd4d7da8d6541f5cadbd5b3d951 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Sun, 27 Aug 2023 22:32:44 +0800 Subject: [PATCH 03/26] 3570 -> 3573 --- tests/fsharp/typecheck/sigs/neg46.bsl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/fsharp/typecheck/sigs/neg46.bsl b/tests/fsharp/typecheck/sigs/neg46.bsl index fbe970a68a5..1685d0b338a 100644 --- a/tests/fsharp/typecheck/sigs/neg46.bsl +++ b/tests/fsharp/typecheck/sigs/neg46.bsl @@ -1,13 +1,13 @@ neg46.fs(6,8,6,26): typecheck error FS0912: This declaration element is not permitted in an augmentation -neg46.fs(10,8,10,40): typecheck error FS3570: Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead. +neg46.fs(10,8,10,40): typecheck error FS3573: Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead. -neg46.fs(14,8,14,26): typecheck error FS3570: Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead. +neg46.fs(14,8,14,26): typecheck error FS3573: Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead. -neg46.fs(18,8,19,21): typecheck error FS3570: Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead. +neg46.fs(18,8,19,21): typecheck error FS3573: Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead. -neg46.fs(23,8,23,32): typecheck error FS3570: Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead. +neg46.fs(23,8,23,32): typecheck error FS3573: Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead. neg46.fs(27,8,27,25): typecheck error FS0912: This declaration element is not permitted in an augmentation @@ -37,4 +37,4 @@ neg46.fs(64,8,64,26): typecheck error FS0912: This declaration element is not pe neg46.fs(68,18,68,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type -neg46.fs(73,18,73,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type \ No newline at end of file +neg46.fs(73,18,73,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type From b7b29ecf889d4975054848632b5c1574f43bb6ba Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Sun, 27 Aug 2023 22:38:23 +0800 Subject: [PATCH 04/26] 1503 -> 1003 --- tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb04.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb04.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb04.fs index d2546e62211..5e45f53b8fc 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb04.fs +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb04.fs @@ -1,4 +1,4 @@ // #Regression #NoMT #CompilerOptions #NoMono // Regression test for FSharp1.0:3204 - Compiler throws exception when trying to use option "-g --pdb" on a locked file (or any non-accessible file) -//The pdb output file name cannot match the build output filename use --pdb:filename.pdb +//The pdb output file name cannot match the build output filename use --pdb:filename.pdb exit 1 From b111c7ccc08de9171a5c998e8491067efecae64a Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 02:41:43 +0800 Subject: [PATCH 05/26] 3570 -> 3573 --- .../StaticLet/StaticLetInUnionsAndRecords.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs index 1a40189bb9e..8f05076b144 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs @@ -234,7 +234,7 @@ let ``Static let extension to builtin type`` compilation = compilation |> typecheck |> shouldFail - |> withDiagnostics [Error 3570, Line 4, Col 5, Line 4, Col 51, "Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead."] + |> withDiagnostics [Error 3573, Line 4, Col 5, Line 4, Col 51, "Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead."] [] let ``Static let - quotations support for records`` compilation = From 447e14c16654dcc75f4c0894bd6699be9cb2fbf0 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 15:37:31 +0800 Subject: [PATCH 06/26] 3217 -> 999 --- .../DependencyManagerInteractiveTests.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs index c37d087e9ea..e0738b4443d 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs @@ -816,7 +816,7 @@ x |> Seq.iter(fun r -> let report errorType code message = match errorType with | ErrorReportType.Error -> - if code = 3217 then foundCorrectError <- true + if code = 999 then foundCorrectError <- true else foundWrongError <- true | ErrorReportType.Warning -> printfn "PackageManagementWarning %d : %s" code message ResolvingErrorReport (report) @@ -839,7 +839,7 @@ x |> Seq.iter(fun r -> let report errorType code message = match errorType with | ErrorReportType.Error -> - if code = 3217 then foundCorrectError <- true + if code = 999 then foundCorrectError <- true else foundWrongError <- true | ErrorReportType.Warning -> printfn "PackageManagementWarning %d : %s" code message ResolvingErrorReport (report) @@ -886,7 +886,7 @@ x |> Seq.iter(fun r -> let report errorType code message = match errorType with | ErrorReportType.Error -> - if code = 3217 then foundCorrectError <- true + if code = 999 then foundCorrectError <- true else foundWrongError <- true | ErrorReportType.Warning -> printfn "PackageManagementWarning %d : %s" code message ResolvingErrorReport (report) From 00faa3bbbc9fa28a8fabb8997cd7ca3b8fc5ea53 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 17:37:40 +0800 Subject: [PATCH 07/26] Update output.1000.stderr.bsl --- tests/fsharp/core/printing/output.1000.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.1000.stderr.bsl b/tests/fsharp/core/printing/output.1000.stderr.bsl index 6926dcc9f34..53e682e8f6e 100644 --- a/tests/fsharp/core/printing/output.1000.stderr.bsl +++ b/tests/fsharp/core/printing/output.1000.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From a22e2f3acb8742b6164850d458c46e819f932f1e Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 17:37:57 +0800 Subject: [PATCH 08/26] Update output.200.stderr.bsl --- tests/fsharp/core/printing/output.200.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.200.stderr.bsl b/tests/fsharp/core/printing/output.200.stderr.bsl index 6926dcc9f34..53e682e8f6e 100644 --- a/tests/fsharp/core/printing/output.200.stderr.bsl +++ b/tests/fsharp/core/printing/output.200.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From 5b86d774b706d310bac8e2183e0a482e876ca4bc Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 17:38:10 +0800 Subject: [PATCH 09/26] Update output.47.stderr.bsl --- tests/fsharp/core/printing/output.47.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.47.stderr.bsl b/tests/fsharp/core/printing/output.47.stderr.bsl index 3e98bca2fc4..505f4467610 100644 --- a/tests/fsharp/core/printing/output.47.stderr.bsl +++ b/tests/fsharp/core/printing/output.47.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From 32f356ce2f25999c2a31a484707d5be635ae675a Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 17:38:25 +0800 Subject: [PATCH 10/26] Update output.multiemit.stderr.bsl --- tests/fsharp/core/printing/output.multiemit.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.multiemit.stderr.bsl b/tests/fsharp/core/printing/output.multiemit.stderr.bsl index 6926dcc9f34..53e682e8f6e 100644 --- a/tests/fsharp/core/printing/output.multiemit.stderr.bsl +++ b/tests/fsharp/core/printing/output.multiemit.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From f791369b9b2471214fd0432adb4648db9e96401b Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 17:38:36 +0800 Subject: [PATCH 11/26] Update output.off.stderr.bsl --- tests/fsharp/core/printing/output.off.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.off.stderr.bsl b/tests/fsharp/core/printing/output.off.stderr.bsl index 6926dcc9f34..53e682e8f6e 100644 --- a/tests/fsharp/core/printing/output.off.stderr.bsl +++ b/tests/fsharp/core/printing/output.off.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From e6716d53e69bf2f4d0a9d3a7d11f2e3fd47ed515 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 17:38:48 +0800 Subject: [PATCH 12/26] Update output.quiet.stderr.bsl --- tests/fsharp/core/printing/output.quiet.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.quiet.stderr.bsl b/tests/fsharp/core/printing/output.quiet.stderr.bsl index 6926dcc9f34..53e682e8f6e 100644 --- a/tests/fsharp/core/printing/output.quiet.stderr.bsl +++ b/tests/fsharp/core/printing/output.quiet.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From 099021668f4e54b3c92ed2c8f39dcfed88a0c14d Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 17:38:58 +0800 Subject: [PATCH 13/26] Update output.stderr.bsl --- tests/fsharp/core/printing/output.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.stderr.bsl b/tests/fsharp/core/printing/output.stderr.bsl index 6926dcc9f34..53e682e8f6e 100644 --- a/tests/fsharp/core/printing/output.stderr.bsl +++ b/tests/fsharp/core/printing/output.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From d1ca738b39c143c0ecac0f2406d49ecc490317d2 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 18:04:57 +0800 Subject: [PATCH 14/26] Update output.stderr.bsl --- tests/fsharp/core/printing/output.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.stderr.bsl b/tests/fsharp/core/printing/output.stderr.bsl index 53e682e8f6e..6926dcc9f34 100644 --- a/tests/fsharp/core/printing/output.stderr.bsl +++ b/tests/fsharp/core/printing/output.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From 9678094b0108cd564759fedbab5305507f40c03f Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 18:05:34 +0800 Subject: [PATCH 15/26] Update output.off.stderr.bsl --- tests/fsharp/core/printing/output.off.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.off.stderr.bsl b/tests/fsharp/core/printing/output.off.stderr.bsl index 53e682e8f6e..6926dcc9f34 100644 --- a/tests/fsharp/core/printing/output.off.stderr.bsl +++ b/tests/fsharp/core/printing/output.off.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From a001a7db75ebecc9e4f973d75ee2ae724c4e3a01 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 18:05:47 +0800 Subject: [PATCH 16/26] Update output.multiemit.stderr.bsl --- tests/fsharp/core/printing/output.multiemit.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.multiemit.stderr.bsl b/tests/fsharp/core/printing/output.multiemit.stderr.bsl index 53e682e8f6e..6926dcc9f34 100644 --- a/tests/fsharp/core/printing/output.multiemit.stderr.bsl +++ b/tests/fsharp/core/printing/output.multiemit.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From 1aae03f3a1cbd70839904cf65cff155a53511bbd Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 18:06:02 +0800 Subject: [PATCH 17/26] Update output.47.stderr.bsl --- tests/fsharp/core/printing/output.47.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.47.stderr.bsl b/tests/fsharp/core/printing/output.47.stderr.bsl index 505f4467610..3e98bca2fc4 100644 --- a/tests/fsharp/core/printing/output.47.stderr.bsl +++ b/tests/fsharp/core/printing/output.47.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From a665ae3e801785b9604c16f88f9f734d958422ab Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 18:06:11 +0800 Subject: [PATCH 18/26] Update output.200.stderr.bsl --- tests/fsharp/core/printing/output.200.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.200.stderr.bsl b/tests/fsharp/core/printing/output.200.stderr.bsl index 53e682e8f6e..6926dcc9f34 100644 --- a/tests/fsharp/core/printing/output.200.stderr.bsl +++ b/tests/fsharp/core/printing/output.200.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From 5d007eb911fa845cc6778f2d66c58b608379ab3a Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 18:06:30 +0800 Subject: [PATCH 19/26] Update output.1000.stderr.bsl --- tests/fsharp/core/printing/output.1000.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.1000.stderr.bsl b/tests/fsharp/core/printing/output.1000.stderr.bsl index 53e682e8f6e..6926dcc9f34 100644 --- a/tests/fsharp/core/printing/output.1000.stderr.bsl +++ b/tests/fsharp/core/printing/output.1000.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From 9368513f0b3999e2fe107b1f0003cb8f0e0ea25b Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 18:07:13 +0800 Subject: [PATCH 20/26] Update FSComp.txt --- src/Compiler/FSComp.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 6d4efa26af5..a184e56d1da 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -838,7 +838,6 @@ ilDynamicInvocationNotSupported,"Dynamic invocation of %s is not supported" 992,ilStructLayoutAttributeCouldNotBeDecoded,"The StructLayout attribute could not be decoded" 993,ilDefaultAugmentationAttributeCouldNotBeDecoded,"The DefaultAugmentation attribute could not be decoded" 994,ilReflectedDefinitionsCannotUseSliceOperator,"Reflected definitions cannot contain uses of the prefix splice operator '%%'" -997,fsiInvalidDirective,"Invalid directive '#%s %s'" 998,packageManagerUnknown,"Package manager key '%s' was not registered in %s. Currently registered: %s. To learn more about extensions, visit: https://aka.ms/dotnetdepmanager" 999,packageManagerError,"%s" 1000,optsProblemWithCodepage,"Problem with codepage '%d': %s" @@ -1530,10 +1529,11 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3343,tcRequireMergeSourcesOrBindN,"The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '%s' method or appropriate 'MergeSources' and 'Bind' methods" 3344,tcAndBangNotSupported,"This feature is not supported in this version of F#. You may need to add /langversion:preview to use this feature." 3345,tcInvalidUseBangBindingNoAndBangs,"use! may not be combined with and!" +3349,chkFeatureNotSupportedInLibrary,"Feature '%s' requires the F# library for language version %s or greater." 3350,chkFeatureNotLanguageSupported,"Feature '%s' is not available in F# %s. Please use language version %s or greater." 3351,chkFeatureNotRuntimeSupported,"Feature '%s' is not supported by target runtime." 3352,typrelInterfaceMemberNoMostSpecificImplementation,"Interface member '%s' does not have a most specific implementation." -3353,chkFeatureNotSupportedInLibrary,"Feature '%s' requires the F# library for language version %s or greater." +3353,fsiInvalidDirective,"Invalid directive '#%s %s'" useSdkRefs,"Use reference assemblies for .NET framework references when available (Enabled by default)." optsGetLangVersions,"Display the allowed values for language version." optsSetLangVersion,"Specify language version such as 'latest' or 'preview'." From 1ec0750b9bdbcde43e52b7a015d9dacc29a516e6 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 18:10:24 +0800 Subject: [PATCH 21/26] Update FSComp.txt --- src/Compiler/FSComp.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index a184e56d1da..fbf204e834c 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -868,7 +868,7 @@ optsNowin32manifest,"Do not include the default Win32 manifest" optsEmbedAllSource,"Embed all source files in the portable PDB file" optsEmbedSource,"Embed specific source files in the portable PDB file" optsSourceLink,"Source link information file to embed in the portable PDB file" -1003,optsPdbMatchesOutputFileName,"The pdb output file name cannot match the build output filename use --pdb:filename.pdb" +1001,optsPdbMatchesOutputFileName,"The pdb output file name cannot match the build output filename use --pdb:filename.pdb" srcFileTooLarge,"Source file is too large to embed in a portable PDB" optsResource,"Embed the specified managed resource" optsLinkresource,"Link the specified resource to this assembly where the resinfo format is [,[,public|private]]" From 1d522b1976f31bc13aaa9feab2d8654dec26defd Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 18:11:53 +0800 Subject: [PATCH 22/26] Update pdb04.fs --- tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb04.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb04.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb04.fs index 5e45f53b8fc..9f0e4958b9c 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb04.fs +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/pdb/pdb04.fs @@ -1,4 +1,4 @@ // #Regression #NoMT #CompilerOptions #NoMono // Regression test for FSharp1.0:3204 - Compiler throws exception when trying to use option "-g --pdb" on a locked file (or any non-accessible file) -//The pdb output file name cannot match the build output filename use --pdb:filename.pdb +//The pdb output file name cannot match the build output filename use --pdb:filename.pdb exit 1 From 64105008c77b3df23897e5c3e08cb202c2dbca31 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 18:12:20 +0800 Subject: [PATCH 23/26] Update output.quiet.stderr.bsl --- tests/fsharp/core/printing/output.quiet.stderr.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/core/printing/output.quiet.stderr.bsl b/tests/fsharp/core/printing/output.quiet.stderr.bsl index 53e682e8f6e..6926dcc9f34 100644 --- a/tests/fsharp/core/printing/output.quiet.stderr.bsl +++ b/tests/fsharp/core/printing/output.quiet.stderr.bsl @@ -2,7 +2,7 @@ #blaaaaaa // blaaaaaa is not a known command;; ^^^^^^^^^ -stdin(219,1): warning FS0997: Invalid directive '#blaaaaaa ' +stdin(219,1): warning FS3353: Invalid directive '#blaaaaaa ' type Regression4319_T0 = static member (+-+-+) = "0 arguments";; From fede20946c96570fecf4eccd5143563bf5fd2550 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 23:03:30 +0800 Subject: [PATCH 24/26] Add a error code sorting check --- azure-pipelines.yml | 6 +++++- src/Compiler/FSComp.txt | 10 +++++----- src/Compiler/FSCompCheck.fsx | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 src/Compiler/FSCompCheck.fsx diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b30aa7cd8da..20144846db8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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) @@ -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 - script: dotnet fantomas . -r --check env: DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1 diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 5da6c97ca5a..ff3f8ef15db 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -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'." @@ -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" @@ -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'" diff --git a/src/Compiler/FSCompCheck.fsx b/src/Compiler/FSCompCheck.fsx new file mode 100644 index 00000000000..47b813992ed --- /dev/null +++ b/src/Compiler/FSCompCheck.fsx @@ -0,0 +1,22 @@ +#r "nuget: FSharpPlus, 1.4.1" +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 + | _ -> 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}" From ee5281e9f4a8fe910d569d908e3992d9dc798f86 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 23:05:32 +0800 Subject: [PATCH 25/26] Fix wording --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 20144846db8..ad765590ade 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -249,7 +249,7 @@ stages: continueOnError: true condition: not(succeeded()) - # Check FSComp.txt error code sorting code formatting + # Check FSComp.txt error code sorting and code formatting - job: CheckCodeFormatting pool: vmImage: $(UbuntuMachineQueueName) From e0bef8f8f42a5a80b1d399b7c3bd1f5940027252 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Mon, 28 Aug 2023 23:34:14 +0800 Subject: [PATCH 26/26] Update the script --- FSharp.sln | 1 + src/Compiler/FSCompCheck.fsx | 26 ++++++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/FSharp.sln b/FSharp.sln index 364764378bb..c021f7026b4 100644 --- a/FSharp.sln +++ b/FSharp.sln @@ -103,6 +103,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D58BFE8B-7C85-4D3B-B5F3-9A7BB90FF1EE}" ProjectSection(SolutionItems) = preProject src\Compiler\FSComp.txt = src\Compiler\FSComp.txt + src\Compiler\FSCompCheck.fsx = src\Compiler\FSCompCheck.fsx EndProjectSection EndProject Global diff --git a/src/Compiler/FSCompCheck.fsx b/src/Compiler/FSCompCheck.fsx index 47b813992ed..03dc23a38b9 100644 --- a/src/Compiler/FSCompCheck.fsx +++ b/src/Compiler/FSCompCheck.fsx @@ -1,22 +1,32 @@ -#r "nuget: FSharpPlus, 1.4.1" -let inline (|Matches|_|) format = FSharpPlus.Parsing.trySscanf format +let digits = set { '0' .. '9' } + +let rec intStringEndIndex i s = + if i >= String.length s then + String.length s - 1 + elif Set.contains s[i] digits then + intStringEndIndex (i + 1) s + else + i - 1 __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, _) -> + let line = line.TrimStart [| ' '; '#' |] + let intStringEndIndex = intStringEndIndex 0 line + + if intStringEndIndex >= 0 then // Line starts with an integer (error code) + let errorCode = line[..intStringEndIndex] |> int + match counters with | [] -> [ errorCode ] // Initialise a counter | head :: tail when errorCode >= head -> errorCode :: tail // Increment current counter | _ -> errorCode :: counters // Start a new counter - | _ -> counters) + else + 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}" + failwith $"Error codes not sorted in FSComp.txt, break(s) happened after {List.rev counters}"