Skip to content

Commit 711de17

Browse files
authored
F#8 (#15793)
F# 8
1 parent 5628af4 commit 711de17

File tree

75 files changed

+384
-633
lines changed

Some content is hidden

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

75 files changed

+384
-633
lines changed

src/Compiler/Facilities/LanguageFeatures.fs

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ type LanguageVersion(versionText) =
8989
static let languageVersion50 = 5.0m
9090
static let languageVersion60 = 6.0m
9191
static let languageVersion70 = 7.0m
92+
static let languageVersion80 = 8.0m
9293
static let previewVersion = 9999m // Language version when preview specified
93-
static let defaultVersion = languageVersion70 // Language version when default specified
94+
static let defaultVersion = languageVersion80 // Language version when default specified
9495
static let latestVersion = defaultVersion // Language version when latest specified
95-
static let latestMajorVersion = languageVersion70 // Language version when latestmajor specified
96+
static let latestMajorVersion = languageVersion80 // Language version when latestmajor specified
9697

9798
static let validOptions = [| "preview"; "default"; "latest"; "latestmajor" |]
9899

@@ -104,6 +105,7 @@ type LanguageVersion(versionText) =
104105
languageVersion50
105106
languageVersion60
106107
languageVersion70
108+
languageVersion80
107109
|]
108110

109111
static let features =
@@ -154,33 +156,35 @@ type LanguageVersion(versionText) =
154156
LanguageFeature.InterfacesWithAbstractStaticMembers, languageVersion70
155157
LanguageFeature.SelfTypeConstraints, languageVersion70
156158

159+
// F# 8.0
160+
LanguageFeature.AccessorFunctionShorthand, languageVersion80
161+
LanguageFeature.MatchNotAllowedForUnionCaseWithNoData, languageVersion80
162+
LanguageFeature.CSharpExtensionAttributeNotRequired, languageVersion80
163+
LanguageFeature.ErrorForNonVirtualMembersOverrides, languageVersion80
164+
LanguageFeature.WarningWhenInliningMethodImplNoInlineMarkedFunction, languageVersion80
165+
LanguageFeature.EscapeDotnetFormattableStrings, languageVersion80
166+
LanguageFeature.ArithmeticInLiterals, languageVersion80
167+
LanguageFeature.ErrorReportingOnStaticClasses, languageVersion80
168+
LanguageFeature.TryWithInSeqExpression, languageVersion80
169+
LanguageFeature.WarningWhenCopyAndUpdateRecordChangesAllFields, languageVersion80
170+
LanguageFeature.StaticMembersInInterfaces, languageVersion80
171+
LanguageFeature.NonInlineLiteralsAsPrintfFormat, languageVersion80
172+
LanguageFeature.NestedCopyAndUpdate, languageVersion80
173+
LanguageFeature.ExtendedStringInterpolation, languageVersion80
174+
LanguageFeature.WarningWhenMultipleRecdTypeChoice, languageVersion80
175+
LanguageFeature.ImprovedImpliedArgumentNames, languageVersion80
176+
LanguageFeature.DiagnosticForObjInference, languageVersion80
177+
LanguageFeature.WarningWhenTailRecAttributeButNonTailRecUsage, languageVersion80
178+
LanguageFeature.StaticLetInRecordsDusEmptyTypes, languageVersion80
179+
LanguageFeature.StrictIndentation, languageVersion80
180+
LanguageFeature.ConstraintIntersectionOnFlexibleTypes, languageVersion80
181+
LanguageFeature.WhileBang, languageVersion80
182+
LanguageFeature.ExtendedFixedBindings, languageVersion80
183+
LanguageFeature.PreferStringGetPinnableReference, languageVersion80
184+
157185
// F# preview
158186
LanguageFeature.FromEndSlicing, previewVersion
159-
LanguageFeature.AccessorFunctionShorthand, previewVersion
160-
LanguageFeature.MatchNotAllowedForUnionCaseWithNoData, previewVersion
161-
LanguageFeature.CSharpExtensionAttributeNotRequired, previewVersion
162-
LanguageFeature.ErrorForNonVirtualMembersOverrides, previewVersion
163-
LanguageFeature.WarningWhenInliningMethodImplNoInlineMarkedFunction, previewVersion
164-
LanguageFeature.EscapeDotnetFormattableStrings, previewVersion
165-
LanguageFeature.ArithmeticInLiterals, previewVersion
166-
LanguageFeature.ErrorReportingOnStaticClasses, previewVersion
167-
LanguageFeature.TryWithInSeqExpression, previewVersion
168-
LanguageFeature.WarningWhenCopyAndUpdateRecordChangesAllFields, previewVersion
169-
LanguageFeature.StaticMembersInInterfaces, previewVersion
170-
LanguageFeature.NonInlineLiteralsAsPrintfFormat, previewVersion
171-
LanguageFeature.NestedCopyAndUpdate, previewVersion
172-
LanguageFeature.ExtendedStringInterpolation, previewVersion
173-
LanguageFeature.WarningWhenMultipleRecdTypeChoice, previewVersion
174-
LanguageFeature.ImprovedImpliedArgumentNames, previewVersion
175-
LanguageFeature.DiagnosticForObjInference, previewVersion
176-
LanguageFeature.WarningWhenTailRecAttributeButNonTailRecUsage, previewVersion
177-
LanguageFeature.StaticLetInRecordsDusEmptyTypes, previewVersion
178-
LanguageFeature.StrictIndentation, previewVersion
179-
LanguageFeature.ConstraintIntersectionOnFlexibleTypes, previewVersion
180187
LanguageFeature.UnmanagedConstraintCsharpInterop, previewVersion
181-
LanguageFeature.WhileBang, previewVersion
182-
LanguageFeature.ExtendedFixedBindings, previewVersion
183-
LanguageFeature.PreferStringGetPinnableReference, previewVersion
184188
]
185189

