From 7026f1bad2dc93216fa47a8e10b0746b88a421e6 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 27 Oct 2016 19:26:19 -0700 Subject: [PATCH 1/2] Add typeforwarders to portable and coreclr fsharp.core.dll. Also update fscheck to Version: 2.6.2 --- packages.config | 2 +- src/FSharpSource.targets | 4 +- src/fsharp/CompileOps.fs | 5 +- src/fsharp/CompileOps.fsi | 3 +- src/fsharp/CompileOptions.fs | 4 ++ src/fsharp/FSharp.Core/FSharp.Core.fsproj | 16 +++--- src/fsharp/fsc.fs | 62 +++++++++++++---------- 7 files changed, 55 insertions(+), 41 deletions(-) diff --git a/packages.config b/packages.config index 6e0a76090e8..6d57474f189 100644 --- a/packages.config +++ b/packages.config @@ -19,7 +19,7 @@ - + diff --git a/src/FSharpSource.targets b/src/FSharpSource.targets index 74cc14916f5..262dc87bac2 100644 --- a/src/FSharpSource.targets +++ b/src/FSharpSource.targets @@ -106,8 +106,8 @@ 3.5.0.0 $(FSharpSourcesRoot)\..\packages\NUnit.$(NUnitVersion)\lib\net45 $(FSharpSourcesRoot)\..\packages\NUnit.ConsoleRunner\$(NUnitVersion)\tools\ - 2.0.3 - 2.0.3.0 + 2.6.2 + 2.6.2.0 $(FSharpSourcesRoot)\..\packages\FsCheck.$(FsCheckVersion)\lib\ diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 955ba969456..e329ba1fc91 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2002,6 +2002,7 @@ type TcConfigBuilder = mutable compilingFslib: bool mutable compilingFslib20: string option mutable compilingFslib40: bool + mutable compilingFslibNoBigInt: bool mutable useIncrementalBuilder: bool mutable includes: string list mutable implicitOpens: string list @@ -2172,6 +2173,7 @@ type TcConfigBuilder = compilingFslib=false compilingFslib20=None compilingFslib40=false + compilingFslibNoBigInt=false useIncrementalBuilder=false useFsiAuxLib=false implicitOpens=[] @@ -2666,6 +2668,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) = member x.compilingFslib = data.compilingFslib member x.compilingFslib20 = data.compilingFslib20 member x.compilingFslib40 = data.compilingFslib40 + member x.compilingFslibNoBigInt = data.compilingFslibNoBigInt member x.useIncrementalBuilder = data.useIncrementalBuilder member x.includes = data.includes member x.implicitOpens = data.implicitOpens @@ -5172,7 +5175,7 @@ let GetInitialTcState(m,ccuName,tcConfig:TcConfig,tcGlobals,tcImports:TcImports, // OK, is this is the FSharp.Core CCU then fix it up. if tcConfig.compilingFslib then tcGlobals.fslibCcu.Fixup(ccu) - + let rootSigs = Zmap.empty qnameOrder let rootImpls = Zset.empty qnameOrder let allSigModulTyp = NewEmptyModuleOrNamespaceType Namespace diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 96d8998b259..3028f5b5bfb 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -219,7 +219,6 @@ type VersionFlag = member GetVersionInfo : implicitIncludeDir:string -> ILVersionInfo member GetVersionString : implicitIncludeDir:string -> string - type TcConfigBuilder = { mutable primaryAssembly : PrimaryAssembly mutable autoResolveOpenDirectivesToDlls: bool @@ -232,6 +231,7 @@ type TcConfigBuilder = mutable compilingFslib: bool mutable compilingFslib20: string option mutable compilingFslib40: bool + mutable compilingFslibNoBigInt: bool mutable useIncrementalBuilder: bool mutable includes: string list mutable implicitOpens: string list @@ -396,6 +396,7 @@ type TcConfig = member compilingFslib: bool member compilingFslib20: string option member compilingFslib40: bool + member compilingFslibNoBigInt: bool member useIncrementalBuilder: bool member includes: string list member implicitOpens: string list diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index ead3f4e381f..95314a02319 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -900,6 +900,9 @@ let compilingFsLib20Flag (tcConfigB : TcConfigBuilder) = CompilerOption("compiling-fslib-20", tagNone, OptionString (fun s -> tcConfigB.compilingFslib20 <- Some s ), Some(InternalCommandLineOption("--compiling-fslib-20", rangeCmdArgs)), None) let compilingFsLib40Flag (tcConfigB : TcConfigBuilder) = CompilerOption("compiling-fslib-40", tagNone, OptionUnit (fun () -> tcConfigB.compilingFslib40 <- true ), Some(InternalCommandLineOption("--compiling-fslib-40", rangeCmdArgs)), None) +let compilingFsLibNoBigIntFlag (tcConfigB : TcConfigBuilder) = + CompilerOption("compiling-fslib-nobigint", tagNone, OptionUnit (fun () -> tcConfigB.compilingFslibNoBigInt <- true ), Some(InternalCommandLineOption("--compiling-fslib-nobigint", rangeCmdArgs)), None) + let mlKeywordsFlag = CompilerOption("ml-keywords", tagNone, OptionUnit (fun () -> ()), Some(DeprecatedCommandLineOptionNoDescription("--ml-keywords", rangeCmdArgs)), None) @@ -926,6 +929,7 @@ let deprecatedFlagsFsc tcConfigB = (compilingFsLibFlag tcConfigB) (compilingFsLib20Flag tcConfigB) (compilingFsLib40Flag tcConfigB) + (compilingFsLibNoBigIntFlag tcConfigB) CompilerOption("version", tagString, OptionString (fun s -> tcConfigB.version <- VersionString s), Some(DeprecatedCommandLineOptionNoDescription("--version", rangeCmdArgs)), None) // "--clr-mscorlib", OptionString (fun s -> warning(Some(DeprecatedCommandLineOptionNoDescription("--clr-mscorlib", rangeCmdArgs))) tcConfigB.Build.mscorlib_assembly_name <- s), "\n\tThe name of mscorlib on the target CLR" CompilerOption("local-optimize", tagNone, OptionUnit (fun _ -> tcConfigB.optSettings <- { tcConfigB.optSettings with localOptUser = Some true }), Some(DeprecatedCommandLineOptionNoDescription("--local-optimize", rangeCmdArgs)), None) diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index 653358df643..9029b6a4fb9 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -16,20 +16,20 @@ true true true - $(OtherFlags) --warnon:1182 --compiling-fslib --maxerrors:20 --extraoptimizationloops:1 - $(OtherFlags) --compiling-fslib-20:"$(SystemRoot)\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll" - $(OtherFlags) --compiling-fslib-40 - $(OtherFlags) --targetprofile:netcore - $(OtherFlags) --targetprofile:netcore - $(OtherFlags) --targetprofile:netcore - $(OtherFlags) --targetprofile:netcore + $(OtherFlags) --warnon:1182 --compiling-fslib --maxerrors:20 --extraoptimizationloops:1 + $(OtherFlags) --compiling-fslib-20:"$(SystemRoot)\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll" + $(OtherFlags) --compiling-fslib-40 + $(OtherFlags) --compiling-fslib-40 --targetprofile:netcore + $(OtherFlags) --compiling-fslib-40 --targetprofile:netcore + $(OtherFlags) --compiling-fslib-40 --compiling-fslib-nobigint --targetprofile:netcore + $(OtherFlags) --compiling-fslib-40 --compiling-fslib-nobigint --targetprofile:netcore $(FSharpSourcesRoot)\..\loc\lcl\{Lang}\$(AssemblyName).dll.lcl $(FSharpSourcesRoot)\..\loc\lci\$(AssemblyName).dll.lci false - false + false diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index e9da539b7bf..a14634103d3 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -933,29 +933,29 @@ let injectedCompatTypes = "System.Collections.IStructuralEquatable" ] let typesForwardedToMscorlib = - set [ "System.AggregateException" - "System.Threading.CancellationTokenRegistration" - "System.Threading.CancellationToken" - "System.Threading.CancellationTokenSource" - "System.Lazy`1" - "System.IObservable`1" - "System.IObserver`1" - ] + set [ "System.AggregateException" + "System.Threading.CancellationTokenRegistration" + "System.Threading.CancellationToken" + "System.Threading.CancellationTokenSource" + "System.Lazy`1" + "System.IObservable`1" + "System.IObserver`1" ] + let typesForwardedToSystemNumerics = - set [ "System.Numerics.BigInteger" ] - + set [ "System.Numerics.BigInteger" ] + let createMscorlibExportList tcGlobals = - // We want to write forwarders out for all injected types except for System.ITuple, which is internal - // Forwarding System.ITuple will cause FxCop failures on 4.0 - Set.union (Set.filter (fun t -> t <> "System.ITuple") injectedCompatTypes) typesForwardedToMscorlib |> - Seq.map (fun t -> - { ScopeRef = tcGlobals.sysCcu.ILScopeRef - Name = t - IsForwarder = true - Access = ILTypeDefAccess.Public - Nested = mkILNestedExportedTypes List.empty - CustomAttrs = mkILCustomAttrs List.empty }) |> - Seq.toList + // We want to write forwarders out for all injected types except for System.ITuple, which is internal + // Forwarding System.ITuple will cause FxCop failures on 4.0 + Set.union (Set.filter (fun t -> t <> "System.ITuple") injectedCompatTypes) typesForwardedToMscorlib |> + Seq.map (fun t -> + { ScopeRef = tcGlobals.sysCcu.ILScopeRef + Name = t + IsForwarder = true + Access = ILTypeDefAccess.Public + Nested = mkILNestedExportedTypes List.empty + CustomAttrs = mkILCustomAttrs List.empty }) |> + Seq.toList let createSystemNumericsExportList tcGlobals = let sysAssemblyRef = tcGlobals.sysCcu.ILScopeRef.AssemblyRef @@ -969,7 +969,7 @@ let createSystemNumericsExportList tcGlobals = Nested = mkILNestedExportedTypes List.empty CustomAttrs = mkILCustomAttrs List.empty }) |> Seq.toList - + module MainModuleBuilder = let fileVersion warn findStringAttr (assemblyVersion: ILVersionInfo) = @@ -1020,20 +1020,26 @@ module MainModuleBuilder = let hashAlg = AttributeHelpers.TryFindIntAttribute tcGlobals "System.Reflection.AssemblyAlgorithmIdAttribute" topAttrs.assemblyAttrs let locale = AttributeHelpers.TryFindStringAttribute tcGlobals "System.Reflection.AssemblyCultureAttribute" topAttrs.assemblyAttrs let flags = match AttributeHelpers.TryFindIntAttribute tcGlobals "System.Reflection.AssemblyFlagsAttribute" topAttrs.assemblyAttrs with | Some(f) -> f | _ -> 0x0 - + // You're only allowed to set a locale if the assembly is a library if (locale <> None && locale.Value <> "") && tcConfig.target <> Dll then error(Error(FSComp.SR.fscAssemblyCultureAttributeError(),rangeCmdArgs)) - + // Add the type forwarders to any .NET DLL post-.NET-2.0, to give binary compatibility - let exportedTypesList = if (tcConfig.compilingFslib && tcConfig.compilingFslib40) then (List.append (createMscorlibExportList tcGlobals) (createSystemNumericsExportList tcGlobals)) else [] - + let exportedTypesList = + if (tcConfig.compilingFslib && tcConfig.compilingFslib40) then + (List.append (createMscorlibExportList tcGlobals) + (if tcConfig.compilingFslibNoBigInt then [] else (createSystemNumericsExportList tcGlobals)) + ) + else + [] + mkILSimpleModule assemblyName (GetGeneratedILModuleName tcConfig.target assemblyName) (tcConfig.target = Dll || tcConfig.target = Module) tcConfig.subsystemVersion tcConfig.useHighEntropyVA ilTypeDefs hashAlg locale flags (mkILExportedTypes exportedTypesList) metadataVersion let disableJitOptimizations = not (tcConfig.optSettings.jitOpt()) - + let tcVersion = tcConfig.version.GetVersionInfo(tcConfig.implicitIncludeDir) - + let reflectedDefinitionAttrs, reflectedDefinitionResources = codegenResults.quotationResourceInfo |> List.map (fun (referencedTypeDefs, reflectedDefinitionBytes) -> From 5cf76ca95374c5c8a29055c0ae958d0aa3c5d944 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 27 Oct 2016 22:43:56 -0700 Subject: [PATCH 2/2] Revert fscheck 2.6.2 because it hangs --- packages.config | 2 +- src/FSharpSource.targets | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages.config b/packages.config index 6d57474f189..6e0a76090e8 100644 --- a/packages.config +++ b/packages.config @@ -19,7 +19,7 @@ - + diff --git a/src/FSharpSource.targets b/src/FSharpSource.targets index 262dc87bac2..74cc14916f5 100644 --- a/src/FSharpSource.targets +++ b/src/FSharpSource.targets @@ -106,8 +106,8 @@ 3.5.0.0 $(FSharpSourcesRoot)\..\packages\NUnit.$(NUnitVersion)\lib\net45 $(FSharpSourcesRoot)\..\packages\NUnit.ConsoleRunner\$(NUnitVersion)\tools\ - 2.6.2 - 2.6.2.0 + 2.0.3 + 2.0.3.0 $(FSharpSourcesRoot)\..\packages\FsCheck.$(FsCheckVersion)\lib\