Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit d4724c9

Browse files
KevinRansomnosami
authored andcommitted
Enable new language features for F# 5.0 (dotnet#9827)
* Update to fsharp5 * Update preview error messages * Update error messages * fix
1 parent 398527b commit d4724c9

File tree

23 files changed

+242
-78
lines changed

23 files changed

+242
-78
lines changed

src/fsharp/FSharp.Core/prim-types.fsi

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,97 +1332,78 @@ namespace Microsoft.FSharp.Core
13321332

13331333
/// <summary>A compiler intrinsic that implements dynamic invocations to the '-' operator.</summary>
13341334
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1335-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13361335
val SubtractionDynamic : x:'T1 -> y:'T2 -> 'U
13371336

13381337
/// <summary>A compiler intrinsic that implements dynamic invocations to the '/' operator.</summary>
13391338
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1340-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13411339
val DivisionDynamic : x:'T1 -> y:'T2 -> 'U
13421340

13431341
/// <summary>A compiler intrinsic that implements dynamic invocations to the unary '-' operator.</summary>
13441342
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1345-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13461343
val UnaryNegationDynamic : value:'T -> 'U
13471344

13481345
/// <summary>A compiler intrinsic that implements dynamic invocations to the '%' operator.</summary>
13491346
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1350-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13511347
val ModulusDynamic : x:'T1 -> y:'T2 -> 'U
13521348

13531349
/// <summary>A compiler intrinsic that implements dynamic invocations to the checked '-' operator.</summary>
13541350
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1355-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13561351
val CheckedSubtractionDynamic : x:'T1 -> y:'T2 -> 'U
13571352

13581353
/// <summary>A compiler intrinsic that implements dynamic invocations to the checked unary '-' operator.</summary>
13591354
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1360-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13611355
val CheckedUnaryNegationDynamic : value:'T -> 'U
13621356

13631357
/// <summary>A compiler intrinsic that implements dynamic invocations to the '&lt;&lt;&lt;' operator.</summary>
13641358
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1365-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13661359
val LeftShiftDynamic : value:'T1 -> shift:'T2 -> 'U
13671360

13681361
/// <summary>A compiler intrinsic that implements dynamic invocations to the '&gt;&gt;&gt;' operator.</summary>
13691362
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1370-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13711363
val RightShiftDynamic : value:'T1 -> shift:'T2 -> 'U
13721364

13731365
/// <summary>A compiler intrinsic that implements dynamic invocations to the '&amp;&amp;&amp;' operator.</summary>
13741366
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1375-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13761367
val BitwiseAndDynamic : x:'T1 -> y:'T2 -> 'U
13771368

13781369
/// <summary>A compiler intrinsic that implements dynamic invocations to the '|||' operator.</summary>
13791370
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1380-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13811371
val BitwiseOrDynamic : x:'T1 -> y:'T2 -> 'U
13821372

13831373
/// <summary>A compiler intrinsic that implements dynamic invocations related to the '^^^' operator.</summary>
13841374
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1385-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13861375
val ExclusiveOrDynamic : x:'T1 -> y:'T2 -> 'U
13871376

13881377
/// <summary>A compiler intrinsic that implements dynamic invocations related to the '~~~' operator.</summary>
13891378
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1390-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13911379
val LogicalNotDynamic : value:'T -> 'U
13921380

13931381
/// <summary>A compiler intrinsic that implements dynamic invocations related to conversion operators.</summary>
13941382
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1395-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
13961383
val ExplicitDynamic : value:'T -> 'U
13971384

13981385
/// <summary>A compiler intrinsic that implements dynamic invocations related to the '&lt;' operator.</summary>
13991386
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1400-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
14011387
val LessThanDynamic : x:'T1 -> y:'T2 -> 'U
14021388

14031389
/// <summary>A compiler intrinsic that implements dynamic invocations related to the '&gt;' operator.</summary>
14041390
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1405-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
14061391
val GreaterThanDynamic : x:'T1 -> y:'T2 -> 'U
14071392

