diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 3a25b96273b..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 IgnoreOverrides) + 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/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/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/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/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..12720cca9a8 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 && @@ -8771,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 @@ -8789,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, _) -> @@ -8804,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) @@ -8816,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 _ -> "?" 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/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs index a71f63cbfb9..9722633165d 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,23 @@ module MemberDefinitions_MethodsAndProperties = |> withOptions ["--nowarn:988"] |> compile - let verifyCompileAndRun compilation = + let verifyCompileAndRun = verifyCompile >> run + + // SOURCE=PartiallyOverridenProperty.fs + [] + let ``Partially Overriden Property`` compilation = compilation - |> asExe - |> withOptions ["--nowarn:988"] - |> compileAndRun + |> withLangVersionPreview + |> withCheckNulls + |> typecheck + |> shouldSucceed // SOURCE=AbstractProperties01.fs # AbstractProperties01.fs [] let ``AbstractProperties01_fs`` compilation = compilation + |> withLangVersionPreview + |> withCheckNulls |> verifyCompileAndRun |> shouldSucceed 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 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..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 @@ -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 @@ -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..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 @@ -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 @@ -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..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 @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe 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..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 @@ -17,16 +17,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe 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 2f646acb23e..65e3a5c85bb 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 'DirectoryInfo' and 'DirectoryInfo | 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 9bcebf546c8..09dc6ca954f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/NullableReferenceTypesTests.fs @@ -11,6 +11,49 @@ let typeCheckWithStrictNullness cu = |> withOptions ["--warnaserror+"] |> compile + +[] +let ``Cannot pass possibly null value to a strict function``() = + FSharp """ +module MyLib +let strictFunc(x:string) = () +let nonStrictFunc(x:string | null) = strictFunc(x) + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics [ + 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`` () = + FSharp """module MyLibrary +let onlyWantNotNullString(x:string) = () + +let processBool () : string = + onlyWantNotNullString (true.ToString()) + onlyWantNotNullString (false.ToString()) + + true.ToString() +""" + |> asLibrary + |> withNoWarn 52 // The value has been copied to ensure the original is not mutated... + |> 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 + |> typeCheckWithStrictNullness + |> shouldSucceed + [] let ``Printing a nullable string should pass`` () = FSharp """module MyLibrary