186190
static let defaultLanguageVersion = LanguageVersion("default")
@@ -200,6 +204,8 @@ type LanguageVersion(versionText) =
200204
| "6" -> languageVersion60
201205
| "7.0"
202206
| "7" -> languageVersion70
207+
| "8.0"
208+
| "8" -> languageVersion80
203209
| _ -> 0m
204210

205211
let specified = getVersionFromString versionText

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module TestCompilerWarningLevel =
1111
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"warn_level0.fs"|])>]
1212
let ``warn_level0_fs --warn:0`` compilation =
1313
compilation
14-
|> withLangVersionPreview
14+
|> withLangVersion80
1515
|> asExe
1616
|> withOptions ["--warn:0"]
1717
|> compileAndRun

tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/PermittedLocations.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ module AccessibilityAnnotations_PermittedLocations =
125125
|> shouldFail
126126
|> withDiagnostics [
127127
(Error 531, Line 11, Col 13, Line 11, Col 20, "Accessibility modifiers should come immediately prior to the identifier naming a construct")
128-
(Warning 58, Line 12, Col 23, Line 12, Col 26, "Possible incorrect indentation: this token is offside of context started at position (11:23). Try indenting this token further or using standard formatting conventions.")
128+
(Error 58, Line 12, Col 23, Line 12, Col 26, "Possible incorrect indentation: this token is offside of context started at position (11:23). Try indenting this token further or using standard formatting conventions.")
129129
(Error 531, Line 12, Col 13, Line 12, Col 19, "Accessibility modifiers should come immediately prior to the identifier naming a construct")
130-
(Warning 58, Line 13, Col 23, Line 13, Col 26, "Possible incorrect indentation: this token is offside of context started at position (12:23). Try indenting this token further or using standard formatting conventions.")
130+
(Error 58, Line 13, Col 23, Line 13, Col 26, "Possible incorrect indentation: this token is offside of context started at position (12:23). Try indenting this token further or using standard formatting conventions.")
131131
(Error 531, Line 13, Col 13, Line 13, Col 21, "Accessibility modifiers should come immediately prior to the identifier naming a construct")
132132
]
133133

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ module LetBindings_Basic =
7676
|> verifyCompile
7777
|> shouldFail
7878
|> withDiagnostics [
79-
(Warning 58, Line 10, Col 1, Line 10, Col 5, "Possible incorrect indentation: this token is offside of context started at position (8:1). Try indenting this token further or using standard formatting conventions.")
79+
(Error 58, Line 10, Col 1, Line 10, Col 5, "Possible incorrect indentation: this token is offside of context started at position (8:1). Try indenting this token further or using standard formatting conventions.")
8080
(Error 10, Line 10, Col 6, Line 10, Col 7, "Unexpected start of structured construct in expression")
8181
(Error 583, Line 9, Col 5, Line 9, Col 6, "Unmatched '('")
8282
(Error 10, Line 10, Col 16, Line 10, Col 17, "Unexpected symbol ')' in implementation file")

tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ let ``Should fail in F# 7 and lower`` (implFileName:string) =
2727

2828
[<Theory>]
2929
[<InlineData("7.0")>]
30+
[<InlineData("8.0")>]
3031
[<InlineData("preview")>]
3132
let ``Regression in Member val - not allowed without primary constructor`` (langVersion:string) =
3233
Fs """module Test
@@ -40,6 +41,7 @@ type Bad3 =
4041

4142
[<Theory>]
4243
[<InlineData("7.0")>]
44+
[<InlineData("8.0")>]
4345
[<InlineData("preview")>]
4446
let ``Regression - Type augmentation with abstract slot not allowed`` (langVersion:string) =
4547
Fs """module Test
@@ -53,6 +55,7 @@ type System.Random with
5355

5456
[<Theory>]
5557
[<InlineData("7.0")>]
58+
[<InlineData("8.0")>]
5659
[<InlineData("preview")>]
5760
let ``Regression - record with abstract slot not allowed`` (langVersion:string) =
5861
Fs """module Test
@@ -65,7 +68,7 @@ type myRecord2 = { field1: int; field2: string }
6568

6669
let verifyCompileAndRun compilation =
6770
compilation
68-
|> withLangVersionPreview
71+
|> withLangVersion80
6972
|> asExe
7073
|> compileAndRun
7174

@@ -95,7 +98,7 @@ init R 2
9598
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"LowercaseDuTest.fs"|])>]
9699
let ``Static let - lowercase DU`` compilation =
97100
compilation
98-
|> withLangVersionPreview
101+
|> withLangVersion80
99102
|> typecheck
100103
|> shouldSucceed
101104

@@ -127,7 +130,7 @@ let ``Static let in simple union`` compilation =
127130
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"PlainEnum.fs"|])>]
128131
let ``Support in plain enums - typecheck should fail`` compilation =
129132
compilation
130-
|> withLangVersionPreview
133+
|> withLangVersion80
131134
|> typecheck
132135
|> shouldFail
133136
|> withDiagnosticMessage "Enumerations cannot have members"
@@ -274,7 +277,7 @@ Creating cached val for Uri
274277
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"StaticLetInGenericRecordsILtest.fs"|])>]
275278
let ``Static let record - generics - IL test`` compilation =
276279
compilation
277-
|> withLangVersionPreview
280+
|> withLangVersion80
278281
|> compile
279282
|> verifyIL [""" .method private specialname rtspecialname static
280283
void .cctor() cil managed
@@ -389,7 +392,7 @@ type X =
389392
static do Console.WriteLine("from type")
390393
do Console.WriteLine("module after type")
391394
"""
392-
|> withLangVersionPreview
395+
|> withLangVersion80
393396
|> compile
394397
|> shouldSucceed
395398
|> verifyIL ["""
@@ -464,7 +467,7 @@ Console.Write(MyTypes.X.GetX)
464467

465468
FSharp types
466469
|> withAdditionalSourceFiles [SourceCodeFileKind.Create("program.fs", program)]
467-
|> withLangVersionPreview
470+
|> withLangVersion80
468471
|> compile
469472
|> shouldSucceed
470473
|> verifyIL ["""

tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/WarnForAutoOpenAttributeAlias.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type ByItsOwnNatureUnBottledAttribute = Microsoft.FSharp.Core.AutoOpenAttribute
1515
module Foo =
1616
let bar = 0
1717
"""
18-
|> withLangVersionPreview
18+
|> withLangVersion80
1919
|> compile
2020
|> shouldFail
2121
|> withDiagnostics [

tests/FSharp.Compiler.ComponentTests/Conformance/Constraints/Unmanaged.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ let _ = Test<MyDu<int,MyDu<int,string voption>>>()
418418
open CsLib
419419
let y = new CsharpStruct<struct(int*string)>(struct(1,"this is string"))
420420
""" |> withReferences [csLib]
421-
|> withLangVersionPreview
421+
|> withLangVersion80
422422

423423
app
424424
|> compile
@@ -449,7 +449,7 @@ printf "%s" (CsharpStruct<int>.Hi<MultiCaseUnion>())
449449
""" |> withReferences [csLib]
450450

451451
app
452-
|> withLangVersionPreview
452+
|> withLangVersion80
453453
|> asExe
454454
|> compile
455455
|> run

tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ module A
262262
|> typecheck
263263
|> shouldFail
264264
|> withResult {
265-
Error = Warning 58
265+
Error = Error 58
266266
Range = { StartLine = 4
267267
StartColumn = 5
268268
EndLine = 4

tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module RecordTypes =
1111
let verifyTypeCheckAsFsxAsLibrary compilation =
1212
compilation
1313
|> asLibrary
14+
|> withOptions ["--nowarn:3560"]
1415
|> typecheck
1516
|> shouldSucceed
1617

tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,9 @@ module UnionTypes =
595595
|> verifyCompile
596596
|> shouldFail
597597
|> withDiagnostics [
598-
(Warning 58, Line 9, Col 1, Line 9, Col 2, "Possible incorrect indentation: this token is offside of context started at position (8:19). Try indenting this token further or using standard formatting conventions.")
598+
(Error 58, Line 9, Col 1, Line 9, Col 2, "Possible incorrect indentation: this token is offside of context started at position (8:19). Try indenting this token further or using standard formatting conventions.")
599+
(Error 547, Line 8, Col 24, Line 8, Col 33, "A type definition requires one or more members or other declarations. If you intend to define an empty class, struct or interface, then use 'type ... = class end', 'interface end' or 'struct end'.")
600+
(Error 10, Line 9, Col 1, Line 9, Col 2, "Unexpected symbol '|' in implementation file")
599601
]
600602

601603
//SOURCE=W_UnionCaseProduction01.fsx SCFLAGS="-a --test:ErrorRanges" # W_UnionCaseProduction01.fsx
@@ -607,4 +609,3 @@ module UnionTypes =
607609
|> withDiagnostics [
608610
(Warning 42, Line 11, Col 12, Line 11, Col 24, "This construct is deprecated: it is only for use in the F# library")
609611
]
610-

0 commit comments

Comments
 (0)