Skip to content

Commit ee93a1b

Browse files
authored
Merge pull request #12114 from dotnet/merges/main-to-release/dev17.0
Merge main to release/dev17.0
2 parents 29a1afe + acd7a8c commit ee93a1b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+999
-148
lines changed

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
</Dependency>
99
</ProductDependencies>
1010
<ToolsetDependencies>
11-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.21452.4">
11+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.21456.1">
1212
<Uri>https://github.com/dotnet/arcade</Uri>
13-
<Sha>00949c51badfda4edd51d217a82ba607db7c4576</Sha>
13+
<Sha>7309c692126e24bc10702f39fe45b2a295b224d2</Sha>
1414
<SourceBuild RepoName="arcade" ManagedOnly="true" />
1515
</Dependency>
1616
</ToolsetDependencies>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
},
1616
"msbuild-sdks": {
17-
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21452.4",
17+
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21456.1",
1818
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
1919
}
2020
}

src/fsharp/CompilerConfig.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ type TcConfigBuilder =
663663
internalTestSpanStackReferring = false
664664
noConditionalErasure = false
665665
pathMap = PathMap.empty
666-
langVersion = LanguageVersion("default")
666+
langVersion = LanguageVersion.Default
667667
implicitIncludeDir = implicitIncludeDir
668668
defaultFSharpBinariesDir = defaultFSharpBinariesDir
669669
reduceMemoryUsage = reduceMemoryUsage

