From dfed106c8eeea8f9ac0b3d98fedd008a88cd02da Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 9 Feb 2024 13:07:00 +0100 Subject: [PATCH 1/9] failing test --- .../Language/NullableReferenceTypesTests.fs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs index ff50d481185..cb1fe92b6c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs @@ -11,6 +11,23 @@ let typeCheckWithStrictNullness cu = |> withOptions ["--warnaserror+"] |> typecheck +[] +let ``Boolean to string is not nullable`` () = + FSharp """module MyLibrary +let onlyWantNotNullString(x:string) = () + +let processBool (b:bool) : (string|null) = + let asString = b.ToString() + onlyWantNotNullString asString + onlyWantNotNullString (true.ToString()) + onlyWantNotNullString (false.ToString()) + + asString +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + [] let ``Printing a nullable string should pass`` () = FSharp """module MyLibrary From 9257fb87c47d966c85d498720501aed231642e89 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 14 Feb 2024 17:59:37 +0100 Subject: [PATCH 2/9] Fix bug with members on supertype, solve overriden annotation --- src/Compiler/Checking/CheckExpressions.fs | 2 +- src/Compiler/Checking/TypeHierarchy.fs | 3 +- src/Compiler/Checking/infos.fs | 3 +- src/Compiler/TypedTree/TypedTreeBasics.fs | 6 +++- src/Compiler/TypedTree/TypedTreeOps.fs | 13 ++++++++ src/Compiler/TypedTree/TypedTreeOps.fsi | 2 ++ .../Language/NullableCsharpImportTests.fs | 17 +++++++++- .../Language/NullableReferenceTypesTests.fs | 32 ++++++++++++++++--- 8 files changed, 68 insertions(+), 10 deletions(-) diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 2f0306f95c5..a2efdc5ba5b 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -9229,7 +9229,7 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela // 'base' calls use a different resolution strategy when finding methods. let findFlag = let baseCall = IsBaseCall objArgs - (if baseCall then PreferOverrides else IgnoreOverrides) + (if baseCall then PreferOverrides else PreferOverrides) // Canonicalize inference problem prior to '.' lookup on variable types if isTyparTy g objExprTy then diff --git a/src/Compiler/Checking/TypeHierarchy.fs b/src/Compiler/Checking/TypeHierarchy.fs index 69c1924f3d7..a19d3c4d3b5 100644 --- a/src/Compiler/Checking/TypeHierarchy.fs +++ b/src/Compiler/Checking/TypeHierarchy.fs @@ -56,8 +56,7 @@ let GetSuperTypeOfType g amap m ty = let tinst = argsOfAppTy g ty match tdef.Extends with | None -> None - // 'inherit' cannot refer to a nullable type - | Some ilTy -> + | Some ilTy -> // 'inherit' can refer to a type which has nullable type arguments (e.g. List) let typeAttrs = AttributesFromIL(tdef.MetadataIndex,tdef.CustomAttrsStored) let nullness = {DirectAttributes = typeAttrs; Fallback = FromClass typeAttrs} Some (RescopeAndImportILType scoref amap m tinst nullness ilTy) diff --git a/src/Compiler/Checking/infos.fs b/src/Compiler/Checking/infos.fs index de2348eb7be..74caea62dda 100644 --- a/src/Compiler/Checking/infos.fs +++ b/src/Compiler/Checking/infos.fs @@ -2440,7 +2440,8 @@ let MethInfosEquivByNameAndSig erasureFlag ignoreFinal g amap m minfo minfo2 = let (CompiledSig(_, retTy, formalMethTypars, _)) = CompiledSigOfMeth g amap m minfo let (CompiledSig(_, retTy2, formalMethTypars2, _)) = CompiledSigOfMeth g amap m minfo2 match retTy, retTy2 with - | None, None -> true + | None, None -> true + // putting nullnessSensitivetypeAEquivAux here is right or not? | Some retTy, Some retTy2 -> typeAEquivAux erasureFlag g (TypeEquivEnv.FromEquivTypars formalMethTypars formalMethTypars2) retTy retTy2 | _ -> false diff --git a/src/Compiler/TypedTree/TypedTreeBasics.fs b/src/Compiler/TypedTree/TypedTreeBasics.fs index 3a25b6ba4e1..f5acb1477e4 100644 --- a/src/Compiler/TypedTree/TypedTreeBasics.fs +++ b/src/Compiler/TypedTree/TypedTreeBasics.fs @@ -245,7 +245,11 @@ let rec stripUnitEqnsAux canShortcut unt = let combineNullness (nullnessOrig: Nullness) (nullnessNew: Nullness) = match nullnessOrig.Evaluate() with | NullnessInfo.WithoutNull -> nullnessNew - | NullnessInfo.AmbivalentToNull -> nullnessOrig + | NullnessInfo.AmbivalentToNull -> + match nullnessNew.Evaluate() with + | NullnessInfo.WithoutNull -> nullnessOrig + | NullnessInfo.AmbivalentToNull -> nullnessOrig + | NullnessInfo.WithNull -> nullnessNew | NullnessInfo.WithNull -> match nullnessNew.Evaluate() with | NullnessInfo.WithoutNull -> nullnessOrig diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 803c83f99da..9244e173f4e 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -1082,6 +1082,18 @@ and typeAEquivAux erasureFlag g aenv ty1 ty2 = | _ -> false +and nullnessSensitivetypeAEquivAux erasureFlag g aenv ty1 ty2 = + let ty1 = stripTyEqnsWrtErasure erasureFlag g ty1 + let ty2 = stripTyEqnsWrtErasure erasureFlag g ty2 + match ty1, ty2 with + | TType_var (_,n1), TType_var (_,n2) + | TType_app (_,_,n1), TType_app (_,_,n2) + | TType_fun (_,_,n1), TType_fun (_,_,n2) -> + n1 === n2 + | _ -> true + + && typeAEquivAux erasureFlag g aenv ty1 ty2 + and anonInfoEquiv (anonInfo1: AnonRecdTypeInfo) (anonInfo2: AnonRecdTypeInfo) = ccuEq anonInfo1.Assembly anonInfo2.Assembly && structnessAEquiv anonInfo1.TupInfo anonInfo2.TupInfo && @@ -9009,6 +9021,7 @@ let intrinsicNullnessOfTyconRef g (tcref: TyconRef) = let nullnessOfTy g ty = ty + // stripping is where the evil is for abbrevs |> stripTyEqns g |> function | TType_app(tcref, _, nullness) -> diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index 9821e6ace40..fcae1f8d4c2 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -896,6 +896,8 @@ val typarsAEquiv: TcGlobals -> TypeEquivEnv -> Typars -> Typars -> bool val typeAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TType -> TType -> bool +val nullnessSensitivetypeAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TType -> TType -> bool + val typeAEquiv: TcGlobals -> TypeEquivEnv -> TType -> TType -> bool val returnTypesAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TType option -> TType option -> bool diff --git a/tests/FSharp.Compiler.ComponentTests/Language/NullableCsharpImportTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/NullableCsharpImportTests.fs index 2f646acb23e..b4d03dea5b4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/NullableCsharpImportTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/NullableCsharpImportTests.fs @@ -12,7 +12,7 @@ let typeCheckWithStrictNullness cu = |> withOptions ["--warnaserror+"] |> compile -[] +[] let ``Passing null to IlGenerator BeginCatchBlock is fine`` () = FSharp """module MyLibrary open System.Reflection.Emit @@ -34,6 +34,20 @@ let doSomethingAboutIt (ilg:ILGenerator) = |> typeCheckWithStrictNullness |> shouldSucceed +[] +let ``Nullable directory info show warn on prop access`` () = + FSharp """module MyLibrary +open System.IO +open System + +let d : DirectoryInfo | null = null +let s : string = d.Name // should warn here!! +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics [Error 3261, Line 6, Col 18, Line 6, Col 24, "Nullness warning: The types 'FileSystemInfo' and 'FileSystemInfo | null' do not have compatible nullability."] + [] let ``Consumption of netstandard2 BCL api which is not annotated`` () = FSharp """module MyLibrary @@ -54,6 +68,7 @@ let FromAssemblyName (aname: AssemblyName) = | NonNull bytes -> Some(PublicKeyToken bytes) | NonNull bytes -> Some(PublicKey bytes)""" |> asLibrary + |> asNetStandard20 |> typeCheckWithStrictNullness |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs index cb1fe92b6c5..a5d5e31696c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs @@ -11,17 +11,41 @@ let typeCheckWithStrictNullness cu = |> withOptions ["--warnaserror+"] |> typecheck + [] -let ``Boolean to string is not nullable`` () = +let ``Cannot pass possibly null value to a strict function``() = + FSharp """ +let strictFunc(x:string) = () +let nonStrictFunc(x:string | null) = strictFunc(x) + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics [ + Error 3261, Line 3, Col 49, Line 3, Col 50, "Nullness warning: The types 'string' and 'string | null' do not have equivalent nullability."] + +[] +let ``Boolean literal to string is not nullable`` () = FSharp """module MyLibrary let onlyWantNotNullString(x:string) = () -let processBool (b:bool) : (string|null) = - let asString = b.ToString() - onlyWantNotNullString asString +let processBool () : string = onlyWantNotNullString (true.ToString()) onlyWantNotNullString (false.ToString()) + true.ToString() +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Boolean to string is not nullable`` () = + FSharp """module MyLibrary +let onlyWantNotNullString(x:string) = () + +let processBool (b:bool) : string = + let asString = b.ToString() asString """ |> asLibrary From 4302966ec203016ace68acbffe9c6bed22dce46d Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 15 Feb 2024 13:58:31 +0100 Subject: [PATCH 3/9] override search strategy synced with checknulls+, tests adjustments --- src/Compiler/Checking/CheckExpressions.fs | 11 +- .../MethodsAndProperties.fs | 9 +- .../FloatsAndDoubles.fs.il.debug.bsl | 134 ++++++------------ .../FloatsAndDoubles.fs.il.release.bsl | 134 ++++++------------ .../TestFunction22h.fs.il.net472.bsl | 14 +- .../TestFunction22h.fs.il.netcore.bsl | 14 +- .../EmittedIL/TupleElimination.fs | 23 +-- .../Language/NullableCsharpImportTests.fs | 2 +- .../Language/NullableReferenceTypesTests.fs | 4 +- 9 files changed, 116 insertions(+), 229 deletions(-) diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index b9f4f9e5f23..403711a2551 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -9226,10 +9226,13 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela let objArgs = [objExpr] - // 'base' calls use a different resolution strategy when finding methods. - let findFlag = - let baseCall = IsBaseCall objArgs - (if baseCall then PreferOverrides else PreferOverrides) + let findFlag = + // 'base' calls use a different resolution strategy when finding methods + // nullness checks need the overrides, since those can change nullable semantics (e.g. ToString from BCL) + if (g.checkNullness && g.langFeatureNullness) || IsBaseCall objArgs then + PreferOverrides + else + IgnoreOverrides // Canonicalize inference problem prior to '.' lookup on variable types if isTyparTy g objExprTy then diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs index a71f63cbfb9..69c73ed9757 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs @@ -14,16 +14,15 @@ module MemberDefinitions_MethodsAndProperties = |> withOptions ["--nowarn:988"] |> compile - let verifyCompileAndRun compilation = - compilation - |> asExe - |> withOptions ["--nowarn:988"] - |> compileAndRun + let verifyCompileAndRun = verifyCompile >> run + // SOURCE=AbstractProperties01.fs # AbstractProperties01.fs [] let ``AbstractProperties01_fs`` compilation = compilation + |> withLangVersionPreview + |> withCheckNulls |> verifyCompileAndRun |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl index 5c36c9f6cf0..2835187fdf5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -53,8 +43,7 @@ { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) .field assembly float64 F@ - .method public hidebysig specialname - instance float64 get_F() cil managed + .method public hidebysig specialname instance float64 get_F() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -66,8 +55,7 @@ IL_0006: ret } - .method public hidebysig virtual final - instance int32 CompareTo(valuetype floatsanddoubles/Float obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(valuetype floatsanddoubles/Float obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -129,8 +117,7 @@ IL_004b: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -210,8 +197,7 @@ IL_0050: ret } - .method public hidebysig virtual final - instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -239,8 +225,7 @@ IL_001e: ret } - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed + .method public hidebysig virtual final instance int32 GetHashCode() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -297,8 +282,7 @@ IL_0034: ret } - .method public specialname rtspecialname - instance void .ctor(float64 f) cil managed + .method public specialname rtspecialname instance void .ctor(float64 f) cil managed { .maxstack 8 @@ -308,8 +292,7 @@ IL_0007: ret } - .method public hidebysig virtual final - instance bool Equals(valuetype floatsanddoubles/Float obj) cil managed + .method public hidebysig virtual final instance bool Equals(valuetype floatsanddoubles/Float obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -354,8 +337,7 @@ IL_002e: ret } - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed + .method public hidebysig virtual final instance bool Equals(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -400,8 +382,7 @@ { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) .field assembly float64 D@ - .method public hidebysig specialname - instance float64 get_D() cil managed + .method public hidebysig specialname instance float64 get_D() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -413,8 +394,7 @@ IL_0006: ret } - .method public hidebysig virtual final - instance int32 CompareTo(valuetype floatsanddoubles/Double obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(valuetype floatsanddoubles/Double obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -476,8 +456,7 @@ IL_004b: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -557,8 +536,7 @@ IL_0050: ret } - .method public hidebysig virtual final - instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -586,8 +564,7 @@ IL_001e: ret } - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed + .method public hidebysig virtual final instance int32 GetHashCode() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -644,8 +621,7 @@ IL_0034: ret } - .method public specialname rtspecialname - instance void .ctor(float64 d) cil managed + .method public specialname rtspecialname instance void .ctor(float64 d) cil managed { .maxstack 8 @@ -655,8 +631,7 @@ IL_0007: ret } - .method public hidebysig virtual final - instance bool Equals(valuetype floatsanddoubles/Double obj) cil managed + .method public hidebysig virtual final instance bool Equals(valuetype floatsanddoubles/Double obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -701,8 +676,7 @@ IL_002e: ret } - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed + .method public hidebysig virtual final instance bool Equals(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -744,8 +718,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -759,8 +732,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit - Invoke(float64 arg50) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit Invoke(float64 arg50) cil managed { .maxstack 8 @@ -781,8 +753,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -796,8 +767,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - Invoke(float64 arg40) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Invoke(float64 arg40) cil managed { .maxstack 6 @@ -821,8 +791,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -836,8 +805,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> - Invoke(bool arg30) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> Invoke(bool arg30) cil managed { .maxstack 6 @@ -861,8 +829,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -876,8 +843,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> - Invoke(string arg20) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> Invoke(string arg20) cil managed { .maxstack 6 @@ -901,8 +867,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -916,8 +881,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> - Invoke(string arg10) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> Invoke(string arg10) cil managed { .maxstack 6 @@ -941,8 +905,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -956,8 +919,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit - Invoke(float64 arg50) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit Invoke(float64 arg50) cil managed { .maxstack 8 @@ -978,8 +940,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -993,8 +954,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - Invoke(float64 arg40) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Invoke(float64 arg40) cil managed { .maxstack 6 @@ -1018,8 +978,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1033,8 +992,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> - Invoke(bool arg30) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> Invoke(bool arg30) cil managed { .maxstack 6 @@ -1058,8 +1016,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1073,8 +1030,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> - Invoke(string arg20) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> Invoke(string arg20) cil managed { .maxstack 6 @@ -1098,8 +1054,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1113,8 +1068,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> - Invoke(string arg10) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> Invoke(string arg10) cil managed { .maxstack 6 @@ -1131,8 +1085,7 @@ } - .method public specialname static valuetype floatsanddoubles/Float[] - get_floats() cil managed + .method public specialname static valuetype floatsanddoubles/Float[] get_floats() cil managed { .maxstack 8 @@ -1140,8 +1093,7 @@ IL_0005: ret } - .method public specialname static valuetype floatsanddoubles/Double[] - get_doubles() cil managed + .method public specialname static valuetype floatsanddoubles/Double[] get_doubles() cil managed { .maxstack 8 @@ -1149,8 +1101,7 @@ IL_0005: ret } - .method public specialname static string[] - get_names() cil managed + .method public specialname static string[] get_names() cil managed { .maxstack 8 @@ -1202,7 +1153,7 @@ IL_0054: ldelem floatsanddoubles/Double IL_0059: box floatsanddoubles/Double IL_005e: constrained. floatsanddoubles/Double - IL_0064: callvirt instance bool [runtime]System.Object::Equals(object) + IL_0064: callvirt instance bool [runtime]System.ValueType::Equals(object) IL_0069: call valuetype floatsanddoubles/Double[] floatsanddoubles::get_doubles() IL_006e: ldloc.0 IL_006f: ldelema floatsanddoubles/Double @@ -1270,7 +1221,7 @@ IL_0111: ldelem floatsanddoubles/Float IL_0116: box floatsanddoubles/Float IL_011b: constrained. floatsanddoubles/Float - IL_0121: callvirt instance bool [runtime]System.Object::Equals(object) + IL_0121: callvirt instance bool [runtime]System.ValueType::Equals(object) IL_0126: call valuetype floatsanddoubles/Float[] floatsanddoubles::get_floats() IL_012b: ldloc.3 IL_012c: ldelema floatsanddoubles/Float @@ -1346,8 +1297,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 6 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl index 811513b8dd7..4bf5f1ec067 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -53,8 +43,7 @@ { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) .field assembly float64 F@ - .method public hidebysig specialname - instance float64 get_F() cil managed + .method public hidebysig specialname instance float64 get_F() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -66,8 +55,7 @@ IL_0006: ret } - .method public hidebysig virtual final - instance int32 CompareTo(valuetype floatsanddoubles/Float obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(valuetype floatsanddoubles/Float obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -120,8 +108,7 @@ IL_0039: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -192,8 +179,7 @@ IL_0041: ret } - .method public hidebysig virtual final - instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -221,8 +207,7 @@ IL_001e: ret } - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed + .method public hidebysig virtual final instance int32 GetHashCode() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -270,8 +255,7 @@ IL_0029: ret } - .method public specialname rtspecialname - instance void .ctor(float64 f) cil managed + .method public specialname rtspecialname instance void .ctor(float64 f) cil managed { .maxstack 8 @@ -281,8 +265,7 @@ IL_0007: ret } - .method public hidebysig virtual final - instance bool Equals(valuetype floatsanddoubles/Float obj) cil managed + .method public hidebysig virtual final instance bool Equals(valuetype floatsanddoubles/Float obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -321,8 +304,7 @@ IL_0026: ret } - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed + .method public hidebysig virtual final instance bool Equals(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -367,8 +349,7 @@ { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) .field assembly float64 D@ - .method public hidebysig specialname - instance float64 get_D() cil managed + .method public hidebysig specialname instance float64 get_D() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -380,8 +361,7 @@ IL_0006: ret } - .method public hidebysig virtual final - instance int32 CompareTo(valuetype floatsanddoubles/Double obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(valuetype floatsanddoubles/Double obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -434,8 +414,7 @@ IL_0039: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -506,8 +485,7 @@ IL_0041: ret } - .method public hidebysig virtual final - instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -535,8 +513,7 @@ IL_001e: ret } - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed + .method public hidebysig virtual final instance int32 GetHashCode() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -584,8 +561,7 @@ IL_0029: ret } - .method public specialname rtspecialname - instance void .ctor(float64 d) cil managed + .method public specialname rtspecialname instance void .ctor(float64 d) cil managed { .maxstack 8 @@ -595,8 +571,7 @@ IL_0007: ret } - .method public hidebysig virtual final - instance bool Equals(valuetype floatsanddoubles/Double obj) cil managed + .method public hidebysig virtual final instance bool Equals(valuetype floatsanddoubles/Double obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -635,8 +610,7 @@ IL_0026: ret } - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed + .method public hidebysig virtual final instance bool Equals(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -678,8 +652,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -693,8 +666,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit - Invoke(float64 arg50) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit Invoke(float64 arg50) cil managed { .maxstack 8 @@ -715,8 +687,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -730,8 +701,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - Invoke(float64 arg40) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Invoke(float64 arg40) cil managed { .maxstack 6 @@ -755,8 +725,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -770,8 +739,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> - Invoke(bool arg30) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> Invoke(bool arg30) cil managed { .maxstack 6 @@ -795,8 +763,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -810,8 +777,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> - Invoke(string arg20) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> Invoke(string arg20) cil managed { .maxstack 6 @@ -835,8 +801,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -850,8 +815,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> - Invoke(string arg10) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> Invoke(string arg10) cil managed { .maxstack 6 @@ -875,8 +839,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -890,8 +853,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit - Invoke(float64 arg50) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit Invoke(float64 arg50) cil managed { .maxstack 8 @@ -912,8 +874,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -927,8 +888,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - Invoke(float64 arg40) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Invoke(float64 arg40) cil managed { .maxstack 6 @@ -952,8 +912,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -967,8 +926,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> - Invoke(bool arg30) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> Invoke(bool arg30) cil managed { .maxstack 6 @@ -992,8 +950,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1007,8 +964,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> - Invoke(string arg20) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> Invoke(string arg20) cil managed { .maxstack 6 @@ -1032,8 +988,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1047,8 +1002,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> - Invoke(string arg10) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> Invoke(string arg10) cil managed { .maxstack 6 @@ -1065,8 +1019,7 @@ } - .method public specialname static valuetype floatsanddoubles/Float[] - get_floats() cil managed + .method public specialname static valuetype floatsanddoubles/Float[] get_floats() cil managed { .maxstack 8 @@ -1074,8 +1027,7 @@ IL_0005: ret } - .method public specialname static valuetype floatsanddoubles/Double[] - get_doubles() cil managed + .method public specialname static valuetype floatsanddoubles/Double[] get_doubles() cil managed { .maxstack 8 @@ -1083,8 +1035,7 @@ IL_0005: ret } - .method public specialname static string[] - get_names() cil managed + .method public specialname static string[] get_names() cil managed { .maxstack 8 @@ -1136,7 +1087,7 @@ IL_0054: ldelem floatsanddoubles/Double IL_0059: box floatsanddoubles/Double IL_005e: constrained. floatsanddoubles/Double - IL_0064: callvirt instance bool [runtime]System.Object::Equals(object) + IL_0064: callvirt instance bool [runtime]System.ValueType::Equals(object) IL_0069: call valuetype floatsanddoubles/Double[] floatsanddoubles::get_doubles() IL_006e: ldloc.0 IL_006f: ldelema floatsanddoubles/Double @@ -1204,7 +1155,7 @@ IL_0111: ldelem floatsanddoubles/Float IL_0116: box floatsanddoubles/Float IL_011b: constrained. floatsanddoubles/Float - IL_0121: callvirt instance bool [runtime]System.Object::Equals(object) + IL_0121: callvirt instance bool [runtime]System.ValueType::Equals(object) IL_0126: call valuetype floatsanddoubles/Float[] floatsanddoubles::get_floats() IL_012b: ldloc.3 IL_012c: ldelema floatsanddoubles/Float @@ -1280,8 +1231,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 6 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.net472.bsl index c8c4283bcf3..39b8c638c66 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.net472.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -170,7 +160,7 @@ IL_0034: ldloc.s V_4 IL_0036: stloc.s V_5 IL_0038: ldloc.s V_5 - IL_003a: callvirt instance string [runtime]System.Exception::get_Message() + IL_003a: callvirt instance string [runtime]System.ArgumentException::get_Message() IL_003f: call void [runtime]System.Console::WriteLine(string) IL_0044: leave.s IL_0051 @@ -292,7 +282,7 @@ IL_002b: unbox.any [runtime]System.ArgumentException IL_0030: stloc.3 IL_0031: ldloc.3 - IL_0032: callvirt instance string [runtime]System.Exception::get_Message() + IL_0032: callvirt instance string [runtime]System.ArgumentException::get_Message() IL_0037: call void [runtime]System.Console::WriteLine(string) IL_003c: leave.s IL_005f diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.netcore.bsl index 090680b761b..059d618d7a5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.netcore.bsl @@ -17,16 +17,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -171,7 +161,7 @@ IL_0034: ldloc.s V_4 IL_0036: stloc.s V_5 IL_0038: ldloc.s V_5 - IL_003a: callvirt instance string [runtime]System.Exception::get_Message() + IL_003a: callvirt instance string [runtime]System.ArgumentException::get_Message() IL_003f: call void [runtime]System.Console::WriteLine(string) IL_0044: leave.s IL_0051 @@ -293,7 +283,7 @@ IL_002b: unbox.any [runtime]System.ArgumentException IL_0030: stloc.3 IL_0031: ldloc.3 - IL_0032: callvirt instance string [runtime]System.Exception::get_Message() + IL_0032: callvirt instance string [runtime]System.ArgumentException::get_Message() IL_0037: call void [runtime]System.Console::WriteLine(string) IL_003c: leave.s IL_005f diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs index 5c77f15f552..d14b6d2240c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs @@ -7,6 +7,9 @@ open FSharp.Test.Compiler module ``TupleElimination`` = + + let compile cu = cu |> withCheckNulls |> withLangVersionPreview |> compile + [] let ``Sequence expressions with potential side effects do not prevent tuple elimination``() = FSharp """ @@ -90,12 +93,12 @@ public static Tuple v() valuetype [runtime]System.DateTime V_1, int32 V_2) IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() + IL_0005: callvirt instance string [runtime]System.String::ToString() IL_000a: stloc.0 IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() IL_0010: stloc.1 IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() + IL_0016: callvirt instance string [runtime]System.String::ToString() IL_001b: stloc.0 IL_001c: call int32 TupleElimination::f() IL_0021: stloc.2 @@ -133,12 +136,12 @@ public static int w() int32 V_2, class [runtime]System.Tuple`2 V_3) IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() + IL_0005: callvirt instance string [runtime]System.String::ToString() IL_000a: stloc.0 IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() IL_0010: stloc.1 IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() + IL_0016: callvirt instance string [runtime]System.String::ToString() IL_001b: stloc.0 IL_001c: call int32 TupleElimination::f() IL_0021: stloc.2 @@ -179,12 +182,12 @@ public static int x() valuetype [runtime]System.DateTime V_1, int32 V_2) IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() + IL_0005: callvirt instance string [runtime]System.String::ToString() IL_000a: stloc.0 IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() IL_0010: stloc.1 IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() + IL_0016: callvirt instance string [runtime]System.String::ToString() IL_001b: stloc.0 IL_001c: call int32 TupleElimination::f() IL_0021: stloc.2 @@ -347,12 +350,12 @@ public static int z() int32 V_3, int32 V_4) IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() + IL_0005: callvirt instance string [runtime]System.String::ToString() IL_000a: stloc.1 IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() IL_0010: stloc.2 IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() + IL_0016: callvirt instance string [runtime]System.String::ToString() IL_001b: stloc.1 IL_001c: ldc.i4.2 IL_001d: call int32 TupleElimination::f() @@ -574,7 +577,7 @@ public static int y() IL_000b: brfalse.s IL_0027 IL_000d: ldstr "" - IL_0012: callvirt instance string [runtime]System.Object::ToString() + IL_0012: callvirt instance string [runtime]System.String::ToString() IL_0017: stloc.3 IL_0018: ldc.i4.1 IL_0019: stloc.0 @@ -621,7 +624,7 @@ public static int y() IL_005a: br.s IL_0095 IL_005c: ldstr "" - IL_0061: callvirt instance string [runtime]System.Object::ToString() + IL_0061: callvirt instance string [runtime]System.String::ToString() IL_0066: stloc.3 IL_0067: ldc.i4.6 IL_0068: stloc.0 diff --git a/tests/FSharp.Compiler.ComponentTests/Language/NullableCsharpImportTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/NullableCsharpImportTests.fs index b4d03dea5b4..65e3a5c85bb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/NullableCsharpImportTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/NullableCsharpImportTests.fs @@ -46,7 +46,7 @@ let s : string = d.Name // should warn here!! |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics [Error 3261, Line 6, Col 18, Line 6, Col 24, "Nullness warning: The types 'FileSystemInfo' and 'FileSystemInfo | null' do not have compatible nullability."] + |> withDiagnostics [Error 3261, Line 6, Col 18, Line 6, Col 24, "Nullness warning: The types 'DirectoryInfo' and 'DirectoryInfo | null' do not have compatible nullability."] [] let ``Consumption of netstandard2 BCL api which is not annotated`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs index 86483bf3bd0..09dc6ca954f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs @@ -15,6 +15,7 @@ let typeCheckWithStrictNullness cu = [] let ``Cannot pass possibly null value to a strict function``() = FSharp """ +module MyLib let strictFunc(x:string) = () let nonStrictFunc(x:string | null) = strictFunc(x) """ @@ -22,7 +23,7 @@ let nonStrictFunc(x:string | null) = strictFunc(x) |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics [ - Error 3261, Line 3, Col 49, Line 3, Col 50, "Nullness warning: The types 'string' and 'string | null' do not have equivalent nullability."] + Error 3261, Line 4, Col 49, Line 4, Col 50, "Nullness warning: The types 'string' and 'string | null' do not have equivalent nullability."] [] let ``Boolean literal to string is not nullable`` () = @@ -36,6 +37,7 @@ let processBool () : string = true.ToString() """ |> asLibrary + |> withNoWarn 52 // The value has been copied to ensure the original is not mutated... |> typeCheckWithStrictNullness |> shouldSucceed From 3fe9b7b87dd1bb8934f3658c426dc73270c3bfc4 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 15 Feb 2024 15:31:53 +0100 Subject: [PATCH 4/9] Revert baseline changes, since change is now under a flag --- .../EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl | 4 ++-- .../EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl | 4 ++-- .../EmittedIL/TestFunctions/TestFunction22h.fs.il.net472.bsl | 4 ++-- .../EmittedIL/TestFunctions/TestFunction22h.fs.il.netcore.bsl | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl index 2835187fdf5..74a7f10739f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl @@ -1153,7 +1153,7 @@ IL_0054: ldelem floatsanddoubles/Double IL_0059: box floatsanddoubles/Double IL_005e: constrained. floatsanddoubles/Double - IL_0064: callvirt instance bool [runtime]System.ValueType::Equals(object) + IL_0064: callvirt instance bool [runtime]System.Object::Equals(object) IL_0069: call valuetype floatsanddoubles/Double[] floatsanddoubles::get_doubles() IL_006e: ldloc.0 IL_006f: ldelema floatsanddoubles/Double @@ -1221,7 +1221,7 @@ IL_0111: ldelem floatsanddoubles/Float IL_0116: box floatsanddoubles/Float IL_011b: constrained. floatsanddoubles/Float - IL_0121: callvirt instance bool [runtime]System.ValueType::Equals(object) + IL_0121: callvirt instance bool [runtime]System.Object::Equals(object) IL_0126: call valuetype floatsanddoubles/Float[] floatsanddoubles::get_floats() IL_012b: ldloc.3 IL_012c: ldelema floatsanddoubles/Float diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl index 4bf5f1ec067..cdb6d94eac2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl @@ -1087,7 +1087,7 @@ IL_0054: ldelem floatsanddoubles/Double IL_0059: box floatsanddoubles/Double IL_005e: constrained. floatsanddoubles/Double - IL_0064: callvirt instance bool [runtime]System.ValueType::Equals(object) + IL_0064: callvirt instance bool [runtime]System.Object::Equals(object) IL_0069: call valuetype floatsanddoubles/Double[] floatsanddoubles::get_doubles() IL_006e: ldloc.0 IL_006f: ldelema floatsanddoubles/Double @@ -1155,7 +1155,7 @@ IL_0111: ldelem floatsanddoubles/Float IL_0116: box floatsanddoubles/Float IL_011b: constrained. floatsanddoubles/Float - IL_0121: callvirt instance bool [runtime]System.ValueType::Equals(object) + IL_0121: callvirt instance bool [runtime]System.Object::Equals(object) IL_0126: call valuetype floatsanddoubles/Float[] floatsanddoubles::get_floats() IL_012b: ldloc.3 IL_012c: ldelema floatsanddoubles/Float diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.net472.bsl index 39b8c638c66..433c9858f45 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.net472.bsl @@ -160,7 +160,7 @@ IL_0034: ldloc.s V_4 IL_0036: stloc.s V_5 IL_0038: ldloc.s V_5 - IL_003a: callvirt instance string [runtime]System.ArgumentException::get_Message() + IL_003a: callvirt instance string [runtime]System.Exception::get_Message() IL_003f: call void [runtime]System.Console::WriteLine(string) IL_0044: leave.s IL_0051 @@ -282,7 +282,7 @@ IL_002b: unbox.any [runtime]System.ArgumentException IL_0030: stloc.3 IL_0031: ldloc.3 - IL_0032: callvirt instance string [runtime]System.ArgumentException::get_Message() + IL_0032: callvirt instance string [runtime]System.Exception::get_Message() IL_0037: call void [runtime]System.Console::WriteLine(string) IL_003c: leave.s IL_005f diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.netcore.bsl index 059d618d7a5..0a339bb2ae3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h.fs.il.netcore.bsl @@ -161,7 +161,7 @@ IL_0034: ldloc.s V_4 IL_0036: stloc.s V_5 IL_0038: ldloc.s V_5 - IL_003a: callvirt instance string [runtime]System.ArgumentException::get_Message() + IL_003a: callvirt instance string [runtime]System.Exception::get_Message() IL_003f: call void [runtime]System.Console::WriteLine(string) IL_0044: leave.s IL_0051 @@ -283,7 +283,7 @@ IL_002b: unbox.any [runtime]System.ArgumentException IL_0030: stloc.3 IL_0031: ldloc.3 - IL_0032: callvirt instance string [runtime]System.ArgumentException::get_Message() + IL_0032: callvirt instance string [runtime]System.Exception::get_Message() IL_0037: call void [runtime]System.Console::WriteLine(string) IL_003c: leave.s IL_005f From 1129a9bc141c40916b2339b189421fea3dec5e5b Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 16 Feb 2024 11:58:21 +0100 Subject: [PATCH 5/9] Nullness + properties + "partial overrides" --- src/Compiler/Checking/ConstraintSolver.fs | 8 +++++++- src/Compiler/Checking/InfoReader.fs | 9 +++++++-- src/Compiler/Checking/infos.fs | 7 ++++--- .../MethodsAndProperties/MethodsAndProperties.fs | 8 ++++++++ .../PartiallyOverridenProperty.fs | 15 +++++++++++++++ 5 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/PartiallyOverridenProperty.fs diff --git a/src/Compiler/Checking/ConstraintSolver.fs b/src/Compiler/Checking/ConstraintSolver.fs index 188e07399c2..cfae752df80 100644 --- a/src/Compiler/Checking/ConstraintSolver.fs +++ b/src/Compiler/Checking/ConstraintSolver.fs @@ -3646,7 +3646,13 @@ and GetMostApplicableOverload csenv ndeep candidates applicableMeths calledMethG 0 if c <> 0 then c else - 0 + // Properties are kept incl. almost-duplicates because of the partial-override possibility. + // E.g. base can have get,set and derived only get => we keep both props around until method resolution time. + // Now is the type to pick the better (more derived) one. + match candidate.AssociatedPropertyInfo,other.AssociatedPropertyInfo,candidate.Method.IsExtensionMember,other.Method.IsExtensionMember with + | Some p1, Some p2, false, false -> compareTypes p1.ApparentEnclosingType p2.ApparentEnclosingType + | _ -> 0 + let bestMethods = let indexedApplicableMeths = applicableMeths |> List.indexed diff --git a/src/Compiler/Checking/InfoReader.fs b/src/Compiler/Checking/InfoReader.fs index 0028d830b35..1397207b10d 100644 --- a/src/Compiler/Checking/InfoReader.fs +++ b/src/Compiler/Checking/InfoReader.fs @@ -644,6 +644,11 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) as this = MethInfosEquivByNameAndSig EraseNone true g amap m, (fun minfo -> minfo.LogicalName)) + static let PropsGetterSetterEquiv innerEquality (p1:PropInfo) (p2:PropInfo) : bool = + p1.HasGetter = p2.HasGetter && + p1.HasSetter = p2.HasSetter && + innerEquality p1 p2 + /// Filter the overrides of properties, either keeping the overrides or keeping the dispatch slots. static let FilterOverridesOfPropInfos findFlag g amap m props = props @@ -652,7 +657,7 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) as this = (fun pinfo -> pinfo.IsNewSlot), (fun pinfo -> pinfo.IsDefiniteFSharpOverride), (fun _ -> false), - PropInfosEquivByNameAndSig EraseNone g amap m, + PropsGetterSetterEquiv (PropInfosEquivByNameAndSig EraseNone g amap m), (fun pinfo -> pinfo.PropertyName)) /// Exclude methods from super types which have the same signature as a method in a more specific type. @@ -670,7 +675,7 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) as this = /// Exclude properties from super types which have the same name as a property in a more specific type. static let ExcludeHiddenOfPropInfosImpl g amap m pinfos = pinfos - |> ExcludeItemsInSuperTypesBasedOnEquivTestWithItemsInSubTypes (fun (pinfo: PropInfo) -> pinfo.PropertyName) (PropInfosEquivByNameAndPartialSig EraseNone g amap m) + |> ExcludeItemsInSuperTypesBasedOnEquivTestWithItemsInSubTypes (fun (pinfo: PropInfo) -> pinfo.PropertyName) (PropsGetterSetterEquiv (PropInfosEquivByNameAndPartialSig EraseNone g amap m)) |> List.concat /// Make a cache for function 'f' keyed by type (plus some additional 'flags') that only diff --git a/src/Compiler/Checking/infos.fs b/src/Compiler/Checking/infos.fs index 74caea62dda..4427a045da9 100644 --- a/src/Compiler/Checking/infos.fs +++ b/src/Compiler/Checking/infos.fs @@ -2429,6 +2429,8 @@ let MethInfosEquivByNameAndPartialSig erasureFlag ignoreFinal g amap m (minfo: M /// Used to hide/filter members from base classes based on signature let PropInfosEquivByNameAndPartialSig erasureFlag g amap m (pinfo: PropInfo) (pinfo2: PropInfo) = + //(pinfo.HasGetter = pinfo2.HasGetter) && + //(pinfo.HasSetter = pinfo2.HasSetter) && pinfo.PropertyName = pinfo2.PropertyName && let argTys = pinfo.GetParamTypes(amap, m) let argTys2 = pinfo2.GetParamTypes(amap, m) @@ -2440,13 +2442,12 @@ let MethInfosEquivByNameAndSig erasureFlag ignoreFinal g amap m minfo minfo2 = let (CompiledSig(_, retTy, formalMethTypars, _)) = CompiledSigOfMeth g amap m minfo let (CompiledSig(_, retTy2, formalMethTypars2, _)) = CompiledSigOfMeth g amap m minfo2 match retTy, retTy2 with - | None, None -> true - // putting nullnessSensitivetypeAEquivAux here is right or not? + | None, None -> true | Some retTy, Some retTy2 -> typeAEquivAux erasureFlag g (TypeEquivEnv.FromEquivTypars formalMethTypars formalMethTypars2) retTy retTy2 | _ -> false /// Used to hide/filter members from super classes based on signature -let PropInfosEquivByNameAndSig erasureFlag g amap m (pinfo: PropInfo) (pinfo2: PropInfo) = +let PropInfosEquivByNameAndSig erasureFlag g amap m (pinfo: PropInfo) (pinfo2: PropInfo) = PropInfosEquivByNameAndPartialSig erasureFlag g amap m pinfo pinfo2 && let retTy = pinfo.GetPropertyType(amap, m) let retTy2 = pinfo2.GetPropertyType(amap, m) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs index 69c73ed9757..9722633165d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs @@ -16,6 +16,14 @@ module MemberDefinitions_MethodsAndProperties = let verifyCompileAndRun = verifyCompile >> run + // SOURCE=PartiallyOverridenProperty.fs + [] + let ``Partially Overriden Property`` compilation = + compilation + |> withLangVersionPreview + |> withCheckNulls + |> typecheck + |> shouldSucceed // SOURCE=AbstractProperties01.fs # AbstractProperties01.fs [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/PartiallyOverridenProperty.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/PartiallyOverridenProperty.fs new file mode 100644 index 00000000000..472ee4ea8ec --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/PartiallyOverridenProperty.fs @@ -0,0 +1,15 @@ +module MyLib + +type BaseType() = + abstract Msg : string with get,set + default this.Msg + with get() = "" + and set x = printfn "%s" x + +type DerivedType() = + inherit BaseType() + override this.Msg with get() = "getterOnly" + +let d = new DerivedType() +d.Msg <- "" //invoking setter +printfn "%s" d.Msg //invoking getter From f21bda010bba19453180fa68329aebd5cf659d13 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 16 Feb 2024 13:42:30 +0100 Subject: [PATCH 6/9] Address stability of Linux+macos tests --- src/Compiler/TypedTree/TcGlobals.fs | 4 ++++ src/Compiler/TypedTree/TypedTreeOps.fs | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 946a9f5b2f1..120d61840b5 100644 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -198,6 +198,8 @@ type TcGlobals( let v_langFeatureNullness = langVersion.SupportsFeature LanguageFeature.NullnessChecking + let v_renderNullness = checkNullness && v_langFeatureNullness + let v_knownWithNull = if v_langFeatureNullness then KnownWithNull else KnownAmbivalentToNull @@ -1105,6 +1107,8 @@ type TcGlobals( member _.langFeatureNullness = v_langFeatureNullness + member _.renderNullnessAnnotations = v_renderNullness + member _.knownWithNull = v_knownWithNull member _.knownWithoutNull = v_knownWithoutNull diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 9244e173f4e..8c8674eb4bf 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -8783,6 +8783,9 @@ let typarEnc _g (gtpsType, gtpsMethod) typar = warning(InternalError("Typar not found during XmlDoc generation", typar.Range)) "``0" +let nullnessEnc (g:TcGlobals) (nullness:Nullness) = + if g.renderNullnessAnnotations then nullness.ToFsharpCodeString() else "" + let rec typeEnc g (gtpsType, gtpsMethod) ty = let stripped = stripTyEqnsAndMeasureEqns g ty match stripped with @@ -8801,7 +8804,7 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = let tcref, tinst = destAppTy g ty let rank = rankOfArrayTyconRef g tcref let arraySuffix = "[" + String.concat ", " (List.replicate (rank-1) "0:") + "]" - typeEnc g (gtpsType, gtpsMethod) (List.head tinst) + arraySuffix + nullness.ToFsharpCodeString() + typeEnc g (gtpsType, gtpsMethod) (List.head tinst) + arraySuffix + nullnessEnc g nullness | TType_ucase (_, tinst) | TType_app (_, tinst, _) -> @@ -8816,7 +8819,7 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = | _ -> assert false failwith "impossible" - tyName + tyargsEnc g (gtpsType, gtpsMethod) tinst + nullness.ToFsharpCodeString() + tyName + tyargsEnc g (gtpsType, gtpsMethod) tinst + nullnessEnc g nullness | TType_anon (anonInfo, tinst) -> sprintf "%s%s" anonInfo.ILTypeRef.FullName (tyargsEnc g (gtpsType, gtpsMethod) tinst) @@ -8828,10 +8831,10 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = sprintf "System.Tuple%s"(tyargsEnc g (gtpsType, gtpsMethod) tys) | TType_fun (domainTy, rangeTy, nullness) -> - "Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [domainTy; rangeTy] + nullness.ToFsharpCodeString() + "Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [domainTy; rangeTy] + nullnessEnc g nullness | TType_var (typar, nullness) -> - typarEnc g (gtpsType, gtpsMethod) typar + nullness.ToFsharpCodeString() + typarEnc g (gtpsType, gtpsMethod) typar + nullnessEnc g nullness | TType_measure _ -> "?" From f53768b9ac078d61fbbd90cc85cab5a64eff6a9f Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 16 Feb 2024 15:43:49 +0100 Subject: [PATCH 7/9] Apply suggestions from code review --- src/Compiler/Checking/infos.fs | 6 ++---- src/Compiler/TypedTree/TypedTreeOps.fs | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Compiler/Checking/infos.fs b/src/Compiler/Checking/infos.fs index 4427a045da9..de2348eb7be 100644 --- a/src/Compiler/Checking/infos.fs +++ b/src/Compiler/Checking/infos.fs @@ -2429,8 +2429,6 @@ let MethInfosEquivByNameAndPartialSig erasureFlag ignoreFinal g amap m (minfo: M /// Used to hide/filter members from base classes based on signature let PropInfosEquivByNameAndPartialSig erasureFlag g amap m (pinfo: PropInfo) (pinfo2: PropInfo) = - //(pinfo.HasGetter = pinfo2.HasGetter) && - //(pinfo.HasSetter = pinfo2.HasSetter) && pinfo.PropertyName = pinfo2.PropertyName && let argTys = pinfo.GetParamTypes(amap, m) let argTys2 = pinfo2.GetParamTypes(amap, m) @@ -2442,12 +2440,12 @@ let MethInfosEquivByNameAndSig erasureFlag ignoreFinal g amap m minfo minfo2 = let (CompiledSig(_, retTy, formalMethTypars, _)) = CompiledSigOfMeth g amap m minfo let (CompiledSig(_, retTy2, formalMethTypars2, _)) = CompiledSigOfMeth g amap m minfo2 match retTy, retTy2 with - | None, None -> true + | None, None -> true | Some retTy, Some retTy2 -> typeAEquivAux erasureFlag g (TypeEquivEnv.FromEquivTypars formalMethTypars formalMethTypars2) retTy retTy2 | _ -> false /// Used to hide/filter members from super classes based on signature -let PropInfosEquivByNameAndSig erasureFlag g amap m (pinfo: PropInfo) (pinfo2: PropInfo) = +let PropInfosEquivByNameAndSig erasureFlag g amap m (pinfo: PropInfo) (pinfo2: PropInfo) = PropInfosEquivByNameAndPartialSig erasureFlag g amap m pinfo pinfo2 && let retTy = pinfo.GetPropertyType(amap, m) let retTy2 = pinfo2.GetPropertyType(amap, m) diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 8c8674eb4bf..12720cca9a8 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -9024,7 +9024,6 @@ let intrinsicNullnessOfTyconRef g (tcref: TyconRef) = let nullnessOfTy g ty = ty - // stripping is where the evil is for abbrevs |> stripTyEqns g |> function | TType_app(tcref, _, nullness) -> From 0610c7a98e407e59841eb70919939a67977c6e3a Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Tue, 20 Feb 2024 10:30:09 +0100 Subject: [PATCH 8/9] Fix tests --- .../core/auto-widen/preview-default-warns/test.bsl | 14 +++++++------- tests/fsharp/core/auto-widen/preview/test.bsl | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl b/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl index 0e6a2d51844..b4a2cf4a5fc 100644 --- a/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl +++ b/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl @@ -1,7 +1,7 @@ test.fsx(147,18,147,19): typecheck error FS3391: This expression uses the implicit conversion 'Decimal.op_Implicit(value: int) : decimal' to convert type 'int' to type 'decimal'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". -test.fsx(149,39,149,41): typecheck error FS3391: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string) : Xml.Linq.XNamespace' to convert type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". +test.fsx(149,39,149,41): typecheck error FS3391: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string | null) : Xml.Linq.XNamespace | null' to convert type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". test.fsx(178,20,178,21): typecheck error FS3391: This expression uses the implicit conversion 'static member C.op_Implicit: x: 'T -> C<'T>' to convert type 'int' to type 'C'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". @@ -12,9 +12,9 @@ test.fsx(186,27,186,28): typecheck error FS3391: This expression uses the implic test.fsx(188,15,188,16): typecheck error FS3391: This expression uses the implicit conversion 'Nullable.op_Implicit(value: int) : Nullable' to convert type 'int' to type 'Nullable'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". test.fsx(463,18,463,19): typecheck error FS0001: This expression was expected to have type - 'C' + 'C' but here has type - 'int' + 'int' test.fsx(471,18,471,19): typecheck error FS0044: This construct is deprecated. nope @@ -23,9 +23,9 @@ test.fsx(482,18,482,21): typecheck error FS3387: This expression has type 'B' an static member C.op_Implicit: x: B -> C test.fsx(546,30,546,31): typecheck error FS0001: This expression was expected to have type - 'float32' + 'float32' but here has type - 'int' + 'int' test.fsx(546,32,546,33): typecheck error FS0001: All elements of a list must be implicitly convertible to the type of the first element, which here is 'float32'. This element has type 'int'. @@ -34,9 +34,9 @@ test.fsx(546,34,546,35): typecheck error FS0001: All elements of a list must be test.fsx(546,36,546,37): typecheck error FS0001: All elements of a list must be implicitly convertible to the type of the first element, which here is 'float32'. This element has type 'int'. test.fsx(547,28,547,32): typecheck error FS0001: This expression was expected to have type - 'float' + 'float' but here has type - 'float32' + 'float32' test.fsx(547,33,547,37): typecheck error FS0001: All elements of a list must be implicitly convertible to the type of the first element, which here is 'float'. This element has type 'float32'. diff --git a/tests/fsharp/core/auto-widen/preview/test.bsl b/tests/fsharp/core/auto-widen/preview/test.bsl index c17dc66908f..5dda8642e99 100644 --- a/tests/fsharp/core/auto-widen/preview/test.bsl +++ b/tests/fsharp/core/auto-widen/preview/test.bsl @@ -131,15 +131,15 @@ test.fsx(147,18,147,19): typecheck error FS3391: This expression uses the implic test.fsx(147,18,147,19): typecheck error FS3388: This expression implicitly converts type 'int' to type 'decimal'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(149,39,149,41): typecheck error FS3391: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string) : Xml.Linq.XNamespace' to convert type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". +test.fsx(149,39,149,41): typecheck error FS3391: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string | null) : Xml.Linq.XNamespace | null' to convert type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". test.fsx(149,39,149,41): typecheck error FS3388: This expression implicitly converts type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(154,18,154,20): typecheck error FS3395: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string) : Xml.Linq.XNamespace' to convert type 'string' to type 'Xml.Linq.XNamespace'. +test.fsx(154,18,154,20): typecheck error FS3395: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string | null) : Xml.Linq.XNamespace | null' to convert type 'string' to type 'Xml.Linq.XNamespace'. test.fsx(154,18,154,20): typecheck error FS3388: This expression implicitly converts type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(159,18,159,21): typecheck error FS3395: This expression uses the implicit conversion 'Xml.Linq.XName.op_Implicit(expandedName: string) : Xml.Linq.XName' to convert type 'string' to type 'Xml.Linq.XName'. +test.fsx(159,18,159,21): typecheck error FS3395: This expression uses the implicit conversion 'Xml.Linq.XName.op_Implicit(expandedName: string | null) : Xml.Linq.XName | null' to convert type 'string' to type 'Xml.Linq.XName'. test.fsx(159,18,159,21): typecheck error FS3388: This expression implicitly converts type 'string' to type 'Xml.Linq.XName'. See https://aka.ms/fsharp-implicit-convs. @@ -562,9 +562,9 @@ test.fsx(454,46,454,47): typecheck error FS3389: This expression uses a built-in test.fsx(454,46,454,47): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(463,18,463,19): typecheck error FS0001: This expression was expected to have type - 'C' + 'C' but here has type - 'int' + 'int' test.fsx(471,18,471,19): typecheck error FS3395: This expression uses the implicit conversion 'static member C.op_Implicit: x: int -> C' to convert type 'int' to type 'C'. @@ -585,9 +585,9 @@ test.fsx(519,18,519,21): typecheck error FS3395: This expression uses the implic test.fsx(538,18,538,21): typecheck error FS3395: This expression uses the implicit conversion 'static member C.op_Implicit: x: B -> C' to convert type 'B' to type 'C'. test.fsx(543,30,543,31): typecheck error FS0001: This expression was expected to have type - 'float32' + 'float32' but here has type - 'int' + 'int' test.fsx(543,32,543,33): typecheck error FS0001: All elements of a list must be implicitly convertible to the type of the first element, which here is 'float32'. This element has type 'int'. From f9762fac3a4c97962585f217b0e77280f9429281 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Tue, 20 Feb 2024 11:57:29 +0100 Subject: [PATCH 9/9] Revert "Fix tests" This reverts commit 0610c7a98e407e59841eb70919939a67977c6e3a. --- .../core/auto-widen/preview-default-warns/test.bsl | 14 +++++++------- tests/fsharp/core/auto-widen/preview/test.bsl | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl b/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl index b4a2cf4a5fc..0e6a2d51844 100644 --- a/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl +++ b/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl @@ -1,7 +1,7 @@ test.fsx(147,18,147,19): typecheck error FS3391: This expression uses the implicit conversion 'Decimal.op_Implicit(value: int) : decimal' to convert type 'int' to type 'decimal'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". -test.fsx(149,39,149,41): typecheck error FS3391: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string | null) : Xml.Linq.XNamespace | null' to convert type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". +test.fsx(149,39,149,41): typecheck error FS3391: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string) : Xml.Linq.XNamespace' to convert type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". test.fsx(178,20,178,21): typecheck error FS3391: This expression uses the implicit conversion 'static member C.op_Implicit: x: 'T -> C<'T>' to convert type 'int' to type 'C'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". @@ -12,9 +12,9 @@ test.fsx(186,27,186,28): typecheck error FS3391: This expression uses the implic test.fsx(188,15,188,16): typecheck error FS3391: This expression uses the implicit conversion 'Nullable.op_Implicit(value: int) : Nullable' to convert type 'int' to type 'Nullable'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". test.fsx(463,18,463,19): typecheck error FS0001: This expression was expected to have type - 'C' + 'C' but here has type - 'int' + 'int' test.fsx(471,18,471,19): typecheck error FS0044: This construct is deprecated. nope @@ -23,9 +23,9 @@ test.fsx(482,18,482,21): typecheck error FS3387: This expression has type 'B' an static member C.op_Implicit: x: B -> C test.fsx(546,30,546,31): typecheck error FS0001: This expression was expected to have type - 'float32' + 'float32' but here has type - 'int' + 'int' test.fsx(546,32,546,33): typecheck error FS0001: All elements of a list must be implicitly convertible to the type of the first element, which here is 'float32'. This element has type 'int'. @@ -34,9 +34,9 @@ test.fsx(546,34,546,35): typecheck error FS0001: All elements of a list must be test.fsx(546,36,546,37): typecheck error FS0001: All elements of a list must be implicitly convertible to the type of the first element, which here is 'float32'. This element has type 'int'. test.fsx(547,28,547,32): typecheck error FS0001: This expression was expected to have type - 'float' + 'float' but here has type - 'float32' + 'float32' test.fsx(547,33,547,37): typecheck error FS0001: All elements of a list must be implicitly convertible to the type of the first element, which here is 'float'. This element has type 'float32'. diff --git a/tests/fsharp/core/auto-widen/preview/test.bsl b/tests/fsharp/core/auto-widen/preview/test.bsl index 5dda8642e99..c17dc66908f 100644 --- a/tests/fsharp/core/auto-widen/preview/test.bsl +++ b/tests/fsharp/core/auto-widen/preview/test.bsl @@ -131,15 +131,15 @@ test.fsx(147,18,147,19): typecheck error FS3391: This expression uses the implic test.fsx(147,18,147,19): typecheck error FS3388: This expression implicitly converts type 'int' to type 'decimal'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(149,39,149,41): typecheck error FS3391: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string | null) : Xml.Linq.XNamespace | null' to convert type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". +test.fsx(149,39,149,41): typecheck error FS3391: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string) : Xml.Linq.XNamespace' to convert type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". test.fsx(149,39,149,41): typecheck error FS3388: This expression implicitly converts type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(154,18,154,20): typecheck error FS3395: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string | null) : Xml.Linq.XNamespace | null' to convert type 'string' to type 'Xml.Linq.XNamespace'. +test.fsx(154,18,154,20): typecheck error FS3395: This expression uses the implicit conversion 'Xml.Linq.XNamespace.op_Implicit(namespaceName: string) : Xml.Linq.XNamespace' to convert type 'string' to type 'Xml.Linq.XNamespace'. test.fsx(154,18,154,20): typecheck error FS3388: This expression implicitly converts type 'string' to type 'Xml.Linq.XNamespace'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(159,18,159,21): typecheck error FS3395: This expression uses the implicit conversion 'Xml.Linq.XName.op_Implicit(expandedName: string | null) : Xml.Linq.XName | null' to convert type 'string' to type 'Xml.Linq.XName'. +test.fsx(159,18,159,21): typecheck error FS3395: This expression uses the implicit conversion 'Xml.Linq.XName.op_Implicit(expandedName: string) : Xml.Linq.XName' to convert type 'string' to type 'Xml.Linq.XName'. test.fsx(159,18,159,21): typecheck error FS3388: This expression implicitly converts type 'string' to type 'Xml.Linq.XName'. See https://aka.ms/fsharp-implicit-convs. @@ -562,9 +562,9 @@ test.fsx(454,46,454,47): typecheck error FS3389: This expression uses a built-in test.fsx(454,46,454,47): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(463,18,463,19): typecheck error FS0001: This expression was expected to have type - 'C' + 'C' but here has type - 'int' + 'int' test.fsx(471,18,471,19): typecheck error FS3395: This expression uses the implicit conversion 'static member C.op_Implicit: x: int -> C' to convert type 'int' to type 'C'. @@ -585,9 +585,9 @@ test.fsx(519,18,519,21): typecheck error FS3395: This expression uses the implic test.fsx(538,18,538,21): typecheck error FS3395: This expression uses the implicit conversion 'static member C.op_Implicit: x: B -> C' to convert type 'B' to type 'C'. test.fsx(543,30,543,31): typecheck error FS0001: This expression was expected to have type - 'float32' + 'float32' but here has type - 'int' + 'int' test.fsx(543,32,543,33): typecheck error FS0001: All elements of a list must be implicitly convertible to the type of the first element, which here is 'float32'. This element has type 'int'.