Skip to content

Commit fb4cdb5

Browse files
authored
Move language features from preview to langversion 10 (#18708)
1 parent 62a6bfd commit fb4cdb5

File tree

39 files changed

+190
-236
lines changed

39 files changed

+190
-236
lines changed

src/Compiler/Facilities/LanguageFeatures.fs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,11 @@ type LanguageVersion(versionText) =
115115
static let languageVersion70 = 7.0m
116116
static let languageVersion80 = 8.0m
117117
static let languageVersion90 = 9.0m
118+
static let languageVersion100 = 10.0m
118119
static let previewVersion = 9999m // Language version when preview specified
119-
static let defaultVersion = languageVersion90 // Language version when default specified
120+
static let defaultVersion = languageVersion100 // Language version when default specified
120121
static let latestVersion = defaultVersion // Language version when latest specified
121-
static let latestMajorVersion = languageVersion90 // Language version when latestmajor specified
122+
static let latestMajorVersion = languageVersion100 // Language version when latestmajor specified
122123

123124
static let validOptions = [| "preview"; "default"; "latest"; "latestmajor" |]
124125

@@ -132,6 +133,7 @@ type LanguageVersion(versionText) =
132133
languageVersion70
133134
languageVersion80
134135
languageVersion90
136+
languageVersion100
135137
|]
136138

137139
static let features =
@@ -222,21 +224,23 @@ type LanguageVersion(versionText) =
222224
LanguageFeature.ParsedHashDirectiveArgumentNonQuotes, languageVersion90
223225
LanguageFeature.EmptyBodiedComputationExpressions, languageVersion90
224226

225-
// F# preview
226-
LanguageFeature.EnforceAttributeTargets, previewVersion // Not enabled due to a number of external library dependencies on unenforced attributes
227-
LanguageFeature.UseTypeSubsumptionCache, languageVersion90
227+
// F# 10.0
228+
LanguageFeature.EnforceAttributeTargets, languageVersion100
229+
LanguageFeature.UseTypeSubsumptionCache, languageVersion100
230+
LanguageFeature.AllowObjectExpressionWithoutOverrides, languageVersion100
231+
LanguageFeature.DontWarnOnUppercaseIdentifiersInBindingPatterns, languageVersion100
232+
LanguageFeature.DeprecatePlacesWhereSeqCanBeOmitted, languageVersion100
233+
LanguageFeature.SupportValueOptionsAsOptionalParameters, languageVersion100
234+
LanguageFeature.WarnWhenUnitPassedToObjArg, languageVersion100
235+
LanguageFeature.UseBangBindingValueDiscard, languageVersion100
236+
LanguageFeature.BetterAnonymousRecordParsing, languageVersion100
237+
LanguageFeature.ScopedNowarn, languageVersion100
238+
LanguageFeature.AllowTypedLetOrUseBang, languageVersion100
239+
240+
// F# preview (still preview in 10.0)
228241
LanguageFeature.UnmanagedConstraintCsharpInterop, previewVersion // not enabled because: https://github.com/dotnet/fsharp/issues/17509
229242
LanguageFeature.FromEndSlicing, previewVersion // Unfinished features --- needs work
230-
LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters, previewVersion
231-
LanguageFeature.AllowObjectExpressionWithoutOverrides, previewVersion
232-
LanguageFeature.DontWarnOnUppercaseIdentifiersInBindingPatterns, previewVersion
233-
LanguageFeature.DeprecatePlacesWhereSeqCanBeOmitted, previewVersion
234-
LanguageFeature.SupportValueOptionsAsOptionalParameters, previewVersion
235-
LanguageFeature.WarnWhenUnitPassedToObjArg, previewVersion
236-
LanguageFeature.UseBangBindingValueDiscard, previewVersion
237-
LanguageFeature.BetterAnonymousRecordParsing, previewVersion
238-
LanguageFeature.ScopedNowarn, previewVersion
239-
LanguageFeature.AllowTypedLetOrUseBang, previewVersion
243+
LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters, previewVersion // Stopped printing arguments to indexed properties
240244
]
241245