14081393
/// <summary>A compiler intrinsic that implements dynamic invocations related to the '&lt;=' operator.</summary>
14091394
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1410-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
14111395
val LessThanOrEqualDynamic : x:'T1 -> y:'T2 -> 'U
14121396

14131397
/// <summary>A compiler intrinsic that implements dynamic invocations related to the '&gt;=' operator.</summary>
14141398
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1415-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
14161399
val GreaterThanOrEqualDynamic : x:'T1 -> y:'T2 -> 'U
14171400

14181401
/// <summary>A compiler intrinsic that implements dynamic invocations related to the '=' operator.</summary>
14191402
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1420-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
14211403
val EqualityDynamic : x:'T1 -> y:'T2 -> 'U
14221404

14231405
/// <summary>A compiler intrinsic that implements dynamic invocations related to the '=' operator.</summary>
14241406
[<CompilerMessage("This function is for use by dynamic invocations of F# code and should not be used directly", 1204, IsHidden=true)>]
1425-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
14261407
val InequalityDynamic : x:'T1 -> y:'T2 -> 'U
14271408

14281409
/// <summary>A compiler intrinsic that implements dynamic invocations for the DivideByInt primitive.</summary>

src/fsharp/FSharp.Core/quotations.fsi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ type Expr =
130130
/// <param name="arguments">The list of arguments to the method.</param>
131131
///
132132
/// <returns>The resulting expression.</returns>
133-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
134133
static member CallWithWitnesses: methodInfo: MethodInfo * methodInfoWithWitnesses: MethodInfo * witnesses: Expr list * arguments: Expr list -> Expr
135134

136135
/// <summary>Builds an expression that represents a call to an instance method associated with an object</summary>
@@ -142,7 +141,6 @@ type Expr =
142141
/// <param name="arguments">The list of arguments to the method.</param>
143142
///
144143
/// <returns>The resulting expression.</returns>
145-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
146144
static member CallWithWitnesses: obj:Expr * methodInfo:MethodInfo * methodInfoWithWitnesses: MethodInfo * witnesses: Expr list * arguments:Expr list -> Expr
147145

148146
/// <summary>Builds an expression that represents the coercion of an expression to a type</summary>
@@ -607,7 +605,6 @@ module Patterns =
607605
///
608606
/// <returns>When successful, the pattern binds the object, method, witness-argument and argument sub-expressions of the input expression</returns>
609607
[<CompiledName("CallWithWitnessesPattern")>]
610-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
611608
val (|CallWithWitnesses|_|) : input:Expr -> (Expr option * MethodInfo * MethodInfo * Expr list * Expr list) option
612609

613610
/// <summary>An active pattern to recognize expressions that represent coercions from one type to another</summary>

src/fsharp/LanguageFeatures.fs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type LanguageFeature =
2323
| RelaxWhitespace
2424
| NameOf
2525
| ImplicitYield
26-
| OpenTypeDeclaration
26+
| OpenStaticClasses
2727
| DotlessFloat32Literal
2828
| PackageManagement
2929
| FromEndSlicing
@@ -34,7 +34,6 @@ type LanguageFeature =
3434
| WitnessPassing
3535
| InterfacesWithMultipleGenericInstantiation
3636
| StringInterpolation
37-
| OverloadsForCustomOperations
3837

3938
/// LanguageVersion management
4039
type LanguageVersion (specifiedVersionAsString) =
@@ -65,16 +64,15 @@ type LanguageVersion (specifiedVersionAsString) =
6564
LanguageFeature.AndBang, languageVersion50
6665
LanguageFeature.NullableOptionalInterop, languageVersion50
6766
LanguageFeature.DefaultInterfaceMemberConsumption, languageVersion50
67+
LanguageFeature.OpenStaticClasses, languageVersion50
68+
LanguageFeature.PackageManagement, languageVersion50
69+
LanguageFeature.WitnessPassing, languageVersion50
70+
LanguageFeature.InterfacesWithMultipleGenericInstantiation, languageVersion50
71+
LanguageFeature.NameOf, languageVersion50
6872