src/fsharp/ErrorLogger.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ let deprecatedOperator m = deprecatedWithError (FSComp.SR.elDeprecatedOperator()
502502

503503
let mlCompatWarning s m = warning(UserCompilerMessage(FSComp.SR.mlCompatMessage s, 62, m))
504504

505+
let mlCompatError s m = errorR(UserCompilerMessage(FSComp.SR.mlCompatError s, 62, m))
506+
505507
let suppressErrorReporting f =
506508
let errorLogger = CompileThreadStatic.ErrorLogger
507509
try

src/fsharp/ErrorLogger.fsi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ val libraryOnlyWarning: m:range -> unit
234234

235235
val deprecatedOperator: m:range -> unit
236236

237-
val mlCompatWarning: s:String -> m:range -> unit
237+
val mlCompatWarning: s:string -> m:range -> unit
238+
239+
val mlCompatError: s:string -> m:range -> unit
238240

239241
val suppressErrorReporting: f:(unit -> 'a) -> 'a
240242

src/fsharp/FSComp.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ tupleRequiredInAbstractMethod,"\nA tuple type is required for one or more argume
5252
224,buildOptionRequiresParameter,"Option requires parameter: %s"
5353
225,buildCouldNotFindSourceFile,"Source file '%s' could not be found"
5454
226,buildInvalidSourceFileExtension,"The file extension of '%s' is not recognized. Source files must have extension .fs, .fsi, .fsx, .fsscript, .ml or .mli."
55+
226,buildInvalidSourceFileExtensionUpdated,"The file extension of '%s' is not recognized. Source files must have extension .fs, .fsi, .fsx or .fsscript"
56+
226,buildInvalidSourceFileExtensionML,"The file extension of '%s' is not recognized. Source files must have extension .fs, .fsi, .fsx or .fsscript. To enable the deprecated use of .ml or .mli extensions, use '--langversion:5.0' and '--mlcompatibility'."
5557
227,buildCouldNotResolveAssembly,"Could not resolve assembly '%s'"
5658
228,buildCouldNotResolveAssemblyRequiredByFile,"Could not resolve assembly '%s' required by '%s'"
5759
229,buildErrorOpeningBinaryFile,"Error opening binary file '%s': %s"
@@ -1078,13 +1080,21 @@ parsNonAtomicType,"The use of the type syntax 'int C' and 'C <int>' is not perm
10781080
#1203 - used for error in FSharp.Core CompilerMessage message
10791081
#1204 - used for error in FSharp.Core CompilerMessage message
10801082
mlCompatMessage,"This construct is for ML compatibility. %s. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'."
1083+
mlCompatError,"This construct is deprecated. %s. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'."
1084+
mlCompatKeyword,"In previous versions of F# '%s' was a reserved keyword but the use of this keyword is now deprecated"
1085+
mlCompatLightOffNoLongerSupported,"The use of '#light \"off\"' or '#indent \"off\"' was deprecated in F# 2.0 and is no longer supported"
1086+
mlCompatSigColonNoLongerSupported,"The use of 'module M: sig ... end ' was deprecated in F# 2.0 and is no longer supported. Change the ':' to an '=' and remove the 'sig' and 'end' and use indentation instead"
1087+
mlCompatSigEndNoLongerSupported,"The use of 'module M = sig ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'sig' and 'end' and use indentation instead"
1088+
mlCompatMultiPrefixTyparsNoLongerSupported,"The use of multiple parenthesized type parameters before a generic type name such as '(int, int) Map' was deprecated in F# 2.0 and is no longer supported"
1089+
mlCompatStructEndNoLongerSupported,"The use of 'module M = struct ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'struct' and 'end' and use indentation instead"
10811090
#1205,chkDuplicateInherittedVirtualMethod,"Duplicate virtual methods. There are multiple virtual methods named '%s' with the same signature in the parent (inherited) type. This may be a result of instantiating the parent type."
10821091
1206,ilFieldDoesNotHaveValidOffsetForStructureLayout,"The type '%s' has been marked as having an Explicit layout, but the field '%s' has not been marked with the 'FieldOffset' attribute"
10831092
1207,tcInterfacesShouldUseInheritNotInterface,"Interfaces inherited by other interfaces should be declared using 'inherit ...' instead of 'interface ...'"
10841093
1208,parsInvalidPrefixOperator,"Invalid prefix operator"
10851094
1208,parsInvalidPrefixOperatorDefinition,"Invalid operator definition. Prefix operator definitions must use a valid prefix operator name."
10861095
buildCompilingExtensionIsForML,"The file extensions '.ml' and '.mli' are for ML compatibility"
10871096
lexIndentOffForML,"Consider using a file with extension '.ml' or '.mli' instead"
1097+
lexIfOCaml,"IF-FSHARP/IF-CAML regions are no longer supported"
10881098
1209,activePatternIdentIsNotFunctionTyped,"Active pattern '%s' is not a function"
10891099
1210,activePatternChoiceHasFreeTypars,"Active pattern '%s' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'"
10901100
1211,ilFieldHasOffsetForSequentialLayout,"The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit)"
@@ -1237,6 +1247,7 @@ featureRefCellNotationInformationals,"informational messages related to referenc
12371247
featureDiscardUseValue,"discard pattern in use binding"
12381248
featureNonVariablePatternsToRightOfAsPatterns,"non-variable patterns to the right of 'as' patterns"
12391249
featureAttributesToRightOfModuleKeyword,"attributes to the right of the 'module' keyword"
1250+
featureMLCompatRevisions,"ML compatibility revisions"
12401251
3090,tcIfThenElseMayNotBeUsedWithinQueries,"An if/then/else expression may not be used within queries. Consider using either an if/then expression, or use a sequence expression instead."
12411252
3091,ilxgenUnexpectedArgumentToMethodHandleOfDuringCodegen,"Invalid argument to 'methodhandleof' during codegen"
12421253
3092,etProvidedTypeReferenceMissingArgument,"A reference to a provided type was missing a value for the static parameter '%s'. You may need to recompile one or more referenced assemblies."

src/fsharp/IlxGen.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4580,8 +4580,9 @@ and GenDefaultValue cenv cgbuf eenv (ty, m) =
45804580
// "initobj" (Generated by EmitInitLocal) doesn't work on byref types
45814581
// But ilzero(&ty) only gets generated in the built-in get-address function so
45824582
// we can just rely on zeroinit of all IL locals.
4583-
if realloc && not (IsILTypeByref ilTy) then
4583+
if (realloc || not eenv.initLocals) && not (IsILTypeByref ilTy) then
45844584
EmitInitLocal cgbuf ilTy locIdx
4585+
45854586
EmitGetLocal cgbuf ilTy locIdx
45864587
)
45874588

src/fsharp/LanguageFeatures.fs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ type LanguageFeature =
4444
| UseBindingValueDiscard
4545
| NonVariablePatternsToRightOfAsPatterns
4646
| AttributesToRightOfModuleKeyword
47+
| MLCompatRevisions
4748

4849
/// LanguageVersion management
49-
type LanguageVersion (specifiedVersionAsString) =
50+
type LanguageVersion (versionText) =
5051

5152
// When we increment language versions here preview is higher than current RTM version
5253
static let languageVersion46 = 4.6m
@@ -98,10 +99,13 @@ type LanguageVersion (specifiedVersionAsString) =
9899

99100
// F# preview
100101
LanguageFeature.FromEndSlicing, previewVersion
102+
LanguageFeature.MLCompatRevisions,previewVersion
101103
]
102104

