Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tell the compiler to emit the correct reference to system.runtime.numerics for non mscorlib builds #1688

Merged
merged 1 commit into from
Oct 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4570,7 +4570,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
// OK, now we have both mscorlib.dll and FSharp.Core.dll we can create TcGlobals
let tcGlobals = mkTcGlobals(tcConfig.compilingFslib,sysCcu.FSharpViewOfMetadata,ilGlobals,fslibCcu,
tcConfig.implicitIncludeDir,tcConfig.mlCompatibility,using40environment,
tcConfig.isInteractive,getTypeCcu, tcConfig.emitDebugInfoInQuotations)
tcConfig.isInteractive,getTypeCcu, tcConfig.emitDebugInfoInQuotations, (tcConfig.primaryAssembly.Name = "mscorlib") )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: In a var?

#if DEBUG
// the global_g reference cell is used only for debug printing
Expand Down
4 changes: 3 additions & 1 deletion src/fsharp/TcGlobals.fs
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ type public TcGlobals =
splice_raw_expr_vref : ValRef
new_format_vref : ValRef
mkSysTyconRef : string list -> string -> TyconRef
usesMscorlib : bool

// A list of types that are explicitly suppressed from the F# intellisense
// Note that the suppression checks for the precise name of the type
Expand All @@ -572,7 +573,7 @@ let global_g = ref (None : TcGlobals option)
#endif

let mkTcGlobals (compilingFslib,sysCcu,ilg,fslibCcu,directoryToResolveRelativePaths,mlCompatibility,
using40environment,isInteractive,getTypeCcu, emitDebugInfoInQuotations) =
using40environment,isInteractive,getTypeCcu, emitDebugInfoInQuotations, usesMscorlib) =

let vara = NewRigidTypar "a" envRange
let varb = NewRigidTypar "b" envRange
Expand Down Expand Up @@ -1545,6 +1546,7 @@ let mkTcGlobals (compilingFslib,sysCcu,ilg,fslibCcu,directoryToResolveRelativePa
suppressed_types = suppressed_types
isInteractive=isInteractive
mkSysTyconRef=mkSysTyconRef
usesMscorlib = usesMscorlib
}

let public mkMscorlibAttrib g nm =
Expand Down
6 changes: 5 additions & 1 deletion src/fsharp/fsc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,11 @@ let createMscorlibExportList tcGlobals =

let createSystemNumericsExportList tcGlobals =
let sysAssemblyRef = tcGlobals.sysCcu.ILScopeRef.AssemblyRef
let systemNumericsAssemblyRef = ILAssemblyRef.Create("System.Numerics", sysAssemblyRef.Hash, sysAssemblyRef.PublicKey, sysAssemblyRef.Retargetable, sysAssemblyRef.Version, sysAssemblyRef.Locale)
let systemNumericsAssemblyRef =
let refNumericsDllName =
if tcGlobals.usesMscorlib then "System.Numerics"
else "System.Runtime.Numerics"
ILAssemblyRef.Create(refNumericsDllName, sysAssemblyRef.Hash, sysAssemblyRef.PublicKey, sysAssemblyRef.Retargetable, sysAssemblyRef.Version, sysAssemblyRef.Locale)
typesForwardedToSystemNumerics |>
Seq.map (fun t ->
{ ScopeRef = ILScopeRef.Assembly(systemNumericsAssemblyRef)
Expand Down