242246
static let defaultLanguageVersion = LanguageVersion("default")
@@ -260,6 +264,8 @@ type LanguageVersion(versionText) =
260264
| "8" -> languageVersion80
261265
| "9.0"
262266
| "9" -> languageVersion90
267+
| "10.0"
268+
| "10" -> languageVersion100
263269
| _ -> 0m
264270

265271
let specified = getVersionFromString versionText

start-vs-FsharpSln.cmd

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
:: This command launches a Visual Studio solution with environment variables required to use a local version of the .NET Core SDK.
5+
6+
:: This tells .NET Core to use the same dotnet.exe that build scripts use
7+
set DOTNET_ROOT=%~dp0.dotnet
8+
set DOTNET_ROOT(x86)=%~dp0.dotnet\x86
9+
10+
:: This tells .NET Core not to go looking for .NET Core in other places
11+
set DOTNET_MULTILEVEL_LOOKUP=0
12+
13+
:: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use
14+
set PATH=%DOTNET_ROOT%;%PATH%
15+
16+
call restore.cmd
17+
18+
if not exist "%DOTNET_ROOT%\dotnet.exe" (
19+
echo [ERROR] .NET Core has not yet been installed. Run `%~dp0restore.cmd` to install tools
20+
exit /b 1
21+
)
22+
23+
:: These tasks aren't running successfully when launching VS, skipping when launching via this batch file
24+
set RunNetFrameworkApiCompat=false
25+
set RunRefApiCompat=false
26+
27+
:: Prefer the VS in the developer command prompt if we're in one, followed by whatever shows up in the current search path.
28+
set "DEVENV=%DevEnvDir%devenv.exe"
29+
30+
if exist "%DEVENV%" (
31+
:: Fully qualified works
32+
set "COMMAND=start "" /B "%ComSpec%" /S /C ""%DEVENV%" "%~dp0FSharp.sln"""
33+
) else (
34+
where devenv.exe /Q
35+
if !errorlevel! equ 0 (
36+
:: On the PATH, use that.
37+
set "COMMAND=start "" /B "%ComSpec%" /S /C "devenv.exe "%~dp0FSharp.sln"""
38+
) else (
39+
:: Can't find devenv.exe, let file associations take care of it
40+
set "COMMAND=start /B .\FSharp.sln"
41+
)
42+
)
43+
44+
%COMMAND%

tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module Nowarn =
1616
let private make20 = "1"
1717
let private make25 = "match None with None -> ()"
1818
let private W20 = Warning 20
19-
let private vp = "PREVIEW"
19+
let private vp = "LATEST"
2020
let private v9 = "9.0"
2121
let private fs = String.concat Environment.NewLine >> FsSource
2222
let private fsMod lines = fs ("module A" :: lines)
@@ -179,6 +179,6 @@ let a = 1; #nowarn 20
179179
|> compile
180180
|> withDiagnostics [
181181
Error 3874, Line 4, Col 11, Line 4, Col 22, "#nowarn/#warnon directives must appear as the first non-whitespace characters on a line"
182-
Warning 203, Line 3, Col 9, Line 3, Col 11, "Invalid warning number 'xy'"
183-
Warning 203, Line 3, Col 12, Line 3, Col 17, "Invalid warning number 'abx'"
182+
Error 203, Line 3, Col 9, Line 3, Col 11, "Invalid warning number 'xy'"
183+
Error 203, Line 3, Col 12, Line 3, Col 17, "Invalid warning number 'abx'"
184184
]

tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module flaterrors =
2626
|> compile options
2727
|> shouldFail
2828
|> withDiagnostics [
29+
(Warning 3873, Line 1, Col 10, Line 1, Col 17, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
2930
(Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\n ''a list' \nbut here has type\n ''b seq' ")
3031
(Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\n ''a list' \nbut here has type\n 'int seq' ")
3132
(Warning 20, Line 1, Col 1, Line 1, Col 17, "The result of this expression has type ''a list' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.")
@@ -40,6 +41,7 @@ module flaterrors =
4041
|> compile options
4142
|> shouldFail
4243
|> withDiagnostics [
44+
(Warning 3873, Line 1, Col 10, Line 1, Col 17, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
4345
(Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\029 ''a list' \029but here has type\029 ''b seq'")
4446
(Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\029 ''a list' \029but here has type\029 'int seq'")
4547
]

tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ module CustomAttributes_AttributeUsage =
7979
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsMethod01.fs"|])>]
8080
let ``Preview: AttributeTargetsIsMethod01_fs opt-in warning`` compilation =
8181
compilation
82-
|> withLangVersionPreview
8382
|> withWarnOn 3878
8483
|> verifyCompileAndRun
8584
|> shouldSucceed
@@ -110,7 +109,6 @@ module CustomAttributes_AttributeUsage =
110109
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargets01.fs"|])>]
111110
let ``E_AttributeTargets01_fs`` compilation =
112111
compilation
113-
|> withLangVersionPreview
114112
|> verifyCompile
115113
|> shouldFail
116114
|> withDiagnostics [
@@ -147,7 +145,6 @@ module CustomAttributes_AttributeUsage =
147145
let ``E_AttributeTargetIsField01_fs`` compilation =
148146
compilation
149147
|> withOptions ["--nowarn:25"]
150-
|> withLangVersionPreview
151148
|> verifyCompile
152149
|> shouldFail
153150
|> withDiagnostics [
@@ -200,7 +197,6 @@ module CustomAttributes_AttributeUsage =
200197
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsMethod02.fs"|])>]
201198
let ``E_AttributeTargetIsMethod02_fs`` compilation =
202199
compilation
203-
|> withLangVersionPreview
204200
|> withOptions ["--nowarn:25"]
205201
|> verifyCompile
206202
|> shouldFail
@@ -231,7 +227,6 @@ module CustomAttributes_AttributeUsage =
231227
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsMethod03.fs"|])>]
232228
let ``E_AttributeTargetIsMethod03_fs`` compilation =
233229
compilation
234-
|> withLangVersionPreview
235230
|> withOptions ["--nowarn:25"]
236231
|> verifyCompile
237232
|> shouldFail
@@ -349,7 +344,6 @@ module CustomAttributes_AttributeUsage =
349344
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsStruct.fs"|])>]
350345
let ``E_AttributeTargetIsStruct_fs`` compilation =
351346
compilation
352-
|> withLangVersionPreview
353347
|> verifyCompile
354348
|> shouldFail
355349
|> withDiagnostics [
@@ -379,7 +373,6 @@ module CustomAttributes_AttributeUsage =
379373
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass.fs"|])>]
380374
let ``E_AttributeTargetIsClass_fs`` compilation =
381375
compilation
382-
|> withLangVersionPreview
383376
|> verifyCompile
384377
|> shouldFail
385378
|> withDiagnostics [
@@ -400,7 +393,6 @@ module CustomAttributes_AttributeUsage =
400393
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass01.fs"|])>]
401394
let ``E_AttributeTargetIsClass01_fs`` compilation =
402395
compilation
403-
|> withLangVersionPreview
404396
|> verifyCompile
405397
|> shouldFail
406398
|> withDiagnostics [
@@ -510,7 +502,6 @@ module CustomAttributes_AttributeUsage =
510502
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsField03.fs"|])>]
511503
let ``E_AttributeTargetIsField03_fs`` compilation =
512504
compilation
513-
|> withLangVersionPreview
514505
|> verifyCompile
515506
|> shouldFail
516507
|> withDiagnostics [
@@ -521,7 +512,6 @@ module CustomAttributes_AttributeUsage =
521512
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsField03.fs"|])>]
522513
let ``Preview: E_AttributeTargetIsField03_fs opt-in warning`` compilation =
523514
compilation
524-
|> withLangVersionPreview
525515
|> withWarnOn 3878
526516
|> verifyCompile
527517
|> shouldFail
@@ -543,7 +533,6 @@ module CustomAttributes_AttributeUsage =
543533
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsProperty01.fs"|])>]
544534
let ``E_AttributeTargetIsProperty01_fs`` compilation =
545535
compilation
546-
|> withLangVersionPreview
547536
|> verifyCompile
548537
|> shouldSucceed
549538

@@ -559,7 +548,6 @@ module CustomAttributes_AttributeUsage =
559548
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsCtor01.fs"|])>]
560549
let ``E_AttributeTargetIsCtor01_fs`` compilation =
561550
compilation
562-
|> withLangVersionPreview
563551
|> verifyCompile
564552
|> shouldFail
565553
|> withDiagnostics [
@@ -596,7 +584,6 @@ module CustomAttributes_AttributeUsage =
596584
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsEnum01.fs"|])>]
597585
let ``E_AttributeTargetIsEnum01_fs`` compilation =
598586
compilation
599-
|> withLangVersionPreview
600587
|> verifyCompile
601588
|> shouldFail
602589
|> withDiagnostics [
@@ -633,7 +620,6 @@ module CustomAttributes_AttributeUsage =
633620
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsDelegate01.fs"|])>]
634621
let ``E_AttributeTargetsIsDelegate01_fs`` compilation =
635622
compilation
636-
|> withLangVersionPreview
637623
|> verifyCompile
638624
|> shouldFail
639625
|> withDiagnostics [
@@ -682,7 +668,6 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
682668
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsInterface.fs"|])>]
683669
let ``E_AttributeTargetIsInterface_fs`` compilation =
684670
compilation
685-
|> withLangVersionPreview
686671
|> verifyCompile
687672
|> shouldFail
688673
|> withDiagnostics [
@@ -704,7 +689,6 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
704689
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass02.fs"|])>]
705690
let ``E_AttributeTargetIsClass02_fs`` compilation =
706691
compilation
707-
|> withLangVersionPreview
708692
|> verifyCompile
709693
|> shouldFail
710694
|> withDiagnostics [

tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Basic.fs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ module CustomAttributes_Basic =
160160
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_StructLayoutSequentialNeg_DU2.fs"|])>]
161161
let ``E_StructLayoutSequentialNeg_DU2_fs`` compilation =
162162
compilation
163-
|> withLangVersionPreview
164163
|> verifyCompile
165164
|> shouldFail
166165
|> withDiagnostics [
@@ -171,7 +170,6 @@ module CustomAttributes_Basic =
171170
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_StructLayoutSequentialNeg_Delegate.fs"|])>]
172171
let ``E_StructLayoutSequentialNeg_Delegate_fs`` compilation =
173172
compilation
174-
|> withLangVersionPreview
175173
|> verifyCompile
176174
|> shouldFail
177175
|> withDiagnostics [
@@ -182,7 +180,6 @@ module CustomAttributes_Basic =
182180
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_StructLayoutSequentialNeg_Interface.fs"|])>]
183181
let ``E_StructLayoutSequentialNeg_Interface_fs`` compilation =
184182
compilation
185-
|> withLangVersionPreview
186183
|> verifyCompile
187184
|> shouldFail
188185
|> withDiagnostics [

tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/DelegateTypes/DelegateDefinition.fs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ a.Invoke()"""
6464
let f = fun (a: int voption) -> defaultValueArg a 100 |> printf "line: %d"
6565
let a = A f
6666
a.Invoke(5)"""
67-
|> withLangVersionPreview
6867
|> compileExeAndRun
6968
|> shouldSucceed
7069
|> verifyOutput "line: 5"

0 commit comments

Comments
 (0)