105+
static let defaultLanguageVersion = LanguageVersion("default")
106+
103107
let specified =
104-
match specifiedVersionAsString with
108+
match versionText with
105109
| "?" -> 0m
106110
| "preview" -> previewVersion
107111
| "default" -> defaultVersion
@@ -127,7 +131,7 @@ type LanguageVersion (specifiedVersionAsString) =
127131

128132
/// Has preview been explicitly specified
129133
member _.IsExplicitlySpecifiedAs50OrBefore() =
130-
match specifiedVersionAsString with
134+
match versionText with
131135
| "4.6" -> true
132136
| "4.7" -> true
133137
| "5.0" -> true
@@ -153,6 +157,9 @@ type LanguageVersion (specifiedVersionAsString) =
153157
sprintf "%M%s" v (if v = defaultVersion then " (Default)" else "")
154158
|]
155159

160+
/// Get the text used to specify the version
161+
member _.VersionText = versionText
162+
156163
/// Get the specified LanguageVersion
157164
member _.SpecifiedVersion = specified
158165

@@ -190,9 +197,19 @@ type LanguageVersion (specifiedVersionAsString) =
190197
| LanguageFeature.UseBindingValueDiscard -> FSComp.SR.featureDiscardUseValue()
191198
| LanguageFeature.NonVariablePatternsToRightOfAsPatterns -> FSComp.SR.featureNonVariablePatternsToRightOfAsPatterns()
192199
| LanguageFeature.AttributesToRightOfModuleKeyword -> FSComp.SR.featureAttributesToRightOfModuleKeyword()
200+
| LanguageFeature.MLCompatRevisions -> FSComp.SR.featureMLCompatRevisions()
193201

194202
/// Get a version string associated with the given feature.
195203
member _.GetFeatureVersionString feature =
196204
match features.TryGetValue feature with
197205
| true, v -> versionToString v
198206
| _ -> invalidArg "feature" "Internal error: Unable to find feature."
207+
208+
override x.Equals(yobj: obj) =
209+
match yobj with
210+
| :? LanguageVersion as y -> x.SpecifiedVersion = y.SpecifiedVersion
211+
| _ -> false
212+
213+
override x.GetHashCode() = hash x.SpecifiedVersion
214+
215+
static member Default = defaultLanguageVersion

src/fsharp/LanguageFeatures.fsi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type LanguageFeature =
3434
| UseBindingValueDiscard
3535
| NonVariablePatternsToRightOfAsPatterns
3636
| AttributesToRightOfModuleKeyword
37+
| MLCompatRevisions
3738

