From 293d5cc54833bb83732fd3595b1f0b82e3520178 Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Thu, 13 May 2021 15:27:03 +0200 Subject: [PATCH 1/8] Few areas of interest to explore forbidding calling setter on init properties. --- src/fsharp/CheckExpressions.fs | 2 ++ src/fsharp/TcGlobals.fs | 5 +++-- src/fsharp/absil/il.fs | 2 +- src/fsharp/absil/il.fsi | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/fsharp/CheckExpressions.fs b/src/fsharp/CheckExpressions.fs index b06a6d2bcc6..5d9dd664bde 100644 --- a/src/fsharp/CheckExpressions.fs +++ b/src/fsharp/CheckExpressions.fs @@ -8048,6 +8048,7 @@ and TcItemThen cenv overallTy env tpenv (tinstEnclosing, item, mItem, rest, afte match delayed with | DelayedSet(e2, mStmt) :: otherDelayed -> if not (isNil otherDelayed) then error(Error(FSComp.SR.tcInvalidAssignment(), mStmt)) + // gauthier todo: implication of init property // Static Property Set (possibly indexer) UnifyTypes cenv env mStmt overallTy g.unit_ty let meths = pinfos |> SettersOfPropInfos @@ -8231,6 +8232,7 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela match delayed with | DelayedSet(e2, mStmt) :: otherDelayed -> if not (isNil otherDelayed) then error(Error(FSComp.SR.tcInvalidAssignment(), mStmt)) + // gauthier todo: implication of init property // Instance property setter UnifyTypes cenv env mStmt overallTy cenv.g.unit_ty let meths = SettersOfPropInfos pinfos diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index dd4bf222c0d..084b044a887 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -1178,8 +1178,9 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val attrib_OutAttribute = findSysAttrib "System.Runtime.InteropServices.OutAttribute" member val attrib_OptionalAttribute = tryFindSysAttrib "System.Runtime.InteropServices.OptionalAttribute" member val attrib_DefaultParameterValueAttribute = tryFindSysAttrib "System.Runtime.InteropServices.DefaultParameterValueAttribute" - member val attrib_ThreadStaticAttribute = tryFindSysAttrib "System.ThreadStaticAttribute" - member val attrib_SpecialNameAttribute = tryFindSysAttrib "System.Runtime.CompilerServices.SpecialNameAttribute" + member val attrib_ThreadStaticAttribute = tryFindSysAttrib "System.ThreadStaticAttribute" + member val attrib_SpecialNameAttribute = tryFindSysAttrib "System.Runtime.CompilerServices.SpecialNameAttribute" + member val attrib_IsExternalInit = tryFindSysAttrib "System.Runtime.CompilerServices.IsExternalInit" member val attrib_VolatileFieldAttribute = mk_MFCore_attrib "VolatileFieldAttribute" member val attrib_ContextStaticAttribute = tryFindSysAttrib "System.ContextStaticAttribute" member val attrib_FlagsAttribute = findSysAttrib "System.FlagsAttribute" diff --git a/src/fsharp/absil/il.fs b/src/fsharp/absil/il.fs index a2e1f0ee3ec..f8ca4208e20 100644 --- a/src/fsharp/absil/il.fs +++ b/src/fsharp/absil/il.fs @@ -719,7 +719,7 @@ and [ Date: Fri, 14 May 2021 05:44:04 +0200 Subject: [PATCH 2/8] prevent the property assignment syntax to type check, the set_PropName still passes through not sure why I'm having None when TcGlobals is loading the attribute --- src/fsharp/CheckExpressions.fs | 3 ++- src/fsharp/MethodCalls.fs | 2 +- src/fsharp/MethodCalls.fsi | 7 ++++++- src/fsharp/NameResolution.fs | 2 +- src/fsharp/NameResolution.fsi | 2 +- src/fsharp/infos.fs | 18 ++++++++++++++++++ src/fsharp/infos.fsi | 6 ++++++ tests/fsharp/tests.fs | 6 ++++++ .../typecheck/init-property/niceinit.bsl | 2 ++ .../fsharp/typecheck/init-property/niceinit.cs | 10 ++++++++++ .../typecheck/init-property/niceinit.fsx | 7 +++++++ 11 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 tests/fsharp/typecheck/init-property/niceinit.bsl create mode 100644 tests/fsharp/typecheck/init-property/niceinit.cs create mode 100644 tests/fsharp/typecheck/init-property/niceinit.fsx diff --git a/src/fsharp/CheckExpressions.fs b/src/fsharp/CheckExpressions.fs index 5d9dd664bde..0af98dac575 100644 --- a/src/fsharp/CheckExpressions.fs +++ b/src/fsharp/CheckExpressions.fs @@ -8232,7 +8232,6 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela match delayed with | DelayedSet(e2, mStmt) :: otherDelayed -> if not (isNil otherDelayed) then error(Error(FSComp.SR.tcInvalidAssignment(), mStmt)) - // gauthier todo: implication of init property // Instance property setter UnifyTypes cenv env mStmt overallTy cenv.g.unit_ty let meths = SettersOfPropInfos pinfos @@ -8245,6 +8244,8 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) TcMethodApplicationThen cenv env overallTy None tpenv tyargsOpt objArgs mExprAndItem mItem nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag delayed else + if pinfo.SetterIsInitOnly then + errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) let args = if pinfo.IsIndexer then args else [] let mut = (if isStructTy cenv.g (tyOfExpr cenv.g objExpr) then DefinitelyMutates else PossiblyMutates) TcMethodApplicationThen cenv env overallTy None tpenv tyargsOpt objArgs mStmt mItem nm ad mut true meths afterResolution NormalValUse (args @ [e2]) atomicFlag [] diff --git a/src/fsharp/MethodCalls.fs b/src/fsharp/MethodCalls.fs index 0cd10e2fc4e..4454726f540 100644 --- a/src/fsharp/MethodCalls.fs +++ b/src/fsharp/MethodCalls.fs @@ -107,7 +107,7 @@ type AssignedItemSetterTarget = | AssignedRecdFieldSetter of RecdFieldInfo /// Represents the resolution of a caller argument as a named-setter argument -type AssignedItemSetter<'T> = AssignedItemSetter of Ident * AssignedItemSetterTarget * CallerArg<'T> +type AssignedItemSetter<'T> = AssignedItemSetter of name: Ident * setterTarget: AssignedItemSetterTarget * callerArg: CallerArg<'T> type CallerNamedArg<'T> = | CallerNamedArg of Ident * CallerArg<'T> diff --git a/src/fsharp/MethodCalls.fsi b/src/fsharp/MethodCalls.fsi index ac96b7b30d8..6e0688bfef1 100644 --- a/src/fsharp/MethodCalls.fsi +++ b/src/fsharp/MethodCalls.fsi @@ -77,7 +77,12 @@ type AssignedItemSetterTarget = /// Represents the resolution of a caller argument as a named-setter argument type AssignedItemSetter<'T> = | AssignedItemSetter of - Ident * AssignedItemSetterTarget * CallerArg<'T> + /// named-setter identifier + name: Ident * + /// named-setter target + setterTarget: AssignedItemSetterTarget * + /// caller argument that resolved into AssignedItemSetter + callerArg: CallerArg<'T> type CallerNamedArg<'T> = | CallerNamedArg of Ident * CallerArg<'T> diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index 196bef88230..e65ce83e149 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -185,7 +185,7 @@ type Item = | Event of EventInfo /// Represents the resolution of a name to a property - | Property of string * PropInfo list + | Property of propertyName: string * propertyInfos: PropInfo list /// Represents the resolution of a name to a group of methods. | MethodGroup of displayName: string * methods: MethInfo list * uninstantiatedMethodOpt: MethInfo option diff --git a/src/fsharp/NameResolution.fsi b/src/fsharp/NameResolution.fsi index 54efeb92e47..7abb0dac80e 100755 --- a/src/fsharp/NameResolution.fsi +++ b/src/fsharp/NameResolution.fsi @@ -80,7 +80,7 @@ type Item = | Event of EventInfo /// Represents the resolution of a name to a property - | Property of string * PropInfo list + | Property of propertyName: string * propertyInfos: PropInfo list /// Represents the resolution of a name to a group of methods. | MethodGroup of displayName: string * methods: MethInfo list * uninstantiatedMethodOpt: MethInfo option diff --git a/src/fsharp/infos.fs b/src/fsharp/infos.fs index 4404472318d..788b2b3070f 100755 --- a/src/fsharp/infos.fs +++ b/src/fsharp/infos.fs @@ -1890,6 +1890,16 @@ type ILPropInfo = /// Indicates if the IL property has a 'set' method member x.HasSetter = Option.isSome x.RawMetadata.SetMethod + member x.SetterIsInitOnly = + // todo: move to a constant once we understand why the attribute from TcGlobals is None and string based check is the alternate way + let attributeName = "System.Runtime.CompilerServices.IsExternalInit" + match x.SetterMethod.ILMethodRef.ReturnType, x.TcGlobals.attrib_IsExternalInit with + | ILType.Modified(modifierClass=modifierClass), None when modifierClass.BasicQualifiedName = attributeName -> + true + | ILType.Modified(modifierClass=modifierClass), Some isExternalInitAttribute -> + modifierClass = isExternalInitAttribute.TypeRef + | _ -> false + /// Indicates if the IL property is static member x.IsStatic = (x.RawMetadata.CallingConv = ILThisConvention.Static) @@ -2016,6 +2026,14 @@ type PropInfo = | ProvidedProp(_, pi, m) -> pi.PUntaint((fun pi -> pi.CanWrite), m) #endif + member x.SetterIsInitOnly = + match x with + | ILProp ilpinfo -> ilpinfo.SetterIsInitOnly + | FSProp _ -> false // F# doesn't support this +#if !NO_EXTENSIONTYPING + | ProvidedProp _ -> false +#endif + /// Indicates if this is an extension member member x.IsExtensionMember = match x.ArbitraryValRef with diff --git a/src/fsharp/infos.fsi b/src/fsharp/infos.fsi index fb543c2c19f..29519e4cc0b 100644 --- a/src/fsharp/infos.fsi +++ b/src/fsharp/infos.fsi @@ -723,6 +723,9 @@ type ILPropInfo = /// Indicates if the IL property has a 'set' method member HasSetter: bool + /// Indicates if the IL property setter is marked as 'init' + member SetterIsInitOnly: bool + /// Get the declaring IL type of the IL property, including any generic instantiation member ILTypeInfo: ILTypeInfo @@ -818,6 +821,9 @@ type PropInfo = /// Indicates if this property has an associated setter method. member HasSetter: bool + /// Indicates ... + member SetterIsInitOnly: bool + member ImplementedSlotSignatures: SlotSig list /// Indicates if this property is marked 'override' and thus definitely overrides another property. diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 253703752a7..e1f87b6e248 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -1851,6 +1851,12 @@ module CoreTests = fsc cfg @"%s /target:library /out:fs.dll" cfg.fsc_flags ["fs.fs"] singleNegTest cfg "calls" + [] + let ``play nice with init properties and assignment syntax``() = + let cfg = testConfig "typecheck/init-property" + csc cfg "%s /target:library /out:niceinit.dll" cfg.csc_flags ["niceinit.cs"] + singleNegTest cfg "niceinit.fsx" + #endif module VersionTests = diff --git a/tests/fsharp/typecheck/init-property/niceinit.bsl b/tests/fsharp/typecheck/init-property/niceinit.bsl new file mode 100644 index 00000000000..d4e627834cc --- /dev/null +++ b/tests/fsharp/typecheck/init-property/niceinit.bsl @@ -0,0 +1,2 @@ + +(7,1): error FS0810: Property 'Val' cannot be set diff --git a/tests/fsharp/typecheck/init-property/niceinit.cs b/tests/fsharp/typecheck/init-property/niceinit.cs new file mode 100644 index 00000000000..c19560fe450 --- /dev/null +++ b/tests/fsharp/typecheck/init-property/niceinit.cs @@ -0,0 +1,10 @@ +/*namespace System.Runtime.CompilerServices{ + + internal class IsExternalInit {} +}*/ + +public class NiceInit { + public NiceInit() {} + public int Val {get; init;} + public int OkVal {get; set;} +} \ No newline at end of file diff --git a/tests/fsharp/typecheck/init-property/niceinit.fsx b/tests/fsharp/typecheck/init-property/niceinit.fsx new file mode 100644 index 00000000000..f104e01ba84 --- /dev/null +++ b/tests/fsharp/typecheck/init-property/niceinit.fsx @@ -0,0 +1,7 @@ +#r @"niceinit.dll" + +let niceinit = NiceInit(Val = 1);; + +let niceinit2 = NiceInit();; +niceinit2.Val <- 5;; +niceinit2.set_Val 5;; \ No newline at end of file From 9be0d62b14652e7642a0bb022b8d4bfb4d2f1fff Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 15 May 2021 11:43:10 +0200 Subject: [PATCH 3/8] (minor) remove comment for static properties (they can't support init) --- src/fsharp/CheckExpressions.fs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/fsharp/CheckExpressions.fs b/src/fsharp/CheckExpressions.fs index 0af98dac575..861a1bdaf34 100644 --- a/src/fsharp/CheckExpressions.fs +++ b/src/fsharp/CheckExpressions.fs @@ -8048,7 +8048,6 @@ and TcItemThen cenv overallTy env tpenv (tinstEnclosing, item, mItem, rest, afte match delayed with | DelayedSet(e2, mStmt) :: otherDelayed -> if not (isNil otherDelayed) then error(Error(FSComp.SR.tcInvalidAssignment(), mStmt)) - // gauthier todo: implication of init property // Static Property Set (possibly indexer) UnifyTypes cenv env mStmt overallTy g.unit_ty let meths = pinfos |> SettersOfPropInfos From 4bc394ca75b87392cfe3f189675cd2d02a4b7b8d Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 15 May 2021 11:45:27 +0200 Subject: [PATCH 4/8] discard set properties if they are init only in MethodCalls.CalledMeth constructor --- src/fsharp/MethodCalls.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/MethodCalls.fs b/src/fsharp/MethodCalls.fs index 4454726f540..cdf9e9922df 100644 --- a/src/fsharp/MethodCalls.fs +++ b/src/fsharp/MethodCalls.fs @@ -435,7 +435,7 @@ type CalledMeth<'T> let pinfos = GetIntrinsicPropInfoSetsOfType infoReader (Some nm) ad AllowMultiIntfInstantiations.Yes IgnoreOverrides id.idRange returnedObjTy let pinfos = pinfos |> ExcludeHiddenOfPropInfos g infoReader.amap m match pinfos with - | [pinfo] when pinfo.HasSetter && not pinfo.IsIndexer -> + | [pinfo] when pinfo.HasSetter && not pinfo.IsIndexer && not pinfo.SetterIsInitOnly -> let pminfo = pinfo.SetterMethod let pminst = freshenMethInfo m pminfo Choice1Of2(AssignedItemSetter(id, AssignedPropSetter(pinfo, pminfo, pminst), e)) From 8f17fcb38e1608f4472c9c09163027cc2ab02ad7 Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 15 May 2021 11:46:47 +0200 Subject: [PATCH 5/8] remove the IsExternalInit attribute, we just need to do string comparison of the `modreq` once in the codebase for now --- src/fsharp/TcGlobals.fs | 5 ++--- src/fsharp/infos.fs | 10 +++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 084b044a887..dd4bf222c0d 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -1178,9 +1178,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val attrib_OutAttribute = findSysAttrib "System.Runtime.InteropServices.OutAttribute" member val attrib_OptionalAttribute = tryFindSysAttrib "System.Runtime.InteropServices.OptionalAttribute" member val attrib_DefaultParameterValueAttribute = tryFindSysAttrib "System.Runtime.InteropServices.DefaultParameterValueAttribute" - member val attrib_ThreadStaticAttribute = tryFindSysAttrib "System.ThreadStaticAttribute" - member val attrib_SpecialNameAttribute = tryFindSysAttrib "System.Runtime.CompilerServices.SpecialNameAttribute" - member val attrib_IsExternalInit = tryFindSysAttrib "System.Runtime.CompilerServices.IsExternalInit" + member val attrib_ThreadStaticAttribute = tryFindSysAttrib "System.ThreadStaticAttribute" + member val attrib_SpecialNameAttribute = tryFindSysAttrib "System.Runtime.CompilerServices.SpecialNameAttribute" member val attrib_VolatileFieldAttribute = mk_MFCore_attrib "VolatileFieldAttribute" member val attrib_ContextStaticAttribute = tryFindSysAttrib "System.ContextStaticAttribute" member val attrib_FlagsAttribute = findSysAttrib "System.FlagsAttribute" diff --git a/src/fsharp/infos.fs b/src/fsharp/infos.fs index 788b2b3070f..be5b6e9927c 100755 --- a/src/fsharp/infos.fs +++ b/src/fsharp/infos.fs @@ -1891,13 +1891,9 @@ type ILPropInfo = member x.HasSetter = Option.isSome x.RawMetadata.SetMethod member x.SetterIsInitOnly = - // todo: move to a constant once we understand why the attribute from TcGlobals is None and string based check is the alternate way - let attributeName = "System.Runtime.CompilerServices.IsExternalInit" - match x.SetterMethod.ILMethodRef.ReturnType, x.TcGlobals.attrib_IsExternalInit with - | ILType.Modified(modifierClass=modifierClass), None when modifierClass.BasicQualifiedName = attributeName -> - true - | ILType.Modified(modifierClass=modifierClass), Some isExternalInitAttribute -> - modifierClass = isExternalInitAttribute.TypeRef + match x.SetterMethod.ILMethodRef.ReturnType with + | ILType.Modified(modifierClass=modifierClass) -> + modifierClass.BasicQualifiedName = "System.Runtime.CompilerServices.IsExternalInit" | _ -> false /// Indicates if the IL property is static From 20e8bea80dfe242e0b713a43674cb87301230964 Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 15 May 2021 11:47:42 +0200 Subject: [PATCH 6/8] add cases for method calls to the test --- tests/fsharp/tests.fs | 2 +- .../typecheck/init-property/niceinit.bsl | 12 +++++++++- .../typecheck/init-property/niceinit.cs | 4 ++-- .../typecheck/init-property/niceinit.fsx | 22 ++++++++++++++++++- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index e1f87b6e248..634b059fd60 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -1855,7 +1855,7 @@ module CoreTests = let ``play nice with init properties and assignment syntax``() = let cfg = testConfig "typecheck/init-property" csc cfg "%s /target:library /out:niceinit.dll" cfg.csc_flags ["niceinit.cs"] - singleNegTest cfg "niceinit.fsx" + singleNegTest cfg "niceinit" #endif diff --git a/tests/fsharp/typecheck/init-property/niceinit.bsl b/tests/fsharp/typecheck/init-property/niceinit.bsl index d4e627834cc..4ed4e6b0418 100644 --- a/tests/fsharp/typecheck/init-property/niceinit.bsl +++ b/tests/fsharp/typecheck/init-property/niceinit.bsl @@ -1,2 +1,12 @@ -(7,1): error FS0810: Property 'Val' cannot be set +niceinit.fsx(3,25,3,28): typecheck error FS0495: The object constructor 'NiceInit' has no argument or settable return property 'Val'. The required signature is NiceInit() : NiceInit. + +niceinit.fsx(6,1,6,14): typecheck error FS0810: Property 'Val' cannot be set + +niceinit.fsx(13,47,13,50): typecheck error FS0495: The member or object constructor 'mkInlineNiceInit' has no argument or settable return property 'Val'. The required signature is static member StraightNewFactory.mkInlineNiceInit : unit -> NiceInit. + +niceinit.fsx(14,41,14,44): typecheck error FS0495: The member or object constructor 'mkNiceInit' has no argument or settable return property 'Val'. The required signature is static member StraightNewFactory.mkNiceInit : unit -> NiceInit. + +niceinit.fsx(26,73,26,76): typecheck error FS0495: The member or object constructor 'mkInlineNiceInit' has no argument or settable return property 'Val'. The required signature is static member IntermediateVariableWithInterleavedOpFactory.mkInlineNiceInit : unit -> NiceInit. + +niceinit.fsx(27,67,27,70): typecheck error FS0495: The member or object constructor 'mkNiceInit' has no argument or settable return property 'Val'. The required signature is static member IntermediateVariableWithInterleavedOpFactory.mkNiceInit : unit -> NiceInit. diff --git a/tests/fsharp/typecheck/init-property/niceinit.cs b/tests/fsharp/typecheck/init-property/niceinit.cs index c19560fe450..2694c16b09a 100644 --- a/tests/fsharp/typecheck/init-property/niceinit.cs +++ b/tests/fsharp/typecheck/init-property/niceinit.cs @@ -1,7 +1,7 @@ -/*namespace System.Runtime.CompilerServices{ +namespace System.Runtime.CompilerServices{ internal class IsExternalInit {} -}*/ +} public class NiceInit { public NiceInit() {} diff --git a/tests/fsharp/typecheck/init-property/niceinit.fsx b/tests/fsharp/typecheck/init-property/niceinit.fsx index f104e01ba84..9bf33bb3860 100644 --- a/tests/fsharp/typecheck/init-property/niceinit.fsx +++ b/tests/fsharp/typecheck/init-property/niceinit.fsx @@ -4,4 +4,24 @@ let niceinit = NiceInit(Val = 1);; let niceinit2 = NiceInit();; niceinit2.Val <- 5;; -niceinit2.set_Val 5;; \ No newline at end of file +niceinit2.set_Val 5;; + +type StraightNewFactory = + static member inline mkInlineNiceInit () = NiceInit() + static member mkNiceInit () = NiceInit() +;; +let ni1 = StraightNewFactory.mkInlineNiceInit(Val=1);; +let ni2 = StraightNewFactory.mkNiceInit(Val=1);; + +type IntermediateVariableWithInterleavedOpFactory = + static member inline mkInlineNiceInit () = + let n = NiceInit() + printfn "inline nice init" + n + static member mkNiceInit () = + let n = NiceInit() + printfn "nice init" + n +;; +let ni3 = IntermediateVariableWithInterleavedOpFactory.mkInlineNiceInit(Val=1);; +let ni4 = IntermediateVariableWithInterleavedOpFactory.mkNiceInit(Val=1);; \ No newline at end of file From fa7d28fc9a5d5bb8d5b21de58aea6d34bd2bd414 Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 15 May 2021 11:48:21 +0200 Subject: [PATCH 7/8] follow the instructions to update csc.exe & vb.exe compilers in the test suite --- eng/Versions.props | 2 +- tests/FSharp.Test.Utilities/TestFramework.fs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index dfab66e55a9..be0e3114f96 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -188,7 +188,7 @@ 4.3.0.0 1.0.30 8.0.0 - 2.7.0 + 3.9.0 3.1.0 5.0.0-preview.7.20364.11 5.0.0-preview.7.20364.11 diff --git a/tests/FSharp.Test.Utilities/TestFramework.fs b/tests/FSharp.Test.Utilities/TestFramework.fs index d2a3e812c77..2523000fb03 100644 --- a/tests/FSharp.Test.Utilities/TestFramework.fs +++ b/tests/FSharp.Test.Utilities/TestFramework.fs @@ -285,8 +285,8 @@ let config configurationName envVars = let packagesDir = getPackagesDir () let requirePackage = requireFile packagesDir let requireArtifact = requireFile artifactsBinPath - let CSC = requirePackage ("Microsoft.Net.Compilers" ++ "2.7.0" ++ "tools" ++ "csc.exe") - let VBC = requirePackage ("Microsoft.Net.Compilers" ++ "2.7.0" ++ "tools" ++ "vbc.exe") + let CSC = requirePackage ("Microsoft.Net.Compilers" ++ "3.9.0" ++ "tools" ++ "csc.exe") + let VBC = requirePackage ("Microsoft.Net.Compilers" ++ "3.9.0" ++ "tools" ++ "vbc.exe") let ILDASM_EXE = if operatingSystem = "win" then "ildasm.exe" else "ildasm" let ILDASM = requirePackage (("runtime." + operatingSystem + "-" + architectureMoniker + ".Microsoft.NETCore.ILDAsm") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ (operatingSystem + "-" + architectureMoniker) ++ "native" ++ ILDASM_EXE) let ILASM_EXE = if operatingSystem = "win" then "ilasm.exe" else "ilasm" From 5bcccd0fa331f7fc877c82366980a0562b8cb213 Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Mon, 17 May 2021 23:40:05 +0200 Subject: [PATCH 8/8] adjust csc version in remaining location --- eng/Build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 9a97f5a93fb..00328d5c63d 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -497,7 +497,7 @@ try { Create-Directory $resultsRoot UpdatePath $env:HOSTED_COMPILER = 1 - $env:CSC_PIPE = "$nugetPackages\Microsoft.Net.Compilers\2.7.0\tools\csc.exe" + $env:CSC_PIPE = "$nugetPackages\Microsoft.Net.Compilers\3.9.0\tools\csc.exe" $env:FSCOREDLLPATH = "$ArtifactsDir\bin\fsc\$configuration\net472\FSharp.Core.dll" $env:LINK_EXE = "$RepoRoot\tests\fsharpqa\testenv\bin\link\link.exe" $env:OSARCH = $env:PROCESSOR_ARCHITECTURE