6973
// F# preview
7074
LanguageFeature.FromEndSlicing, previewVersion
71-
LanguageFeature.OpenTypeDeclaration, previewVersion
72-
LanguageFeature.PackageManagement, previewVersion
73-
LanguageFeature.WitnessPassing, previewVersion
74-
LanguageFeature.InterfacesWithMultipleGenericInstantiation, previewVersion
75-
LanguageFeature.NameOf, previewVersion
7675
LanguageFeature.StringInterpolation, previewVersion
77-
LanguageFeature.OverloadsForCustomOperations, previewVersion
7876
]
7977

8078
let specified =
@@ -135,7 +133,7 @@ type LanguageVersion (specifiedVersionAsString) =
135133
| LanguageFeature.RelaxWhitespace -> FSComp.SR.featureRelaxWhitespace()
136134
| LanguageFeature.NameOf -> FSComp.SR.featureNameOf()
137135
| LanguageFeature.ImplicitYield -> FSComp.SR.featureImplicitYield()
138-
| LanguageFeature.OpenTypeDeclaration -> FSComp.SR.featureOpenTypeDeclaration()
136+
| LanguageFeature.OpenStaticClasses -> FSComp.SR.featureOpenStaticClasses()
139137
| LanguageFeature.DotlessFloat32Literal -> FSComp.SR.featureDotlessFloat32Literal()
140138
| LanguageFeature.PackageManagement -> FSComp.SR.featurePackageManagement()
141139
| LanguageFeature.FromEndSlicing -> FSComp.SR.featureFromEndSlicing()
@@ -146,7 +144,6 @@ type LanguageVersion (specifiedVersionAsString) =
146144
| LanguageFeature.WitnessPassing -> FSComp.SR.featureWitnessPassing()
147145
| LanguageFeature.InterfacesWithMultipleGenericInstantiation -> FSComp.SR.featureInterfacesWithMultipleGenericInstantiation()
148146
| LanguageFeature.StringInterpolation -> FSComp.SR.featureStringInterpolation()
149-
| LanguageFeature.OverloadsForCustomOperations -> FSComp.SR.featureOverloadsForCustomOperations()
150147

151148
/// Get a version string associated with the given feature.
152149
member _.GetFeatureVersionString feature =

tests/FSharp.Compiler.ComponentTests/ErrorMessages/InvalidNumericLiteralTests.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ module ``Numeric Literals`` =
6060
[<Fact>]
6161
let ``1N is invalid numeric literal in FSI``() =
6262
if Utils.runningOnMono then ()
63-
else
64-
CompilerAssert.RunScriptWithOptions [| "--langversion:preview"; "--test:ErrorRanges" |]
63+
else
64+
CompilerAssert.RunScriptWithOptions [| "--langversion:5.0"; "--test:ErrorRanges" |]
6565
"""
6666
let x = 1N
6767
"""

tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ let z : unit =
3636
failwithf "did not expect expression for 'z': %A" e
3737
"""
3838
|> asExe
39-
|> withLangVersionPreview
39+
|> withOptions ["--langversion:5.0"]
4040
|> compileAndRun
4141
|> shouldSucceed

tests/fsharp/Compiler/Language/InterfaceTests.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ assertion (fun (x:float) -> x * 3.0) (fun v ->
180180
``Many Instantiations of the same interface - Asserts``,
181181
Fs, Library,
182182
options = [|
183-
"--langversion:preview";
183+
"--langversion:5.0";
184184
#if !NETSTANDARD
185185
|])
186186
#else
@@ -203,7 +203,7 @@ assertion (fun (x:float) -> x * 3.0) (fun v ->
203203
|]
204204
``Many Instantiations of the same interface``
205205
[|
206-
(FSharpErrorSeverity.Error, 3350, (24, 6, 24, 20), "Feature 'interfaces with multiple generic instantiation' is not available in F# 4.7. Please use language version 'preview' or greater.")
206+
(FSharpErrorSeverity.Error, 3350, (24, 6, 24, 20), "Feature 'interfaces with multiple generic instantiation' is not available in F# 4.7. Please use language version 5.0 or greater.")
207207
|]
208208

209209
[<Test>]

0 commit comments

Comments
 (0)