3839
/// LanguageVersion management
3940
type LanguageVersion =
@@ -62,6 +63,9 @@ type LanguageVersion =
6263
/// Get the specified LanguageVersion
6364
member SpecifiedVersion: decimal
6465

66+
/// Get the text used to specify the version, several of which may map to the same version
67+
member VersionText: string
68+
6569
/// Get the specified LanguageVersion as a string
6670
member SpecifiedVersionString: string
6771

@@ -70,3 +74,5 @@ type LanguageVersion =
7074

7175
/// Get a version string associated with the given feature.
7276
member GetFeatureVersionString: feature: LanguageFeature -> string
77+
78+
static member Default: LanguageVersion

src/fsharp/ParseAndCheckInputs.fs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ open FSharp.Compiler.CompilerDiagnostics
2121
open FSharp.Compiler.CompilerImports
2222
open FSharp.Compiler.Diagnostics
2323
open FSharp.Compiler.ErrorLogger
24+
open FSharp.Compiler.Features
2425
open FSharp.Compiler.IO
2526
open FSharp.Compiler.Lexhelp
2627
open FSharp.Compiler.NameResolution
@@ -269,7 +270,10 @@ let ParseInput (lexer, errorLogger: ErrorLogger, lexbuf: UnicodeLexing.Lexbuf, d
269270
try
270271
let input =
271272
if mlCompatSuffixes |> List.exists (FileSystemUtils.checkSuffix lower) then
272-
mlCompatWarning (FSComp.SR.buildCompilingExtensionIsForML()) rangeStartup
273+
if lexbuf.SupportsFeature LanguageFeature.MLCompatRevisions then
274+
errorR(Error(FSComp.SR.buildInvalidSourceFileExtensionML filename, rangeStartup))
275+
else
276+
mlCompatWarning (FSComp.SR.buildCompilingExtensionIsForML()) rangeStartup
273277

274278
// Call the appropriate parser - for signature files or implementation files
275279
if FSharpImplFileSuffixes |> List.exists (FileSystemUtils.checkSuffix lower) then
@@ -279,7 +283,11 @@ let ParseInput (lexer, errorLogger: ErrorLogger, lexbuf: UnicodeLexing.Lexbuf, d
279283
let intfs = Parser.signatureFile lexer lexbuf
280284
PostParseModuleSpecs (defaultNamespace, filename, isLastCompiland, intfs)
281285
else
282-
delayLogger.Error(Error(FSComp.SR.buildInvalidSourceFileExtension filename, rangeStartup))
286+
if lexbuf.SupportsFeature LanguageFeature.MLCompatRevisions then
287+
error(Error(FSComp.SR.buildInvalidSourceFileExtensionUpdated filename, rangeStartup))
288+
else
289+
error(Error(FSComp.SR.buildInvalidSourceFileExtension filename, rangeStartup))
290+
283291

284292
scopedPragmas <- GetScopedPragmasForInput input
285293
input
@@ -416,8 +424,7 @@ let parseInputFileAux (tcConfig: TcConfig, lexResourceManager, conditionalCompil
416424
use reader = fileStream.GetReader(tcConfig.inputCodePage, retryLocked)
417425

418426
// Set up the LexBuffer for the file
419-
let checkLanguageFeatureErrorRecover = ErrorLogger.checkLanguageFeatureErrorRecover tcConfig.langVersion
420-
let lexbuf = UnicodeLexing.StreamReaderAsLexbuf(not tcConfig.compilingFslib, tcConfig.langVersion.SupportsFeature, checkLanguageFeatureErrorRecover, reader)
427+
let lexbuf = UnicodeLexing.StreamReaderAsLexbuf(not tcConfig.compilingFslib, tcConfig.langVersion, reader)
421428

422429
// Parse the file drawing tokens from the lexbuf
423430
ParseOneInputLexbuf(tcConfig, lexResourceManager, conditionalCompilationDefines, lexbuf, filename, isLastCompiland, errorLogger)

0 commit comments

Comments
 (0)