diff --git a/FSharp.Profiles.props b/FSharp.Profiles.props index 534ba96c04f..b0c4c500b8a 100644 --- a/FSharp.Profiles.props +++ b/FSharp.Profiles.props @@ -1,6 +1,9 @@ + + BUILDING_WITH_LKG;$(DefineConstants) + $(DefineConstants);CROSS_PLATFORM_COMPILER diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index a1ba7ab156d..8d705695853 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -11,8 +11,7 @@ $(RepoRoot)src $(ArtifactsDir)\SymStore - $(ArtifactsDir)\Bootstrap - $(ArtifactsDir)/fsc/Proto/netcoreapp2.1 + $(ArtifactsDir)\Bootstrap 4.4.0 1182;0025;$(WarningsAsErrors) @@ -92,14 +91,15 @@ fs false true + 4.6.2 - $(ProtoOutputPath)\Microsoft.FSharp.Targets - $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props - $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets - $(ProtoOutputPath)\Microsoft.FSharp.Overrides.NetSdk.targets + $(ProtoOutputPath)\fsc\Microsoft.FSharp.Targets + $(ProtoOutputPath)\fsc\Microsoft.FSharp.NetSdk.props + $(ProtoOutputPath)\fsc\Microsoft.FSharp.NetSdk.targets + $(ProtoOutputPath)\fsc\Microsoft.FSharp.Overrides.NetSdk.targets diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index 7c00805dda5..8a7a832a43e 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -32,9 +32,9 @@ - <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net472 - <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netcoreapp2.1 - <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\FSharp.Build\$(Configuration)\$(_FSharpBuildTargetFramework) + <_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'!='Core'">net472 + <_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'=='Core'">netcoreapp2.1 + <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\$(_FSharpBuildTargetFramework) $(_FSharpBuildBinPath)\FSharp.Build.dll diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 6b85aaef9cf..158662e7a47 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -67,6 +67,7 @@ function Print-Usage() { Write-Host "" Write-Host "Actions:" Write-Host " -restore Restore packages (short: -r)" + Write-Host " -norestore Don't restore packages" Write-Host " -build Build main solution (short: -b)" Write-Host " -rebuild Rebuild main solution" Write-Host " -pack Build NuGet packages, VS insertion manifests and installer" @@ -104,6 +105,7 @@ function Process-Arguments() { Print-Usage exit 0 } + $script:nodeReuse = $False; if ($testAll) { $script:testDesktop = $True @@ -130,7 +132,7 @@ function Process-Arguments() { } function Update-Arguments() { - if (-Not (Test-Path "$ArtifactsDir\Bootstrap\fsc.exe")) { + if (-Not (Test-Path "$ArtifactsDir\Bootstrap\fsc\fsc.exe")) { $script:bootstrap = $True } } @@ -164,7 +166,6 @@ function BuildSolution() { /p:Publish=$publish ` /p:ContinuousIntegrationBuild=$ci ` /p:OfficialBuildId=$officialBuildId ` - /p:BootstrapBuildPath=$bootstrapDir ` /p:QuietRestore=$quietRestore ` /p:QuietRestoreBinaryLog=$binaryLog ` /p:TestTargetFrameworks=$testTargetFrameworks ` @@ -198,7 +199,7 @@ function UpdatePath() { } function VerifyAssemblyVersions() { - $fsiPath = Join-Path $ArtifactsDir "bin\fsi\Proto\net472\fsi.exe" + $fsiPath = Join-Path $ArtifactsDir "bin\fsi\Proto\net472\publish\fsi.exe" # Only verify versions on CI or official build if ($ci -or $official) { diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index d1e5dd85d55..335379b2f73 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -178,7 +178,7 @@ function Get-PackageDir([string]$name, [string]$version = "") { return $p } -function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string]$logFileName = "", [switch]$parallel = $true, [switch]$summary = $true, [switch]$warnAsError = $true, [string]$configuration = $script:configuration) { +function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string]$logFileName = "", [switch]$parallel = $true, [switch]$summary = $true, [switch]$warnAsError = $true, [string]$configuration = $script:configuration, [string]$verbosity = $script:verbosity) { # Because we override the C#/VB toolset to build against our LKG package, it is important # that we do not reuse MSBuild nodes from other jobs/builds on the machine. Otherwise, # we'll run into issues such as https://github.com/dotnet/roslyn/issues/6211. @@ -216,10 +216,6 @@ function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string] $args += " /p:ContinuousIntegrationBuild=true" } - if ($bootstrapDir -ne "") { - $args += " /p:BootstrapBuildPath=$bootstrapDir" - } - $args += " $buildArgs" $args += " $projectFilePath" $args += " $properties" @@ -241,15 +237,15 @@ function Make-BootstrapBuild() { Create-Directory $dir # prepare FsLex and Fsyacc - Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Build" -logFileName "BuildTools" -configuration $bootstrapConfiguration - Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.1\*" -Destination $dir - Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.1\*" -Destination $dir + Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Publish" -logFileName "BuildTools" -configuration $bootstrapConfiguration + Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fslex" -Force -Recurse + Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fsyacc" -Force -Recurse # prepare compiler $projectPath = "$RepoRoot\proto.proj" - Run-MSBuild $projectPath "/restore /t:Build" -logFileName "Bootstrap" -configuration $bootstrapConfiguration - Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm\*" -Destination $dir - Copy-Item "$ArtifactsDir\bin\fsi\$bootstrapConfiguration\$bootstrapTfm\*" -Destination $dir + Run-MSBuild $projectPath "/restore /t:Publish" -logFileName "Bootstrap" -configuration $bootstrapConfiguration + Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsc" -Force -Recurse + Copy-Item "$ArtifactsDir\bin\fsi\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsi" -Force -Recurse return $dir } diff --git a/eng/build.sh b/eng/build.sh index 58b283ff39b..0a7549c96f2 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -13,7 +13,9 @@ usage() echo " --binaryLog Create MSBuild binary log (short: -bl)" echo "" echo "Actions:" + echo " --bootstrap Force the build of the bootstrap compiler" echo " --restore Restore projects required to build (short: -r)" + echo " --norestore Don't restore projects required to build" echo " --build Build all projects (short: -b)" echo " --rebuild Rebuild all projects" echo " --pack Build nuget packages" @@ -54,6 +56,7 @@ test_core_clr=false configuration="Debug" verbosity='minimal' binary_log=false +force_bootstrap=false ci=false skip_analyzers=false prepare_machine=false @@ -88,6 +91,9 @@ while [[ $# > 0 ]]; do --binarylog|-bl) binary_log=true ;; + --bootstrap) + force_bootstrap=true + ;; --restore|-r) restore=true ;; @@ -205,17 +211,33 @@ function BuildSolution { quiet_restore=true fi + # Node reuse fails because multiple different versions of FSharp.Build.dll get loaded into MSBuild nodes + node_reuse=false + # build bootstrap tools bootstrap_config=Proto - MSBuild "$repo_root/src/buildtools/buildtools.proj" \ - /restore \ - /p:Configuration=$bootstrap_config \ - /t:Build - bootstrap_dir=$artifacts_dir/Bootstrap - mkdir -p "$bootstrap_dir" - cp $artifacts_dir/bin/fslex/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir - cp $artifacts_dir/bin/fsyacc/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir + if [[ "$force_bootstrap" == true ]]; then + rm -fr $bootstrap_dir + fi + if [ ! -f "$bootstrap_dir/fslex.dll" ]; then + MSBuild "$repo_root/src/buildtools/buildtools.proj" \ + /restore \ + /p:Configuration=$bootstrap_config \ + /t:Publish + + mkdir -p "$bootstrap_dir" + cp -pr $artifacts_dir/bin/fslex/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fslex + cp -pr $artifacts_dir/bin/fsyacc/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fsyacc + fi + if [ ! -f "$bootstrap_dir/fsc.exe" ]; then + MSBuild "$repo_root/proto.proj" \ + /restore \ + /p:Configuration=$bootstrap_config \ + /t:Publish + + cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fsc + fi # do real build MSBuild $toolset_build_proj \ diff --git a/fcs/Directory.Build.props b/fcs/Directory.Build.props index 50e4c3e67b5..f901d93281c 100644 --- a/fcs/Directory.Build.props +++ b/fcs/Directory.Build.props @@ -31,7 +31,6 @@ $(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools fsi.exe - $(ArtifactsBinDir)\FSharp.Build\Proto\net472 4.6.2 net461 diff --git a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index 1f7ffbf6d55..9019c4f017a 100644 --- a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -10,6 +10,7 @@ false true true + $(DefineConstants);USES_FSHARP_CORE_45_PACKAGE $(DefineConstants);FX_NO_RUNTIMEENVIRONMENT diff --git a/fcs/FSharp.Compiler.Service/AssemblyInfo.fs b/fcs/FSharp.Compiler.Service/AssemblyInfo.fs index 90521fefd5a..20b5b909304 100644 --- a/fcs/FSharp.Compiler.Service/AssemblyInfo.fs +++ b/fcs/FSharp.Compiler.Service/AssemblyInfo.fs @@ -52,11 +52,4 @@ open System.Runtime.InteropServices [] [] -// Until dotnet sdk can version assemblies, use this -#if BUILD_FROM_SOURCE -[] -[] -[] -#endif - do() \ No newline at end of file diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index ef30acc7efc..a13a5d5a27c 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -4,8 +4,8 @@ $(FcsTargetNetFxFramework);netstandard2.0 true - $(DefineConstants);COMPILER_SERVICE_AS_DLL $(DefineConstants);COMPILER + $(DefineConstants);BUILD_FROM_SOURCE $(DefineConstants);ENABLE_MONO_SUPPORT $(DefineConstants);NO_STRONG_NAMES $(TargetFramework)\ @@ -39,7 +39,7 @@ $(DefineConstants);FX_RESHAPED_REFEMIT - + AssemblyInfo/AssemblyInfo.fs diff --git a/proto.proj b/proto.proj index 84103f6fdf8..b0ee288977f 100644 --- a/proto.proj +++ b/proto.proj @@ -28,6 +28,10 @@ + + + + diff --git a/src/absil/bytes.fs b/src/absil/bytes.fs index a272b99a454..b0749e48713 100644 --- a/src/absil/bytes.fs +++ b/src/absil/bytes.fs @@ -36,6 +36,9 @@ type internal ByteStream = { bytes: byte[] mutable pos: int max: int } + + member b.IsEOF = (b.pos >= b.max) + member b.ReadByte() = if b.pos >= b.max then failwith "end of stream" let res = b.bytes.[b.pos] @@ -56,11 +59,6 @@ type internal ByteStream = res member b.Position = b.pos -#if LAZY_UNPICKLE - member b.CloneAndSeek = { bytes=b.bytes; pos=pos; max=b.max } - member b.Skip = b.pos <- b.pos + n -#endif - type internal ByteBuffer = { mutable bbArray: byte[] diff --git a/src/absil/bytes.fsi b/src/absil/bytes.fsi index c611e80c776..58fbb2ab280 100644 --- a/src/absil/bytes.fsi +++ b/src/absil/bytes.fsi @@ -43,13 +43,10 @@ type internal ByteBuffer = [] type internal ByteStream = + member IsEOF : bool member ReadByte : unit -> byte member ReadBytes : int -> byte[] member ReadUtf8String : int -> string member Position : int static member FromBytes : byte[] * start:int * length:int -> ByteStream -#if LAZY_UNPICKLE - member CloneAndSeek : int -> ByteStream - member Skip : int -> unit -#endif diff --git a/src/absil/illib.fs b/src/absil/illib.fs index fea0fd92a97..9218627c74f 100644 --- a/src/absil/illib.fs +++ b/src/absil/illib.fs @@ -12,10 +12,6 @@ open System.Reflection open System.Threading open System.Runtime.CompilerServices -#if FX_RESHAPED_REFLECTION -open Microsoft.FSharp.Core.ReflectionAdapters -#endif - // Logical shift right treating int32 as unsigned integer. // Code that uses this should probably be adjusted to use unsigned integer types. let (>>>&) (x: int32) (n: int32) = int32 (uint32 x >>> n) @@ -24,6 +20,11 @@ let notlazy v = Lazy<_>.CreateFromValue v let inline isNil l = List.isEmpty l +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE +let inline (|NonNull|) x = match x with null -> raise (NullReferenceException()) | v -> v +let inline nonNull<'T> (x: 'T) = x +#endif + /// Returns true if the list has less than 2 elements. Otherwise false. let inline isNilOrSingleton l = match l with @@ -38,9 +39,6 @@ let inline isSingleton l = | _ -> false let inline isNonNull x = not (isNull x) - -let inline nonNull msg x = if isNull x then failwith ("null: " + msg) else x - let inline (===) x y = LanguagePrimitives.PhysicalEquality x y /// Per the docs the threshold for the Large Object Heap is 85000 bytes: https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/large-object-heap#how-an-object-ends-up-on-the-large-object-heap-and-how-gc-handles-them @@ -70,14 +68,17 @@ let reportTime = type InlineDelayInit<'T when 'T : not struct> = new (f: unit -> 'T) = {store = Unchecked.defaultof<'T>; func = Func<_>(f) } val mutable store : 'T +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE val mutable func : Func<'T> - +#else + val mutable func : Func<'T> ? +#endif member x.Value = match x.func with | null -> x.store | _ -> let res = LazyInitializer.EnsureInitialized(&x.store, x.func) - x.func <- Unchecked.defaultof<_> + x.func <- null res //------------------------------------------------------------------------- @@ -201,9 +202,7 @@ module Array = /// ~0.8x slower for ints let inline areEqual (xs: 'T []) (ys: 'T []) = match xs, ys with - | null, null -> true | [||], [||] -> true - | null, _ | _, null -> false | _ when xs.Length <> ys.Length -> false | _ -> let mutable break' = false @@ -227,8 +226,7 @@ module Array = /// check if subArray is found in the wholeArray starting /// at the provided index let inline isSubArray (subArray: 'T []) (wholeArray:'T []) index = - if isNull subArray || isNull wholeArray then false - elif subArray.Length = 0 then true + if subArray.Length = 0 then true elif subArray.Length > wholeArray.Length then false elif subArray.Length = wholeArray.Length then areEqual subArray wholeArray else let rec loop subidx idx = @@ -258,12 +256,6 @@ module Option = module List = - //let item n xs = List.nth xs n -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open Microsoft.FSharp.Core.ReflectionAdapters -#endif - let sortWithOrder (c: IComparer<'T>) elements = List.sortWith (Order.toFunction c) elements let splitAfter n l = @@ -546,9 +538,6 @@ module String = String strArr let extractTrailingIndex (str: string) = - match str with - | null -> null, None - | _ -> let charr = str.ToCharArray() Array.revInPlace charr let digits = Array.takeWhile Char.IsDigit charr @@ -558,13 +547,9 @@ module String = | "" -> str, None | index -> str.Substring (0, str.Length - index.Length), Some (int index) - /// Remove all trailing and leading whitespace from the string - /// return null if the string is null - let trim (value: string) = if isNull value then null else value.Trim() - /// Splits a string into substrings based on the strings in the array separators let split options (separator: string []) (value: string) = - if isNull value then null else value.Split(separator, options) + value.Split(separator, options) let (|StartsWith|_|) pattern value = if String.IsNullOrWhiteSpace value then @@ -1018,7 +1003,7 @@ type LazyWithContext<'T, 'ctxt> = /// This field holds either the function to run or a LazyWithContextFailure object recording the exception raised /// from running the function. It is null if the thunk has been evaluated successfully. - mutable funcOrException: obj + mutable funcOrException: obj /// A helper to ensure we rethrow the "original" exception findOriginalException : exn -> exn } @@ -1051,9 +1036,11 @@ type LazyWithContext<'T, 'ctxt> = member x.UnsynchronizedForce ctxt = match x.funcOrException with | null -> x.value + | :? LazyWithContextFailure as res -> // Re-raise the original exception raise (x.findOriginalException res.Exception) + | :? ('ctxt -> 'T) as f -> x.funcOrException <- box(LazyWithContextFailure.Undefined) try @@ -1064,6 +1051,7 @@ type LazyWithContext<'T, 'ctxt> = with e -> x.funcOrException <- box(new LazyWithContextFailure(e)) reraise() + | _ -> failwith "unreachable" @@ -1272,11 +1260,6 @@ type LayeredMultiMap<'Key, 'Value when 'Key : equality and 'Key : comparison>(co [] module Shim = -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open Microsoft.FSharp.Core.ReflectionAdapters -#endif - type IFileSystem = /// A shim over File.ReadAllBytes @@ -1346,14 +1329,32 @@ module Shim = member __.IsPathRootedShim (path: string) = Path.IsPathRooted path member __.IsInvalidPathShim(path: string) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let isInvalidPath(p: string) = - String.IsNullOrEmpty p || p.IndexOfAny(Path.GetInvalidPathChars()) <> -1 +#else + let isInvalidPath(p: string?) = +#endif + match p with + | null | "" -> true + | NonNull p -> p.IndexOfAny(Path.GetInvalidPathChars()) <> -1 +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let isInvalidFilename(p: string) = - String.IsNullOrEmpty p || p.IndexOfAny(Path.GetInvalidFileNameChars()) <> -1 +#else + let isInvalidFilename(p: string?) = +#endif + match p with + | null | "" -> true + | NonNull p -> p.IndexOfAny(Path.GetInvalidFileNameChars()) <> -1 +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let isInvalidDirectory(d: string) = - d=null || d.IndexOfAny(Path.GetInvalidPathChars()) <> -1 +#else + let isInvalidDirectory(d: string?) = +#endif + match d with + | null -> true + | NonNull d -> d.IndexOfAny(Path.GetInvalidPathChars()) <> -1 isInvalidPath path || let directory = Path.GetDirectoryName path diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs index 280bbf0c384..88b0ef474f7 100644 --- a/src/absil/ilread.fs +++ b/src/absil/ilread.fs @@ -213,7 +213,11 @@ module MemoryMapping = int _flProtect, int _dwMaximumSizeLow, int _dwMaximumSizeHigh, +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE string _lpName) +#else + string? _lpName) +#endif [] extern ADDR MapViewOfFile (HANDLE _hFileMappingObject, @@ -892,7 +896,11 @@ type GenericParamsIdx = GenericParamsIdx of int * TypeOrMethodDefTag * int let mkCacheInt32 lowMem _inbase _nm _sz = if lowMem then (fun f x -> f x) else +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let cache = ref null +#else + let cache : Dictionary<_,_>? ref = ref null // TODO NULLNESS: this explicit annotation should not be needed +#endif let count = ref 0 #if STATISTICS addReport (fun oc -> if !count <> 0 then oc.WriteLine ((_inbase + string !count + " "+ _nm + " cache hits"): string)) @@ -900,9 +908,12 @@ let mkCacheInt32 lowMem _inbase _nm _sz = fun f (idx: int32) -> let cache = match !cache with - | null -> cache := new Dictionary(11) - | _ -> () - !cache + | null -> + let c = new Dictionary(11) + cache := c + c + | NonNull c -> c + match cache.TryGetValue idx with | true, res -> incr count @@ -914,7 +925,11 @@ let mkCacheInt32 lowMem _inbase _nm _sz = let mkCacheGeneric lowMem _inbase _nm _sz = if lowMem then (fun f x -> f x) else +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let cache = ref null +#else + let cache : Dictionary<_,_>? ref = ref null // TODO NULLNESS: this explicit annotation should not be needed +#endif let count = ref 0 #if STATISTICS addReport (fun oc -> if !count <> 0 then oc.WriteLine ((_inbase + string !count + " " + _nm + " cache hits"): string)) @@ -922,10 +937,13 @@ let mkCacheGeneric lowMem _inbase _nm _sz = fun f (idx :'T) -> let cache = match !cache with - | null -> cache := new Dictionary<_, _>(11 (* sz: int *) ) - | _ -> () - !cache - match cache.TryGetValue idx with + | null -> + let c = new Dictionary<_, _>(11) + cache := c + c + | NonNull c -> c + + match cache.TryGetValue(idx) with | true, v -> incr count v diff --git a/src/absil/ilreflect.fs b/src/absil/ilreflect.fs index 404ebf81b0c..5a1151f2351 100644 --- a/src/absil/ilreflect.fs +++ b/src/absil/ilreflect.fs @@ -22,7 +22,6 @@ open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.ILAsciiWriter open FSharp.Compiler.ErrorLogger open FSharp.Compiler.Range -open FSharp.Core.Printf #if FX_RESHAPED_REFLECTION open Microsoft.FSharp.Core.ReflectionAdapters @@ -392,10 +391,15 @@ let emEnv0 = emEntryPts = [] delayedFieldInits = [] } -let envBindTypeRef emEnv (tref: ILTypeRef) (typT, typB, typeDef) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE +let envBindTypeRef emEnv (tref: ILTypeRef) (typT: System.Type, typB, typeDef)= +#else +let envBindTypeRef emEnv (tref: ILTypeRef) (typT: System.Type?, typB, typeDef)= +#endif match typT with | null -> failwithf "binding null type in envBindTypeRef: %s\n" tref.Name - | _ -> {emEnv with emTypMap = Zmap.add tref (typT, typB, typeDef, None) emEnv.emTypMap} + | NonNull typT -> + {emEnv with emTypMap = Zmap.add tref (typT, typB, typeDef, None) emEnv.emTypMap} let envUpdateCreatedTypeRef emEnv (tref: ILTypeRef) = // The tref's TypeBuilder has been created, so we have a Type proper. @@ -424,14 +428,10 @@ let envUpdateCreatedTypeRef emEnv (tref: ILTypeRef) = emEnv let convTypeRef cenv emEnv preferCreated (tref: ILTypeRef) = - let res = - match Zmap.tryFind tref emEnv.emTypMap with - | Some (_typT, _typB, _typeDef, Some createdTy) when preferCreated -> createdTy - | Some (typT, _typB, _typeDef, _) -> typT - | None -> convTypeRefAux cenv tref - match res with - | null -> error(Error(FSComp.SR.itemNotFoundDuringDynamicCodeGen ("type", tref.QualifiedName, tref.Scope.QualifiedName), range0)) - | _ -> res + match Zmap.tryFind tref emEnv.emTypMap with + | Some (_typT, _typB, _typeDef, Some createdTy) when preferCreated -> createdTy + | Some (typT, _typB, _typeDef, _) -> typT + | None -> convTypeRefAux cenv tref let envBindConsRef emEnv (mref: ILMethodRef) consB = {emEnv with emConsMap = Zmap.add mref consB emEnv.emConsMap} @@ -533,7 +533,7 @@ let rec convTypeSpec cenv emEnv preferCreated (tspec: ILTypeSpec) = | _, false -> null match res with | null -> error(Error(FSComp.SR.itemNotFoundDuringDynamicCodeGen ("type", tspec.TypeRef.QualifiedName, tspec.Scope.QualifiedName), range0)) - | _ -> res + | NonNull res -> res and convTypeAux cenv emEnv preferCreated ty = match ty with @@ -675,7 +675,7 @@ let queryableTypeGetField _emEnv (parentT: Type) (fref: ILFieldRef) = let res = parentT.GetField(fref.Name, BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Instance ||| BindingFlags.Static ) match res with | null -> error(Error(FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("field", fref.Name, fref.DeclaringTypeRef.FullName, fref.DeclaringTypeRef.Scope.QualifiedName), range0)) - | _ -> res + | NonNull res -> res let nonQueryableTypeGetField (parentTI: Type) (fieldInfo: FieldInfo) : FieldInfo = let res = @@ -683,10 +683,10 @@ let nonQueryableTypeGetField (parentTI: Type) (fieldInfo: FieldInfo) : FieldInfo else fieldInfo match res with | null -> error(Error(FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("field", fieldInfo.Name, parentTI.AssemblyQualifiedName, parentTI.Assembly.FullName), range0)) - | _ -> res + | NonNull res -> res -let convFieldSpec cenv emEnv fspec = +let convFieldSpec cenv emEnv fspec : FieldInfo = let fref = fspec.FieldRef let tref = fref.DeclaringTypeRef let parentTI = convType cenv emEnv fspec.DeclaringType @@ -778,8 +778,8 @@ let queryableTypeGetMethodBySearch cenv emEnv parentT (mref: ILMethodRef) = failwithf "convMethodRef: could not bind to method '%A' of type '%s'" (System.String.Join(", ", methNames)) parentT.AssemblyQualifiedName | Some methInfo -> methInfo (* return MethodInfo for (generic) type's (generic) method *) -let queryableTypeGetMethod cenv emEnv parentT (mref: ILMethodRef) = - assert(not (typeIsNotQueryable parentT)) +let queryableTypeGetMethod cenv emEnv parentT (mref: ILMethodRef) : MethodInfo = + assert(not (typeIsNotQueryable(parentT))) if mref.GenericArity = 0 then let tyargTs = getGenericArgumentsOfType parentT let argTs, resT = @@ -794,12 +794,20 @@ let queryableTypeGetMethod cenv emEnv parentT (mref: ILMethodRef) = parentT.GetMethod(mref.Name, cconv ||| BindingFlags.Public ||| BindingFlags.NonPublic, null, argTs, +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE #if FX_RESHAPED_REFLECTION (null: obj[])) #else (null: ParameterModifier[])) #endif - // This can fail if there is an ambiguity w.r.t. return type +#else +#if FX_RESHAPED_REFLECTION + (null:obj[]?)) +#else + (null:ParameterModifier[]?)) +#endif +#endif + // This can fail if there is an ambiguity w.r.t. return type with _ -> null if (isNonNull methInfo && equalTypes resT methInfo.ReturnType) then methInfo @@ -808,13 +816,17 @@ let queryableTypeGetMethod cenv emEnv parentT (mref: ILMethodRef) = else queryableTypeGetMethodBySearch cenv emEnv parentT mref -let nonQueryableTypeGetMethod (parentTI: Type) (methInfo: MethodInfo) : MethodInfo = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE +let nonQueryableTypeGetMethod (parentTI:Type) (methInfo : MethodInfo) : MethodInfo = +#else +let nonQueryableTypeGetMethod (parentTI:Type) (methInfo : MethodInfo) : MethodInfo? = +#endif if (parentTI.IsGenericType && not (equalTypes parentTI (getTypeConstructor parentTI))) then TypeBuilder.GetMethod(parentTI, methInfo ) else methInfo -let convMethodRef cenv emEnv (parentTI: Type) (mref: ILMethodRef) = +let convMethodRef cenv emEnv (parentTI: Type) (mref: ILMethodRef) : MethodInfo = let parent = mref.DeclaringTypeRef let res = if isEmittedTypeRef emEnv parent then @@ -832,7 +844,7 @@ let convMethodRef cenv emEnv (parentTI: Type) (mref: ILMethodRef) = queryableTypeGetMethod cenv emEnv parentTI mref match res with | null -> error(Error(FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("method", mref.Name, parentTI.FullName, parentTI.Assembly.FullName), range0)) - | _ -> res + | NonNull res -> res //---------------------------------------------------------------------------- // convMethodSpec @@ -850,19 +862,26 @@ let convMethodSpec cenv emEnv (mspec: ILMethodSpec) = methInfo methInfo -/// Get a constructor on a non-TypeBuilder type -let queryableTypeGetConstructor cenv emEnv (parentT: Type) (mref: ILMethodRef) = - let tyargTs = getGenericArgumentsOfType parentT - let reqArgTs = +//---------------------------------------------------------------------------- +// - QueryableTypeGetConstructors: get a constructor on a non-TypeBuilder type +//---------------------------------------------------------------------------- + +let queryableTypeGetConstructor cenv emEnv (parentT: Type) (mref: ILMethodRef) : ConstructorInfo = + let tyargTs = getGenericArgumentsOfType parentT + let reqArgTs = let emEnv = envPushTyvars emEnv tyargTs convTypesToArray cenv emEnv mref.ArgTypes let res = parentT.GetConstructor(BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Instance, null, reqArgTs, null) match res with | null -> error(Error(FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("constructor", mref.Name, parentT.FullName, parentT.Assembly.FullName), range0)) - | _ -> res + | NonNull res -> res -let nonQueryableTypeGetConstructor (parentTI: Type) (consInfo: ConstructorInfo) : ConstructorInfo = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE +let nonQueryableTypeGetConstructor (parentTI:Type) (consInfo : ConstructorInfo) : ConstructorInfo = +#else +let nonQueryableTypeGetConstructor (parentTI:Type) (consInfo : ConstructorInfo) : ConstructorInfo? = +#endif if parentTI.IsGenericType then TypeBuilder.GetConstructor(parentTI, consInfo) else consInfo /// convConstructorSpec (like convMethodSpec) @@ -883,7 +902,7 @@ let convConstructorSpec cenv emEnv (mspec: ILMethodSpec) = queryableTypeGetConstructor cenv emEnv parentTI mref match res with | null -> error(Error(FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("constructor", "", parentTI.FullName, parentTI.Assembly.FullName), range0)) - | _ -> res + | NonNull res -> res let emitLabelMark emEnv (ilG: ILGenerator) (label: ILCodeLabel) = let lab = envGetLabel emEnv label @@ -956,17 +975,17 @@ let getGenericMethodDefinition q (ty: Type) = let getArrayMethInfo n ty = match n with - | 2 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.GetArray2D null 0 0 @@> ty - | 3 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.GetArray3D null 0 0 0 @@> ty - | 4 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.GetArray4D null 0 0 0 0 @@> ty + | 2 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.GetArray2D Unchecked.defaultof<_> 0 0 @@> ty + | 3 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.GetArray3D Unchecked.defaultof<_> 0 0 0 @@> ty + | 4 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.GetArray4D Unchecked.defaultof<_> 0 0 0 0 @@> ty | _ -> invalidArg "n" "not expecting array dimension > 4" let setArrayMethInfo n ty = match n with - | 2 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.SetArray2D null 0 0 0 @@> ty - | 3 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.SetArray3D null 0 0 0 0 @@> ty - | 4 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.SetArray4D null 0 0 0 0 0 @@> ty - | _ -> invalidArg "n" "not expecting array dimension > 4" + | 2 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.SetArray2D Unchecked.defaultof<_> 0 0 0 @@> ty + | 3 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.SetArray3D Unchecked.defaultof<_> 0 0 0 0 @@> ty + | 4 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.SetArray4D Unchecked.defaultof<_> 0 0 0 0 0 @@> ty + | _ -> invalidArg "n" "not expecting array dimension > 4" //---------------------------------------------------------------------------- @@ -1272,23 +1291,23 @@ let rec emitInstr cenv (modB: ModuleBuilder) emEnv (ilG: ILGenerator) instr = setArrayMethInfo shape.Rank ety else #endif - modB.GetArrayMethodAndLog (aty, "Set", System.Reflection.CallingConventions.HasThis, (null: Type), Array.append (Array.create shape.Rank (typeof)) (Array.ofList [ ety ])) - ilG.EmitAndLog (OpCodes.Call, meth) + modB.GetArrayMethodAndLog(aty, "Set", System.Reflection.CallingConventions.HasThis, null, Array.append (Array.create shape.Rank (typeof)) (Array.ofList [ ety ])) + ilG.EmitAndLog(OpCodes.Call, meth) | I_newarr (shape, ty) -> if (shape = ILArrayShape.SingleDimensional) then ilG.EmitAndLog (OpCodes.Newarr, convType cenv emEnv ty) else - let aty = convType cenv emEnv (ILType.Array(shape, ty)) - let meth = modB.GetArrayMethodAndLog (aty, ".ctor", System.Reflection.CallingConventions.HasThis, (null: Type), Array.create shape.Rank (typeof)) - ilG.EmitAndLog (OpCodes.Newobj, meth) - - | I_ldlen -> ilG.EmitAndLog OpCodes.Ldlen - | I_mkrefany ty -> ilG.EmitAndLog (OpCodes.Mkrefany, convType cenv emEnv ty) - | I_refanytype -> ilG.EmitAndLog OpCodes.Refanytype - | I_refanyval ty -> ilG.EmitAndLog (OpCodes.Refanyval, convType cenv emEnv ty) - | I_rethrow -> ilG.EmitAndLog OpCodes.Rethrow - | I_break -> ilG.EmitAndLog OpCodes.Break + let aty = convType cenv emEnv (ILType.Array(shape, ty)) + let meth = modB.GetArrayMethodAndLog(aty, ".ctor", System.Reflection.CallingConventions.HasThis, null, Array.create shape.Rank (typeof)) + ilG.EmitAndLog(OpCodes.Newobj, meth) + + | I_ldlen -> ilG.EmitAndLog(OpCodes.Ldlen) + | I_mkrefany ty -> ilG.EmitAndLog(OpCodes.Mkrefany, convType cenv emEnv ty) + | I_refanytype -> ilG.EmitAndLog(OpCodes.Refanytype) + | I_refanyval ty -> ilG.EmitAndLog(OpCodes.Refanyval, convType cenv emEnv ty) + | I_rethrow -> ilG.EmitAndLog(OpCodes.Rethrow) + | I_break -> ilG.EmitAndLog(OpCodes.Break) | I_seqpoint src -> #if FX_RESHAPED_REFEMIT ignore src @@ -1411,10 +1430,7 @@ let emitMethodBody cenv modB emEnv ilG _name (mbody: ILLazyMethodBody) = | MethodBody.NotAvailable -> failwith "emitMethodBody: metadata only" let convCustomAttr cenv emEnv (cattr: ILAttribute) = - let methInfo = - match convConstructorSpec cenv emEnv cattr.Method with - | null -> failwithf "convCustomAttr: %+A" cattr.Method - | res -> res + let methInfo = convConstructorSpec cenv emEnv cattr.Method let data = getCustomAttrData cenv.ilg cattr (methInfo, data) diff --git a/src/absil/ilsign.fs b/src/absil/ilsign.fs index 6fbc1ca4525..1061f542c70 100644 --- a/src/absil/ilsign.fs +++ b/src/absil/ilsign.fs @@ -10,6 +10,7 @@ open System.Collections.Immutable open System.Reflection.PortableExecutable open System.Security.Cryptography open System.Runtime.InteropServices +open FSharp.Compiler.AbstractIL.Internal.Library type KeyType = | Public @@ -141,10 +142,18 @@ open System.Runtime.InteropServices key.D <- reader.ReadBigInteger byteLen key - let toCLRKeyBlob (rsaParameters:RSAParameters) (algId:int) : byte[] = - let validateRSAField (field:byte[]) expected (name:string) = - if field <> null && field.Length <> expected then - raise (CryptographicException(String.Format(getResourceString(FSComp.SR.ilSignInvalidRSAParams()), name))) + let toCLRKeyBlob (rsaParameters: RSAParameters) (algId: int) : byte[] = + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let validateRSAField (field: byte[]) expected (name: string) = +#else + let validateRSAField (field: byte[]?) expected (name: string) = +#endif + match field with + | null -> () + | NonNull field -> + if field.Length <> expected then + raise (CryptographicException(String.Format(getResourceString(FSComp.SR.ilSignInvalidRSAParams()), name))) // The original FCall this helper emulates supports other algId's - however, the only algid we need to support is CALG_RSA_KEYX. We will not port the codepaths dealing with other algid's. if algId <> CALG_RSA_KEYX then raise (CryptographicException(getResourceString(FSComp.SR.ilSignInvalidAlgId()))) diff --git a/src/absil/ilsupp.fs b/src/absil/ilsupp.fs index 97280194f74..b02eacb77c2 100644 --- a/src/absil/ilsupp.fs +++ b/src/absil/ilsupp.fs @@ -900,115 +900,119 @@ type ImageDebugDirectory = [] type ISymUnmanagedWriter2 = abstract DefineDocument: [] url: string * - language: System.Guid byref * - languageVendor: System.Guid byref * - documentType: System.Guid byref * - [] RetVal: ISymUnmanagedDocumentWriter byref -> unit - abstract SetUserEntryPoint: entryMethod: uint32 -> unit - abstract OpenMethod: meth: int -> unit - abstract CloseMethod: unit -> unit - abstract OpenScope: startOffset: int * pRetVal: int byref -> unit - abstract CloseScope: endOffset: int -> unit - abstract SetScopeRange: scopeID: int * startOffset: int * endOffset: int -> unit - abstract DefineLocalVariable: [] varname: string * - attributes: int * - cSig: int * - []signature: byte[] * - addressKind: int * - addr1: int * - addr2: int * - addr3: int * - startOffset: int * - endOffset: int -> unit - abstract DefineParameter: [] paramname: string * - attributes: int * - sequence: int * - addressKind: int * - addr1: int * - addr2: int * - addr3: int -> unit - abstract DefineField: parent: int * - [] fieldname: string * - attributes: int * - cSig: int * - []signature: byte[] * - addressKind: int * - addr1: int * - addr2: int * - addr3: int -> unit - abstract DefineGlobalVariable: [] globalvarname: string * - attributes: int * - cSig: int * - []signature: byte[] * - addressKind: int * - addr1: int * - addr2: int * - addr3: int -> unit - abstract Close: unit -> unit - abstract SetSymAttribute: parent: int * - [] attname: string * - cData: int * - []data: byte[] -> unit - abstract OpenNamespace: [] nsname: string -> unit - abstract CloseNamespace: unit -> unit - abstract UsingNamespace: [] fullName: string -> unit - abstract SetMethodSourceRange: startDoc: ISymUnmanagedDocumentWriter * - startLine: int * - startColumn: int * - endDoc: ISymUnmanagedDocumentWriter * - endLine: int * - endColumn: int -> unit - abstract Initialize: emitter: nativeint * - [] filename: string * - stream: IStream * - fullBuild: bool -> unit - abstract GetDebugInfo: iDD: ImageDebugDirectory byref * - cData: int * - pcData: int byref * - []data: byte[] -> unit - abstract DefineSequencePoints: document: ISymUnmanagedDocumentWriter * - spCount: int * - []offsets: int [] * - []lines: int [] * - []columns: int [] * - []endLines: int [] * - []endColumns: int [] -> unit - abstract RemapToken: oldToken: int * newToken: int -> unit - abstract Initialize2: emitter: nativeint * - [] tempfilename: string * - stream: IStream * - fullBuild: bool * - [] finalfilename: string -> unit - abstract DefineConstant: [] constname: string * - value: Object * - cSig: int * - []signature: byte[] -> unit - abstract Abort: unit -> unit - abstract DefineLocalVariable2: [] localvarname2: string * - attributes: int * - sigToken: int * - addressKind: int * - addr1: int * - addr2: int * - addr3: int * - startOffset: int * - endOffset: int -> unit - abstract DefineGlobalVariable2: [] globalvarname2: string * - attributes: int * - sigToken: int * - addressKind: int * - addr1: int * - addr2: int * - addr3: int -> unit - abstract DefineConstant2: [] constantname2: string * - value: Object * - sigToken: int -> unit - abstract OpenMethod2: method2: int * - isect: int * - offset: int -> unit - -type PdbWriter = { symWriter: ISymUnmanagedWriter2 } -type PdbDocumentWriter = { symDocWriter: ISymUnmanagedDocumentWriter } (* pointer to pDocumentWriter COM object *) + language: System.Guid byref * + languageVendor: System.Guid byref * + documentType: System.Guid byref * + [] RetVal: ISymUnmanagedDocumentWriter byref -> unit + abstract SetUserEntryPoint : entryMethod : uint32 -> unit + abstract OpenMethod : meth : int -> unit + abstract CloseMethod : unit -> unit + abstract OpenScope : startOffset : int * pRetVal : int byref -> unit + abstract CloseScope : endOffset : int -> unit + abstract SetScopeRange : scopeID : int * startOffset : int * endOffset : int -> unit + abstract DefineLocalVariable : [] varname : string * + attributes : int * + cSig : int * + []signature : byte[] * + addressKind : int * + addr1 : int * + addr2 : int * + addr3 : int * + startOffset : int * + endOffset : int -> unit + abstract DefineParameter : [] paramname : string * + attributes : int * + sequence : int * + addressKind : int * + addr1 : int * + addr2 : int * + addr3 : int -> unit + abstract DefineField : parent : int * + [] fieldname : string * + attributes : int * + cSig : int * + []signature : byte[] * + addressKind : int * + addr1 : int * + addr2 : int * + addr3 : int -> unit + abstract DefineGlobalVariable : [] globalvarname : string * + attributes : int * + cSig : int * + []signature : byte[] * + addressKind : int * + addr1 : int * + addr2 : int * + addr3 : int -> unit + abstract Close : unit -> unit + abstract SetSymAttribute : parent : int * + [] attname : string * + cData : int * + []data : byte[] -> unit + abstract OpenNamespace : [] nsname : string -> unit + abstract CloseNamespace : unit -> unit + abstract UsingNamespace : [] fullName : string -> unit + abstract SetMethodSourceRange : startDoc : ISymUnmanagedDocumentWriter * + startLine : int * + startColumn : int * + endDoc : ISymUnmanagedDocumentWriter * + endLine : int * + endColumn : int -> unit + abstract Initialize : emitter : nativeint * + [] filename : string * + stream : IStream * + fullBuild : bool -> unit + abstract GetDebugInfo : iDD : ImageDebugDirectory byref * + cData : int * + pcData : int byref * +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + []data : byte[] -> unit +#else + []data : byte[]? -> unit +#endif + abstract DefineSequencePoints : document : ISymUnmanagedDocumentWriter * + spCount : int * + []offsets : int [] * + []lines : int [] * + []columns : int [] * + []endLines : int [] * + []endColumns : int [] -> unit + abstract RemapToken : oldToken : int * newToken : int -> unit + abstract Initialize2 : emitter : nativeint * + [] tempfilename : string * + stream : IStream * + fullBuild : bool * + [] finalfilename : string -> unit + abstract DefineConstant : [] constname : string * + value : Object * + cSig : int * + []signature : byte[] -> unit + abstract Abort : unit -> unit + abstract DefineLocalVariable2 : [] localvarname2 : string * + attributes : int * + sigToken : int * + addressKind : int * + addr1 : int * + addr2 : int * + addr3 : int * + startOffset : int * + endOffset : int -> unit + abstract DefineGlobalVariable2 : [] globalvarname2 : string * + attributes : int * + sigToken : int * + addressKind : int * + addr1 : int * + addr2 : int * + addr3 : int -> unit + abstract DefineConstant2 : [] constantname2 : string * + value : Object * + sigToken : int -> unit + abstract OpenMethod2 : method2 : int * + isect : int * + offset : int -> unit + +type PdbWriter = { symWriter : ISymUnmanagedWriter2 } +type PdbDocumentWriter = { symDocWriter : ISymUnmanagedDocumentWriter } (* pointer to pDocumentWriter COM object *) type idd = { iddCharacteristics: int32 iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *) @@ -1177,17 +1181,14 @@ let pdbReadOpen (moduleName: string) (path: string) : PdbReader = let importerPtr = Marshal.GetComInterfaceForObject(o, typeof) try #if ENABLE_MONO_SUPPORT - // ISymWrapper.dll is not available as a compile-time dependency for the cross-platform compiler, since it is Windows-only - // Access it via reflection instead.System.Diagnostics.SymbolStore.SymBinder - try - let isym = System.Reflection.Assembly.Load("ISymWrapper, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") - let symbolBinder = isym.CreateInstance("System.Diagnostics.SymbolStore.SymBinder") - let symbolBinderTy = symbolBinder.GetType() - let reader = symbolBinderTy.InvokeMember("GetReader", BindingFlags.Public ||| BindingFlags.InvokeMethod ||| BindingFlags.Instance, null, symbolBinder, [| box importerPtr; box moduleName; box path |]) - { symReader = reader :?> ISymbolReader } - with _ -> - { symReader = null } -#else + // ISymWrapper.dll is not available as a compile-time dependency for the cross-platform compiler, since it is Windows-only + // Access it via reflection instead.System.Diagnostics.SymbolStore.SymBinder + let isym = System.Reflection.Assembly.Load("ISymWrapper, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") + let symbolBinder = isym.CreateInstance("System.Diagnostics.SymbolStore.SymBinder") + let symbolBinderTy = symbolBinder.GetType() + let reader = symbolBinderTy.InvokeMember("GetReader",BindingFlags.Public ||| BindingFlags.InvokeMethod ||| BindingFlags.Instance, null,symbolBinder,[| box importerPtr; box moduleName; box path |]) + { symReader = reader :?> ISymbolReader } +#else let symbolBinder = new System.Diagnostics.SymbolStore.SymBinder() { symReader = symbolBinder.GetReader(importerPtr, moduleName, path) } #endif diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 5d6bfd3ee06..b5b82d89fbf 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -3035,9 +3035,7 @@ module FileSystemUtilites = open System open System.Reflection open System.Globalization -#if FX_RESHAPED_REFLECTION - open Microsoft.FSharp.Core.ReflectionAdapters -#endif + let progress = try System.Environment.GetEnvironmentVariable("FSharp_DebugSetFilePermissions") <> null with _ -> false let setExecutablePermission (filename: string) = diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 260ccbe238e..c378baa936f 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -222,10 +222,7 @@ let getRowCounts tableRowCounts = let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (sourceLink: string) showTimes (info: PdbData) isDeterministic (pathMap: PathMap) = sortMethods showTimes info let externalRowCounts = getRowCounts info.TableRowCounts - let docs = - match info.Documents with - | null -> Array.empty - | _ -> info.Documents + let docs = info.Documents let metadata = MetadataBuilder() let serializeDocumentName (name: string) = @@ -324,12 +321,9 @@ let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (s info.Methods |> Array.iter (fun minfo -> let docHandle, sequencePointBlob = let sps = - match minfo.SequencePoints with - | null -> Array.empty - | _ -> - match minfo.Range with - | None -> Array.empty - | Some (_,_) -> minfo.SequencePoints + match minfo.Range with + | None -> Array.empty + | Some (_,_) -> minfo.SequencePoints let builder = new BlobBuilder() builder.WriteCompressedInteger(minfo.LocalSignatureToken) @@ -476,7 +470,11 @@ let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (s | None -> MetadataTokens.MethodDefinitionHandle 0 | Some x -> MetadataTokens.MethodDefinitionHandle x +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let deterministicIdProvider isDeterministic : System.Func, BlobContentId> = +#else + let deterministicIdProvider isDeterministic : System.Func, BlobContentId> ? = +#endif match isDeterministic with | false -> null | true -> diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs b/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs index a9a079598a3..813ad7d8b0f 100644 --- a/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs +++ b/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs @@ -4393,12 +4393,48 @@ type internal SR private() = /// The input to a copy-and-update expression that creates an anonymous record must be either an anonymous record or a record /// (Originally from ..\FSComp.txt:1455) static member tcCopyAndUpdateNeedsRecordType() = (3245, GetStringFunc("tcCopyAndUpdateNeedsRecordType",",,,") ) - /// The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL. + /// The type '%s' does not support a nullness qualitification. /// (Originally from ..\FSComp.txt:1456) + static member tcTypeDoesNotHaveAnyNull(a0 : System.String) = (3260, GetStringFunc("tcTypeDoesNotHaveAnyNull",",,,%s,,,") a0) + /// This language feature is not enabled, use /langversion:5.0 or greater to enable it + /// (Originally from ..\FSComp.txt:1461) + static member tcLangFeatureNotEnabled50() = (3265, GetStringFunc("tcLangFeatureNotEnabled50",",,,") ) + /// Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + /// (Originally from ..\FSComp.txt:1462) + static member tcDefaultStructConstructorCallNulls() = (3266, GetStringFunc("tcDefaultStructConstructorCallNulls",",,,") ) + /// Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + /// (Originally from ..\FSComp.txt:1463) + static member chkValueWithDefaultValueMustHaveDefaultValueNulls() = (3267, GetStringFunc("chkValueWithDefaultValueMustHaveDefaultValueNulls",",,,") ) + /// The constraints 'null' and 'not null' are inconsistent + /// (Originally from ..\FSComp.txt:1464) + static member csNullNotNullConstraintInconsistent() = (3268, GetStringFunc("csNullNotNullConstraintInconsistent",",,,") ) + /// The constraints 'struct' and 'null' are inconsistent + /// (Originally from ..\FSComp.txt:1465) + static member csStructNullConstraintInconsistent() = (3269, GetStringFunc("csStructNullConstraintInconsistent",",,,") ) + /// The constraints 'delegate' and 'comparison' are inconsistent + /// (Originally from ..\FSComp.txt:1466) + static member csDelegateComparisonConstraintInconsistent() = (3270, GetStringFunc("csDelegateComparisonConstraintInconsistent",",,,") ) + /// The /checknulls language feature is not enabled + /// (Originally from ..\FSComp.txt:1467) + static member tcNullnessCheckingNotEnabled() = (3271, GetStringFunc("tcNullnessCheckingNotEnabled",",,,") ) + /// The type '%s' has 'null' as a true representation value but a constraint does not permit this + /// (Originally from ..\FSComp.txt:1468) + static member csTypeHasNullAsTrueValue(a0 : System.String) = (GetStringFunc("csTypeHasNullAsTrueValue",",,,%s,,,") a0) + /// The type '%s' has 'null' as an extra value but a constraint does not permit this + /// (Originally from ..\FSComp.txt:1469) + static member csTypeHasNullAsExtraValue(a0 : System.String) = (GetStringFunc("csTypeHasNullAsExtraValue",",,,%s,,,") a0) + /// The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL. + /// (Originally from ..\FSComp.txt:1470) static member chkInvalidFunctionParameterType(a0 : System.String, a1 : System.String) = (3300, GetStringFunc("chkInvalidFunctionParameterType",",,,%s,,,%s,,,") a0 a1) /// The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL. - /// (Originally from ..\FSComp.txt:1457) + /// (Originally from ..\FSComp.txt:1471) static member chkInvalidFunctionReturnType(a0 : System.String) = (3301, GetStringFunc("chkInvalidFunctionReturnType",",,,%s,,,") a0) + /// Enable nullness declarations and checks + /// (Originally from ..\FSComp.txt:1472) + static member optsCheckNulls() = (GetStringFunc("optsCheckNulls",",,,") ) + /// Specify the language version + /// (Originally from ..\FSComp.txt:1473) + static member optsLangVersion() = (GetStringFunc("optsLangVersion",",,,") ) /// Call this method once to validate that all known resources are valid; throws if not static member RunStartupValidation() = @@ -5828,6 +5864,18 @@ type internal SR private() = ignore(GetString("parsInvalidAnonRecdExpr")) ignore(GetString("parsInvalidAnonRecdType")) ignore(GetString("tcCopyAndUpdateNeedsRecordType")) + ignore(GetString("tcTypeDoesNotHaveAnyNull")) + ignore(GetString("tcLangFeatureNotEnabled50")) + ignore(GetString("tcDefaultStructConstructorCallNulls")) + ignore(GetString("chkValueWithDefaultValueMustHaveDefaultValueNulls")) + ignore(GetString("csNullNotNullConstraintInconsistent")) + ignore(GetString("csStructNullConstraintInconsistent")) + ignore(GetString("csDelegateComparisonConstraintInconsistent")) + ignore(GetString("tcNullnessCheckingNotEnabled")) + ignore(GetString("csTypeHasNullAsTrueValue")) + ignore(GetString("csTypeHasNullAsExtraValue")) ignore(GetString("chkInvalidFunctionParameterType")) ignore(GetString("chkInvalidFunctionReturnType")) + ignore(GetString("optsCheckNulls")) + ignore(GetString("optsLangVersion")) () diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx new file mode 100644 index 00000000000..8f130e8f0c9 --- /dev/null +++ b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx @@ -0,0 +1,4441 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The namespace '{0}' is not defined. + + + The namespace or module '{0}' is not defined. + + + The field, constructor or member '{0}' is not defined. + + + The value, constructor, namespace or type '{0}' is not defined. + + + The value or constructor '{0}' is not defined. + + + The value, namespace, type or module '{0}' is not defined. + + + The constructor, module or namespace '{0}' is not defined. + + + The type '{0}' is not defined. + + + The type '{0}' is not defined in '{1}'. + + + The record label or namespace '{0}' is not defined. + + + The record label '{0}' is not defined. + + + Maybe you want one of the following: + + + The type parameter {0} is not defined. + + + The pattern discriminator '{0}' is not defined. + + + Replace with '{0}' + + + Add . for indexer access. + + + All elements of a list must be of the same type as the first element, which here is '{0}'. This element has type '{1}'. + + + All elements of an array must be of the same type as the first element, which here is '{0}'. This element has type '{1}'. + + + This 'if' expression is missing an 'else' branch. Because 'if' is an expression, and not a statement, add an 'else' branch which also returns a value of type '{0}'. + + + The 'if' expression needs to have type '{0}' to satisfy context type requirements. It currently has type '{1}'. + + + All branches of an 'if' expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. + + + All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. + + + A pattern match guard must be of type 'bool', but this 'when' expression is of type '{0}'. + + + A ';' is used to separate field values in records. Consider replacing ',' with ';'. + + + The '!' operator is used to dereference a ref cell. Consider using 'not expr' here. + + + The non-generic type '{0}' does not expect any type arguments, but here is given {1} type argument(s) + + + Consider using 'return!' instead of 'return'. + + + Consider using 'yield!' instead of 'yield'. + + + \nA tuple type is required for one or more arguments. Consider wrapping the given arguments in additional parentheses or review the definition of the interface. + + + Invalid warning number '{0}' + + + Invalid version string '{0}' + + + Invalid version file '{0}' + + + Microsoft (R) F# Compiler version {0} + + + F# Compiler for F# {0} + + + Problem with filename '{0}': {1} + + + No inputs specified + + + The '--pdb' option requires the '--debug' option to be used + + + The search directory '{0}' is invalid + + + The search directory '{0}' could not be found + + + '{0}' is not a valid filename + + + '{0}' is not a valid assembly name + + + Unrecognized privacy setting '{0}' for managed resource, valid options are 'public' and 'private' + + + Multiple references to '{0}.dll' are not permitted + + + Could not read version from mscorlib.dll + + + Unable to read assembly '{0}' + + + Assembly resolution failure at or near this location + + + The declarations in this file will be placed in an implicit module '{0}' based on the file name '{1}'. However this is not a valid F# identifier, so the contents will not be accessible from other files. Consider renaming the file or adding a 'module' or 'namespace' declaration at the top of the file. + + + Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration. + + + Files in libraries or multiple-file applications must begin with a namespace or module declaration. When using a module declaration at the start of a file the '=' sign is not allowed. If this is a top-level module, consider removing the = to resolve this error. + + + This file contains multiple declarations of the form 'module SomeNamespace.SomeModule'. Only one declaration of this form is permitted in a file. Change your file to use an initial namespace declaration and/or use 'module ModuleName = ...' to define your modules. + + + Option requires parameter: {0} + + + Source file '{0}' could not be found + + + The file extension of '{0}' is not recognized. Source files must have extension .fs, .fsi, .fsx, .fsscript, .ml or .mli. + + + Could not resolve assembly '{0}' + + + Could not resolve assembly '{0}' required by '{1}' + + + Error opening binary file '{0}': {1} + + + The F#-compiled DLL '{0}' needs to be recompiled to be used with this version of F# + + + Invalid directive. Expected '#I \"<path>\"'. + + + Invalid directive. Expected '#r \"<file-or-assembly>\"'. + + + Invalid directive. Expected '#load \"<file>\" ... \"<file>\"'. + + + Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. + + + Directives inside modules are ignored + + + A signature for the file or module '{0}' has already been specified + + + An implementation of file or module '{0}' has already been given. Compilation order is significant in F# because of type inference. You may need to adjust the order of your files to place the signature file before the implementation. In Visual Studio files are type-checked in the order they appear in the project file, which can be edited manually or adjusted using the solution explorer. + + + An implementation of the file or module '{0}' has already been given + + + The signature file '{0}' does not have a corresponding implementation file. If an implementation file exists then check the 'module' and 'namespace' declarations in the signature and implementation files match. + + + '{0}' is not a valid integer argument + + + '{0}' is not a valid floating point argument + + + Unrecognized option: '{0}' + + + Invalid module or namespace name + + + Error reading/writing metadata for the F# compiled DLL '{0}'. Was the DLL compiled with an earlier version of the F# compiler? (error: '{1}'). + + + The type/module '{0}' is not a concrete module or type + + + The type '{0}' has an inline assembly code representation + + + A namespace and a module named '{0}' both occur in two parts of this assembly + + + Two modules named '{0}' occur in two parts of this assembly + + + Two type definitions named '{0}' occur in namespace '{1}' in two parts of this assembly + + + A module and a type definition named '{0}' occur in namespace '{1}' in two parts of this assembly + + + Invalid member signature encountered because of an earlier error + + + This value does not have a valid property setter type + + + Invalid form for a property getter. At least one '()' argument is required when using the explicit syntax. + + + Invalid form for a property setter. At least one argument is required. + + + Unexpected use of a byref-typed variable + + + A value must be mutable in order to mutate the contents or take the address of a value type, e.g. 'let mutable x = ...' + + + Invalid mutation of a constant expression. Consider copying the expression to a mutable local, e.g. 'let mutable x = ...'. + + + The value has been copied to ensure the original is not mutated by this operation or because the copy is implicit when returning a struct from a member and another member is then accessed + + + Recursively defined values cannot appear directly as part of the construction of a tuple value within a recursive binding + + + Recursive values cannot appear directly as a construction of the type '{0}' within a recursive binding. This feature has been removed from the F# language. Consider using a record instead. + + + Recursive values cannot be directly assigned to the non-mutable field '{0}' of the type '{1}' within a recursive binding. Consider using a mutable field instead. + + + Unexpected decode of AutoOpenAttribute + + + Unexpected decode of InternalsVisibleToAttribute + + + Unexpected decode of InterfaceDataVersionAttribute + + + Active patterns cannot return more than 7 possibilities + + + This is not a valid constant expression or custom attribute value + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe mutability attributes differ + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe names differ + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe compiled names differ + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe display names differ + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe accessibility specified in the signature is more than that specified in the implementation + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe inline flags differ + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe literal constant values and/or attributes differ + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nOne is a type function and the other is not. The signature requires explicit type parameters if they are present in the implementation. + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe respective type parameter counts differ + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe types differ + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nOne is an extension member and the other is not + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nAn arity was not inferred for this value + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe number of generic parameters in the signature and implementation differ (the signature declares {3} but the implementation declares {4} + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe generic parameters in the signature and implementation have different kinds. Perhaps there is a missing [<Measure>] attribute. + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe arities in the signature and implementation differ. The signature specifies that '{3}' is function definition or lambda expression accepting at least {4} argument(s), but the implementation is a computed function value. To declare that a computed function value is a permitted implementation simply parenthesize its type in the signature, e.g.\n\tval {5}: int -> (int -> int)\ninstead of\n\tval {6}: int -> int -> int. + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe CLI member names differ + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nOne is static and the other isn't + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nOne is virtual and the other isn't + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nOne is abstract and the other isn't + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nOne is final and the other isn't + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nOne is marked as an override and the other isn't + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nOne is a constructor/property and the other is not + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe compiled representation of this method is as a static member but the signature indicates its compiled representation is as an instance member + + + Module '{0}' contains\n {1} \nbut its signature specifies\n {2} \nThe compiled representation of this method is as an instance member, but the signature indicates its compiled representation is as a static member + + + The {0} definitions in the signature and implementation are not compatible because the names differ. The type is called '{1}' in the signature file but '{2}' in implementation. + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the respective type parameter counts differ + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the accessibility specified in the signature is more than that specified in the implementation + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the signature requires that the type supports the interface {2} but the interface has not been implemented + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the implementation says this type may use nulls as a representation but the signature does not + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the implementation says this type may use nulls as an extra value but the signature does not + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the signature says this type may use nulls as a representation but the implementation does not + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the signature says this type may use nulls as an extra value but the implementation does not + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the implementation type is sealed but the signature implies it is not. Consider adding the [<Sealed>] attribute to the signature. + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the implementation type is not sealed but signature implies it is. Consider adding the [<Sealed>] attribute to the implementation. + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the implementation is an abstract class but the signature is not. Consider adding the [<AbstractClass>] attribute to the signature. + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the signature is an abstract class but the implementation is not. Consider adding the [<AbstractClass>] attribute to the implementation. + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the types have different base types + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the number of {2}s differ + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the signature defines the {2} '{3}' but the implementation does not (or does, but not in the same order) + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the implementation defines the {2} '{3}' but the signature does not (or does, but not in the same order) + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the implementation defines a struct but the signature defines a type with a hidden representation + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because a CLI type representation is being hidden by a signature + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because a type representation is being hidden by a signature + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the types are of different kinds + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the IL representations differ + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the representations differ + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the field {2} was present in the implementation but not in the signature + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the order of the fields is different in the signature and implementation + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the field {2} was required by the signature but was not specified by the implementation + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the field '{2}' was present in the implementation but not in the signature. Struct types must now reveal their fields in the signature for the type, though the fields may still be labelled 'private' or 'internal'. + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the abstract member '{2}' was required by the signature but was not specified by the implementation + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the abstract member '{2}' was present in the implementation but not in the signature + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the signature declares a {2} while the implementation declares a {3} + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the abbreviations differ: {2} versus {3} + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because an abbreviation is being hidden by a signature. The abbreviation must be visible to other CLI languages. Consider making the abbreviation visible in the signature. + + + The {0} definitions for type '{1}' in the signature and implementation are not compatible because the signature has an abbreviation while the implementation does not + + + The module contains the constructor\n {0} \nbut its signature specifies\n {1} \nThe names differ + + + The module contains the constructor\n {0} \nbut its signature specifies\n {1} \nThe respective number of data fields differ + + + The module contains the constructor\n {0} \nbut its signature specifies\n {1} \nThe types of the fields differ + + + The module contains the constructor\n {0} \nbut its signature specifies\n {1} \nthe accessibility specified in the signature is more than that specified in the implementation + + + The module contains the field\n {0} \nbut its signature specifies\n {1} \nThe names differ + + + The module contains the field\n {0} \nbut its signature specifies\n {1} \nthe accessibility specified in the signature is more than that specified in the implementation + + + The module contains the field\n {0} \nbut its signature specifies\n {1} \nThe 'static' modifiers differ + + + The module contains the field\n {0} \nbut its signature specifies\n {1} \nThe 'mutable' modifiers differ + + + The module contains the field\n {0} \nbut its signature specifies\n {1} \nThe 'literal' modifiers differ + + + The module contains the field\n {0} \nbut its signature specifies\n {1} \nThe types differ + + + The implicit instantiation of a generic construct at or near this point could not be resolved because it could resolve to multiple unrelated types, e.g. '{0}' and '{1}'. Consider using type annotations to resolve the ambiguity + + + Could not resolve the ambiguity inherent in the use of a 'printf'-style format string + + + Could not resolve the ambiguity in the use of a generic construct with an 'enum' constraint at or near this position + + + Could not resolve the ambiguity in the use of a generic construct with a 'delegate' constraint at or near this position + + + Invalid value + + + The signature and implementation are not compatible because the respective type parameter counts differ + + + The signature and implementation are not compatible because the type parameter in the class/signature has a different compile-time requirement to the one in the member/implementation + + + The signature and implementation are not compatible because the declaration of the type parameter '{0}' requires a constraint of the form {1} + + + The signature and implementation are not compatible because the type parameter '{0}' has a constraint of the form {1} but the implementation does not. Either remove this constraint from the signature or add it to the implementation. + + + The type '{0}' implements 'System.IComparable'. Consider also adding an explicit override for 'Object.Equals' + + + The type '{0}' implements 'System.IComparable' explicitly but provides no corresponding override for 'Object.Equals'. An implementation of 'Object.Equals' has been automatically provided, implemented via 'System.IComparable'. Consider implementing the override 'Object.Equals' explicitly + + + The struct, record or union type '{0}' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type + + + The struct, record or union type '{0}' has an explicit implementation of 'Object.GetHashCode'. Consider implementing a matching override for 'Object.Equals(obj)' + + + The struct, record or union type '{0}' has an explicit implementation of 'Object.Equals'. Consider implementing a matching override for 'Object.GetHashCode()' + + + The exception definitions are not compatible because a CLI exception mapping is being hidden by a signature. The exception mapping must be visible to other modules. The module contains the exception definition\n {0} \nbut its signature specifies\n\t{1} + + + The exception definitions are not compatible because the CLI representations differ. The module contains the exception definition\n {0} \nbut its signature specifies\n\t{1} + + + The exception definitions are not compatible because the exception abbreviation is being hidden by the signature. The abbreviation must be visible to other CLI languages. Consider making the abbreviation visible in the signature. The module contains the exception definition\n {0} \nbut its signature specifies\n\t{1}. + + + The exception definitions are not compatible because the exception abbreviations in the signature and implementation differ. The module contains the exception definition\n {0} \nbut its signature specifies\n\t{1}. + + + The exception definitions are not compatible because the exception declarations differ. The module contains the exception definition\n {0} \nbut its signature specifies\n\t{1}. + + + The exception definitions are not compatible because the field '{0}' was required by the signature but was not specified by the implementation. The module contains the exception definition\n {1} \nbut its signature specifies\n\t{2}. + + + The exception definitions are not compatible because the field '{0}' was present in the implementation but not in the signature. The module contains the exception definition\n {1} \nbut its signature specifies\n\t{2}. + + + The exception definitions are not compatible because the order of the fields is different in the signature and implementation. The module contains the exception definition\n {0} \nbut its signature specifies\n\t{1}. + + + The namespace or module attributes differ between signature and implementation + + + This method is over-constrained in its type parameters + + + No implementations of '{0}' had the correct number of arguments and type parameters. The required signature is '{1}'. + + + The override for '{0}' was ambiguous + + + More than one override implements '{0}' + + + The method '{0}' is sealed and cannot be overridden + + + The override '{0}' implements more than one abstract slot, e.g. '{1}' and '{2}' + + + Duplicate or redundant interface + + + The interface '{0}' is included in multiple explicitly implemented interface types. Add an explicit implementation of this interface. + + + A named argument has been assigned more than one value + + + No implementation was given for '{0}' + + + No implementation was given for '{0}'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'. + + + The member '{0}' does not have the correct number of arguments. The required signature is '{1}'. + + + The member '{0}' does not have the correct number of method type parameters. The required signature is '{1}'. + + + The member '{0}' does not have the correct kinds of generic parameters. The required signature is '{1}'. + + + The member '{0}' cannot be used to implement '{1}'. The required signature is '{2}'. + + + Error while parsing embedded IL + + + Error while parsing embedded IL type + + + This indexer notation has been removed from the F# language + + + Invalid expression on left of assignment + + + The 'ReferenceEquality' attribute cannot be used on structs. Consider using the 'StructuralEquality' attribute instead, or implement an override for 'System.Object.Equals(obj)'. + + + This type uses an invalid mix of the attributes 'NoEquality', 'ReferenceEquality', 'StructuralEquality', 'NoComparison' and 'StructuralComparison' + + + The 'NoEquality' attribute must be used in conjunction with the 'NoComparison' attribute + + + The 'StructuralComparison' attribute must be used in conjunction with the 'StructuralEquality' attribute + + + The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes + + + A type cannot have both the 'ReferenceEquality' and 'StructuralEquality' or 'StructuralComparison' attributes + + + Only record, union, exception and struct types may be augmented with the 'ReferenceEquality', 'StructuralEquality' and 'StructuralComparison' attributes + + + A type with attribute 'ReferenceEquality' cannot have an explicit implementation of 'Object.Equals(obj)', 'System.IEquatable<_>' or 'System.Collections.IStructuralEquatable' + + + A type with attribute 'CustomEquality' must have an explicit implementation of at least one of 'Object.Equals(obj)', 'System.IEquatable<_>' or 'System.Collections.IStructuralEquatable' + + + A type with attribute 'CustomComparison' must have an explicit implementation of at least one of 'System.IComparable' or 'System.Collections.IStructuralComparable' + + + A type with attribute 'NoEquality' should not usually have an explicit implementation of 'Object.Equals(obj)'. Disable this warning if this is intentional for interoperability purposes + + + A type with attribute 'NoComparison' should not usually have an explicit implementation of 'System.IComparable', 'System.IComparable<_>' or 'System.Collections.IStructuralComparable'. Disable this warning if this is intentional for interoperability purposes + + + The 'CustomEquality' attribute must be used in conjunction with the 'NoComparison' or 'CustomComparison' attributes + + + Positional specifiers are not permitted in format strings + + + Missing format specifier + + + '{0}' flag set twice + + + Prefix flag (' ' or '+') set twice + + + The # formatting modifier is invalid in F# + + + Bad precision in format specifier + + + Bad width in format specifier + + + '{0}' format does not support '0' flag + + + Precision missing after the '.' + + + '{0}' format does not support precision + + + Bad format specifier (after l or L): Expected ld,li,lo,lu,lx or lX. In F# code you can use %d, %x, %o or %u instead, which are overloaded to work with all basic integer types. + + + The 'l' or 'L' in this format specifier is unnecessary. In F# code you can use %d, %x, %o or %u instead, which are overloaded to work with all basic integer types. + + + The 'h' or 'H' in this format specifier is unnecessary. You can use %d, %x, %o or %u instead, which are overloaded to work with all basic integer types. + + + '{0}' does not support prefix '{1}' flag + + + Bad format specifier: '{0}' + + + System.Environment.Exit did not exit + + + The treatment of this operator is now handled directly by the F# compiler and its meaning cannot be redefined + + + A protected member is called or 'base' is being used. This is only allowed in the direct implementation of members since they could escape their object scope. + + + The byref-typed variable '{0}' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. + + + The 'base' keyword is used in an invalid way. Base calls cannot be used in closures. Consider using a private member to make base calls. + + + The variable '{0}' is used in an invalid way + + + The type '{0}' is less accessible than the value, member or type '{1}' it is used in. + + + 'System.Void' can only be used as 'typeof<System.Void>' in F# + + + A type instantiation involves a byref type. This is not permitted by the rules of Common IL. + + + Calls to 'reraise' may only occur directly in a handler of a try-with + + + Expression-splicing operators may only be used within quotations + + + First-class uses of the expression-splicing operator are not permitted + + + First-class uses of the address-of operators are not permitted + + + First-class uses of the 'reraise' function is not permitted + + + The byref typed value '{0}' cannot be used at this point + + + 'base' values may only be used to make direct calls to the base implementations of overridden members + + + Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL. + + + The address of the variable '{0}' cannot be used at this point + + + The address of the static field '{0}' cannot be used at this point + + + The address of the field '{0}' cannot be used at this point + + + The address of an array element cannot be used at this point + + + The type of a first-class function cannot contain byrefs + + + A method return type would contain byrefs which is not permitted + + + Invalid custom attribute value (not a constant or literal) + + + The attribute type '{0}' has 'AllowMultiple=false'. Multiple instances of this attribute cannot be attached to a single language element. + + + The member '{0}' is used in an invalid way. A use of '{1}' has been inferred prior to its definition at or near '{2}'. This is an invalid forward reference. + + + A byref typed value would be stored here. Top-level let-bound byref values are not permitted. + + + [<ReflectedDefinition>] terms cannot contain uses of the prefix splice operator '%' + + + A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence. + + + compiled form of the union case + + + default augmentation of the union case + + + The property '{0}' has the same name as a method in type '{1}'. + + + The property '{0}' of type '{1}' has a getter and a setter that do not match. If one is abstract then the other must be as well. + + + The property '{0}' has the same name as another property in type '{1}', but one takes indexer arguments and the other does not. You may be missing an indexer argument to one of your properties. + + + A type would store a byref typed value. This is not permitted by Common IL. + + + Duplicate method. The method '{0}' has the same name and signature as another method in type '{1}'. + + + Duplicate method. The method '{0}' has the same name and signature as another method in type '{1}' once tuples, functions, units of measure and/or provided types are erased. + + + The method '{0}' has curried arguments but has the same name as another method in type '{1}'. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments. + + + Methods with curried arguments cannot declare 'out', 'ParamArray', 'optional', 'ReflectedDefinition', 'byref', 'CallerLineNumber', 'CallerMemberName', or 'CallerFilePath' arguments + + + Duplicate property. The property '{0}' has the same name and signature as another property in type '{1}'. + + + Duplicate property. The property '{0}' has the same name and signature as another property in type '{1}' once tuples, functions, units of measure and/or provided types are erased. + + + Duplicate method. The abstract method '{0}' has the same name and signature as an abstract method in an inherited type. + + + Duplicate method. The abstract method '{0}' has the same name and signature as an abstract method in an inherited type once tuples, functions, units of measure and/or provided types are erased. + + + This type implements the same interface at different generic instantiations '{0}' and '{1}'. This is not permitted in this version of F#. + + + The type of a field using the 'DefaultValue' attribute must admit default initialization, i.e. have 'null' as a proper value or be a struct type whose fields all admit default initialization. You can use 'DefaultValue(false)' to disable this check + + + The type abbreviation contains byrefs. This is not permitted by F#. + + + The variable '{0}' is bound in a quotation but is used as part of a spliced expression. This is not permitted since it may escape its scope. + + + Quotations cannot contain uses of generic expressions + + + Quotations cannot contain function definitions that are inferred or declared to be generic. Consider adding some type constraints to make this a valid quoted expression. + + + Quotations cannot contain object expressions + + + Quotations cannot contain expressions that take the address of a field + + + Quotations cannot contain expressions that fetch static fields + + + Quotations cannot contain inline assembly code or pattern matching on arrays + + + Quotations cannot contain descending for loops + + + Quotations cannot contain expressions that fetch union case indexes + + + Quotations cannot contain expressions that set union case fields + + + Quotations cannot contain expressions that set fields in exception values + + + Quotations cannot contain expressions that require byref pointers + + + Quotations cannot contain expressions that make member constraint calls, or uses of operators that implicitly resolve to a member constraint call + + + Quotations cannot contain this kind of constant + + + Quotations cannot contain this kind of pattern match + + + Quotations cannot contain array pattern matching + + + Quotations cannot contain this kind of type + + + The declared type parameter '{0}' cannot be used here since the type parameter cannot be resolved at compile time + + + This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'. + + + Type inference problem too complicated (maximum iteration depth reached). Consider adding further type annotations. + + + Expected arguments to an instance member + + + This indexer expects {0} arguments but is here given {1} + + + Expecting a type supporting the operator '{0}' but given a function type. You may be missing an argument to a function. + + + Expecting a type supporting the operator '{0}' but given a tuple type + + + None of the types '{0}' support the operator '{1}' + + + The type '{0}' does not support the operator '{1}' + + + None of the types '{0}' support the operator '{1}'. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'. + + + The type '{0}' does not support the operator '{1}'. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'. + + + The type '{0}' does not support a conversion to the type '{1}' + + + The type '{0}' has a method '{1}' (full name '{2}'), but the method is static + + + The type '{0}' has a method '{1}' (full name '{2}'), but the method is not static + + + The constraints 'struct' and 'not struct' are inconsistent + + + The type '{0}' does not have 'null' as a proper value + + + The type '{0}' does not have 'null' as a proper value. To create a null value for a Nullable type use 'System.Nullable()'. + + + The type '{0}' does not support the 'comparison' constraint because it has the 'NoComparison' attribute + + + The type '{0}' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface + + + The type '{0}' does not support the 'comparison' constraint because it is a record, union or struct with one or more structural element types which do not support the 'comparison' constraint. Either avoid the use of comparison with this type, or add the 'StructuralComparison' attribute to the type to determine which field type does not support comparison + + + The type '{0}' does not support the 'equality' constraint because it has the 'NoEquality' attribute + + + The type '{0}' does not support the 'equality' constraint because it is a function type + + + The type '{0}' does not support the 'equality' constraint because it is a record, union or struct with one or more structural element types which do not support the 'equality' constraint. Either avoid the use of equality with this type, or add the 'StructuralEquality' attribute to the type to determine which field type does not support equality + + + The type '{0}' is not a CLI enum type + + + The type '{0}' has a non-standard delegate type + + + The type '{0}' is not a CLI delegate type + + + This type parameter cannot be instantiated to 'Nullable'. This is a restriction imposed in order to ensure the meaning of 'null' in some CLI languages is not confusing when used in conjunction with 'Nullable' values. + + + A generic construct requires that the type '{0}' is a CLI or F# struct type + + + A generic construct requires that the type '{0}' is an unmanaged type + + + The type '{0}' is not compatible with any of the types {1}, arising from the use of a printf-style format string + + + A generic construct requires that the type '{0}' have reference semantics, but it does not, i.e. it is a struct + + + A generic construct requires that the type '{0}' be non-abstract + + + A generic construct requires that the type '{0}' have a public default constructor + + + Type instantiation length mismatch + + + Optional arguments not permitted here + + + {0} is not a static member + + + {0} is not an instance member + + + Argument length mismatch + + + The argument types don't match + + + This method expects a CLI 'params' parameter in this position. 'params' is a way of passing a variable number of arguments to a method in languages such as C#. Consider passing an array for this argument + + + The member or object constructor '{0}' is not {1} + + + The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. + + + {0} is not a static method + + + {0} is not an instance method + + + The member or object constructor '{0}' has no argument or settable return property '{1}'. {2}. + + + The object constructor '{0}' has no argument or settable return property '{1}'. {2}. + + + The required signature is {0} + + + The member or object constructor '{0}' requires {1} argument(s). The required signature is '{2}'. + + + The member or object constructor '{0}' requires {1} additional argument(s). The required signature is '{2}'. + + + The member or object constructor '{0}' requires {1} argument(s). The required signature is '{2}'. Some names for missing arguments are {3}. + + + The member or object constructor '{0}' requires {1} additional argument(s). The required signature is '{2}'. Some names for missing arguments are {3}. + + + The member or object constructor '{0}' requires {1} argument(s) but is here given {2} unnamed and {3} named argument(s). The required signature is '{4}'. + + + The member or object constructor '{0}' takes {1} argument(s) but is here given {2}. The required signature is '{3}'. + + + The object constructor '{0}' takes {1} argument(s) but is here given {2}. The required signature is '{3}'. + + + The object constructor '{0}' takes {1} argument(s) but is here given {2}. The required signature is '{3}'. If some of the arguments are meant to assign values to properties, consider separating those arguments with a comma (','). + + + The member or object constructor '{0}' takes {1} type argument(s) but is here given {2}. The required signature is '{3}'. + + + A member or object constructor '{0}' taking {1} arguments is not accessible from this code location. All accessible versions of method '{2}' take {3} arguments. + + + Incorrect generic instantiation. No {0} member named '{1}' takes {2} generic arguments. + + + The member or object constructor '{0}' does not take {1} argument(s). An overload was found taking {2} arguments. + + + No {0} member or object constructor named '{1}' takes {2} arguments + + + No {0} member or object constructor named '{1}' takes {2} arguments. Note the call to this member also provides {3} named arguments. + + + No {0} member or object constructor named '{1}' takes {2} arguments. The named argument '{3}' doesn't correspond to any argument or settable return property for any overload. + + + Method or object constructor '{0}' not found + + + No overloads match for method '{0}'. + + + A unique overload for method '{0}' could not be determined based on type information prior to this program point. A type annotation may be needed. + + + Candidates: {0} + + + The available overloads are shown below. + + + Accessibility modifiers are not permitted on 'do' bindings, but '{0}' was given. + + + End of file in #if section begun at or after here + + + End of file in string begun at or before here + + + End of file in verbatim string begun at or before here + + + End of file in comment begun at or before here + + + End of file in string embedded in comment begun at or before here + + + End of file in verbatim string embedded in comment begun at or before here + + + End of file in IF-OCAML section begun at or before here + + + End of file in directive begun at or before here + + + No #endif found for #if or #else + + + Attributes have been ignored in this construct + + + 'use' bindings are not permitted in primary constructors + + + 'use' bindings are not permitted in modules and are treated as 'let' bindings + + + An integer for loop must use a simple identifier + + + At most one 'with' augmentation is permitted + + + A semicolon is not expected at this point + + + Unexpected end of input + + + Accessibility modifiers are not permitted here, but '{0}' was given. + + + Only '#' compiler directives may occur prior to the first 'namespace' declaration + + + Accessibility modifiers should come immediately prior to the identifier naming a construct + + + Files should begin with either a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule', but not both. To define a module within a namespace use 'module SomeModule = ...' + + + A module abbreviation must be a simple name, not a path + + + Ignoring attributes on module abbreviation + + + The '{0}' accessibility attribute is not allowed on module abbreviation. Module abbreviations are always private. + + + The '{0}' visibility attribute is not allowed on module abbreviation. Module abbreviations are always private. + + + Unclosed block + + + Unmatched 'begin' or 'struct' + + + A module name must be a simple name, not a path + + + Unexpected empty type moduleDefn list + + + Attributes should be placed before 'val' + + + Attributes are not permitted on interface implementations + + + Syntax error + + + Augmentations are not permitted on delegate type moduleDefns + + + Unmatched 'class', 'interface' or 'struct' + + + A type definition requires one or more members or other declarations. If you intend to define an empty class, struct or interface, then use 'type ... = class end', 'interface end' or 'struct end'. + + + Unmatched 'with' or badly formatted 'with' block + + + 'get', 'set' or 'get,set' required + + + Only class types may take value arguments + + + Unmatched 'begin' + + + Invalid declaration syntax + + + 'get' and/or 'set' required + + + Type annotations on property getters and setters must be given after the 'get()' or 'set(v)', e.g. 'with get() : string = ...' + + + A getter property is expected to be a function, e.g. 'get() = ...' or 'get(index) = ...' + + + Multiple accessibilities given for property getter or setter + + + Property setters must be defined using 'set value = ', 'set idx value = ' or 'set (idx1,...,idxN) value = ... ' + + + Interfaces always have the same visibility as the enclosing type + + + Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type. + + + Attributes are not permitted on 'inherit' declarations + + + Accessibility modifiers are not permitted on an 'inherits' declaration + + + 'inherit' declarations cannot have 'as' bindings. To access members of the base class when overriding a method, the syntax 'base.SomeMember' may be used; 'base' is a keyword. Remove this 'as' binding. + + + Attributes are not allowed here + + + Accessibility modifiers are not permitted in this position for type abbreviations + + + Accessibility modifiers are not permitted in this position for enum types + + + All enum fields must be given values + + + Accessibility modifiers are not permitted on inline assembly code types + + + Unexpected identifier: '{0}' + + + Accessibility modifiers are not permitted on union cases. Use 'type U = internal ...' or 'type U = private ...' to give an accessibility to the whole representation. + + + Accessibility modifiers are not permitted on enumeration fields + + + Consider using a separate record type instead + + + Accessibility modifiers are not permitted on record fields. Use 'type R = internal ...' or 'type R = private ...' to give an accessibility to the whole representation. + + + The declaration form 'let ... and ...' for non-recursive bindings is not used in F# code. Consider using a sequence of 'let' bindings + + + Unmatched '(' + + + Successive patterns should be separated by spaces or tupled + + + No matching 'in' found for this 'let' + + + Error in the return expression for this 'let'. Possible incorrect indentation. + + + The block following this '{0}' is unfinished. Every code block is an expression and must have a result. '{1}' cannot be the final code element in a block. Consider giving this block an explicit result. + + + Incomplete conditional. Expected 'if <expr> then <expr>' or 'if <expr> then <expr> else <expr>'. + + + 'assert' may not be used as a first class value. Use 'assert <expr>' instead. + + + Identifier expected + + + 'in' or '=' expected + + + The use of '->' in sequence and computation expressions is limited to the form 'for pat in expr -> expr'. Use the syntax 'for ... in ... do ... yield...' to generate elements in more complex sequence expressions. + + + Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized + + + Unmatched '[' + + + Missing qualification after '.' + + + In F# code you may use 'expr.[expr]'. A type annotation may be required to indicate the first expression is an array + + + Mismatched quotation, beginning with '{0}' + + + Unmatched '{0}' + + + Unmatched '[|' + + + Unmatched '{{' + + + Unmatched '{{|' + + + Field bindings must have the form 'id = expr;' + + + This member is not permitted in an object implementation + + + Missing function body + + + Syntax error in labelled type argument + + + Unexpected infix operator in type expression + + + The syntax '(typ,...,typ) ident' is not used in F# code. Consider using 'ident<typ,...,typ>' instead + + + Invalid literal in type + + + Unexpected infix operator in unit-of-measure expression. Legal operators are '*', '/' and '^'. + + + Unexpected integer literal in unit-of-measure expression + + + Syntax error: unexpected type parameter specification + + + Mismatched quotation operator name, beginning with '{0}' + + + Active pattern case identifiers must begin with an uppercase letter + + + The '|' character is not permitted in active pattern case identifiers + + + Denominator must not be 0 in unit-of-measure exponent + + + No '=' symbol should follow a 'namespace' declaration + + + The syntax 'module ... = struct .. end' is not used in F# code. Consider using 'module ... = begin .. end' + + + The syntax 'module ... : sig .. end' is not used in F# code. Consider using 'module ... = begin .. end' + + + A static field was used where an instance field is expected + + + Method '{0}' is not accessible from this code location + + + Implicit product of measures following / + + + Unexpected SynMeasure.Anon + + + Non-zero constants cannot have generic units. For generic zero, write 0.0<_>. + + + In sequence expressions, results are generated using 'yield' + + + Unexpected big rational constant + + + Units-of-measure supported only on float, float32, decimal and signed integer types + + + Unexpected Const_uint16array + + + Unexpected Const_bytearray + + + A parameter with attributes must also be given a name, e.g. '[<Attribute>] Name : Type' + + + Return values cannot have names + + + MemberKind.PropertyGetSet only expected in parse trees + + + Namespaces cannot contain values. Consider using a module to hold your value declarations. + + + Namespaces cannot contain extension members except in the same file and namespace declaration group where the type is defined. Consider using a module to hold declarations of extension members. + + + Multiple visibility attributes have been specified for this identifier + + + Multiple visibility attributes have been specified for this identifier. 'let' bindings in classes are always private, as are any 'let' bindings inside expressions. + + + The name '({0})' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name '{1}' instead. + + + The name '({0})' should not be used as a member name. To define equality semantics for a type, override the 'Object.Equals' member. If defining a static member for use from other CLI languages then use the name '{1}' instead. + + + The name '({0})' should not be used as a member name. If defining a static member for use from other CLI languages then use the name '{1}' instead. + + + The name '({0})' should not be used as a member name because it is given a standard definition in the F# library over fixed types + + + The '{0}' operator should not normally be redefined. To define overloaded comparison semantics for a particular type, implement the 'System.IComparable' interface in the definition of that type. + + + The '{0}' operator should not normally be redefined. To define equality semantics for a type, override the 'Object.Equals' member in the definition of that type. + + + The '{0}' operator should not normally be redefined. Consider using a different operator name + + + The '{0}' operator cannot be redefined. Consider using a different operator name + + + Expected module or namespace parent {0} + + + The struct, record or union type '{0}' implements the interface 'System.IComparable' explicitly. You must apply the 'CustomComparison' attribute to the type. + + + The struct, record or union type '{0}' implements the interface 'System.IComparable<_>' explicitly. You must apply the 'CustomComparison' attribute to the type, and should also provide a consistent implementation of the non-generic interface System.IComparable. + + + The struct, record or union type '{0}' implements the interface 'System.IStructuralComparable' explicitly. Apply the 'CustomComparison' attribute to the type. + + + This record contains fields from inconsistent types + + + DLLImport stubs cannot be inlined + + + Structs may only bind a 'this' parameter at member declarations + + + Unexpected expression at recursive inference point + + + This code is less generic than required by its annotations because the explicit type variable '{0}' could not be generalized. It was constrained to be '{1}'. + + + One or more of the explicit class or function type variables for this binding could not be generalized, because they were constrained to other types + + + A generic type parameter has been used in a way that constrains it to always be '{0}' + + + This type parameter has been used in a way that constrains it to always be '{0}' + + + The type parameters inferred for this value are not stable under the erasure of type abbreviations. This is due to the use of type abbreviations which drop or reorder type parameters, e.g. \n\ttype taggedInt<'a> = int or\n\ttype swap<'a,'b> = 'b * 'a.\nConsider declaring the type parameters for this value explicitly, e.g.\n\tlet f<'a,'b> ((x,y) : swap<'b,'a>) : swap<'a,'b> = (y,x). + + + Explicit type parameters may only be used on module or member bindings + + + You must explicitly declare either all or no type parameters when overriding a generic abstract method + + + The field labels and expected type of this record expression or pattern do not uniquely determine a corresponding record type + + + The field '{0}' appears twice in this record expression or pattern + + + Unknown union case + + + This code is not sufficiently generic. The type variable {0} could not be generalized because it would escape its scope. + + + A property cannot have explicit type parameters. Consider using a method instead. + + + A constructor cannot have explicit type parameters. Consider using a static construction method instead. + + + This instance member needs a parameter to represent the object being invoked. Make the member static or use the notation 'member x.Member(args) = ...'. + + + Unexpected source-level property specification in syntax tree + + + A static initializer requires an argument + + + An object constructor requires an argument + + + This static member should not have a 'this' parameter. Consider using the notation 'member Member(args) = ...'. + + + An explicit static initializer should use the syntax 'static new(args) = expr' + + + An explicit object constructor should use the syntax 'new(args) = expr' + + + Unexpected source-level property specification + + + This form of object expression is not used in F#. Use 'member this.MemberName ... = ...' to define member implementations in object expressions. + + + Invalid declaration + + + Attributes are not allowed within patterns + + + The generic function '{0}' must be given explicit type argument(s) + + + The method or function '{0}' should not be given explicit type argument(s) because it does not declare its type parameters explicitly + + + This value, type or method expects {0} type parameter(s) but was given {1} + + + The default, zero-initializing constructor of a struct type may only be used if all the fields of the struct type admit default initialization + + + Couldn't find Dispose on IDisposable, or it was overloaded + + + This value is not a literal and cannot be used in a pattern + + + This field is readonly + + + Named arguments must appear after all other arguments + + + This function value is being used to construct a delegate type whose signature includes a byref argument. You must use an explicit lambda expression taking {0} arguments. + + + The type '{0}' is not a type whose values can be enumerated with this syntax, i.e. is not compatible with either seq<_>, IEnumerable<_> or IEnumerable and does not have a GetEnumerator method + + + This recursive binding uses an invalid mixture of recursive forms + + + This is not a valid object construction expression. Explicit object constructors must either call an alternate constructor or initialize all fields of the object and specify a call to a super class constructor. + + + Invalid constraint + + + Invalid constraint: the type used for the constraint is sealed, which means the constraint could only be satisfied by at most one solution + + + An 'enum' constraint must be of the form 'enum<type>' + + + 'new' constraints must take one argument of type 'unit' and return the constructed type + + + This property has an invalid type. Properties taking multiple indexer arguments should have types of the form 'ty1 * ty2 -> ty3'. Properties returning functions should have types of the form '(ty1 -> ty2)'. + + + Expected unit-of-measure parameter, not type parameter. Explicit unit-of-measure parameters must be marked with the [<Measure>] attribute. + + + Expected type parameter, not unit-of-measure parameter + + + Expected type, not unit-of-measure + + + Expected unit-of-measure, not type + + + Units-of-measure cannot be used as prefix arguments to a type. Rewrite as postfix arguments in angle brackets. + + + Unit-of-measure cannot be used in type constructor application + + + This control construct may only be used if the computation expression builder defines a '{0}' method + + + This type has no nested types + + + Unexpected {0} in type expression + + + Type parameter cannot be used as type constructor + + + Illegal syntax in type expression + + + Anonymous unit-of-measure cannot be nested inside another unit-of-measure expression + + + Anonymous type variables are not permitted in this declaration + + + Unexpected / in type + + + Unexpected type arguments + + + Optional arguments are only permitted on type members + + + Name '{0}' not bound in pattern context + + + Non-primitive numeric literal constants cannot be used in pattern matches because they can be mapped to multiple different types through the use of a NumericLiteral module. Consider using replacing with a variable, and use 'when <variable> = <constant>' at the end of the match clause. + + + Type arguments cannot be specified here + + + Only active patterns returning exactly one result may accept arguments + + + Invalid argument to parameterized pattern label + + + Internal error. Invalid index into active pattern array + + + This union case does not take arguments + + + This union case takes one argument + + + This union case expects {0} arguments in tupled form + + + Field '{0}' is not static + + + This field is not a literal and cannot be used in a pattern + + + This is not a variable, constant, active recognizer or literal + + + This is not a valid pattern + + + Character range matches have been removed in F#. Consider using a 'when' pattern guard instead. + + + Illegal pattern + + + Syntax error - unexpected '?' symbol + + + Expected {0} expressions, got {1} + + + TcExprUndelayed: delayed + + + This expression form may only be used in sequence and computation expressions + + + Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces. + + + Invalid object, sequence or record expression + + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' + + + This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression + + + Unable to parse format string '{0}' + + + This list expression exceeds the maximum size for list literals. Use an array for larger literals and call Array.ToList. + + + The expression form 'expr then expr' may only be used as part of an explicit object constructor + + + Named arguments cannot be given to member trait calls + + + This is not a valid name for an enumeration case + + + This field is not mutable + + + This construct may only be used within list, array and sequence expressions, e.g. expressions of the form 'seq {{ ... }}', '[ ... ]' or '[| ... |]'. These use the syntax 'for ... in ... do ... yield...' to generate elements + + + This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'. + + + This construct may only be used within sequence or computation expressions + + + This construct may only be used within computation expressions + + + Invalid indexer expression + + + The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints + + + Cannot inherit from a variable type + + + Calls to object constructors on type parameters cannot be given arguments + + + The 'CompiledName' attribute cannot be used with this language element + + + '{0}' may only be used with named types + + + 'inherit' cannot be used on interface types. Consider implementing the interface by using 'interface ... with ... end' instead. + + + 'new' cannot be used on interface types. Consider using an object expression '{{ new ... with ... }}' instead. + + + Instances of this type cannot be created since it has been marked abstract or not all methods have been given implementations. Consider using an object expression '{{ new ... with ... }}' instead. + + + It is recommended that objects supporting the IDisposable interface are created using the syntax 'new Type(args)', rather than 'Type(args)' or 'Type' as a function value representing the constructor, to indicate that resources may be owned by the generated value + + + '{0}' may only be used to construct object types + + + Constructors for the type '{0}' must directly or indirectly call its implicit object constructor. Use a call to the implicit object constructor instead of a record expression. + + + The field '{0}' has been given a value, but is not present in the type '{1}' + + + No assignment given for field '{0}' of type '{1}' + + + Extraneous fields have been given values + + + Only overrides of abstract and virtual members may be specified in object expressions + + + The member '{0}' does not correspond to any abstract or virtual method available to override or implement. + + + The type {0} contains the member '{1}' but it is not a virtual or abstract method that is available to override or implement. + + + The member '{0}' does not accept the correct number of arguments. {1} argument(s) are expected, but {2} were given. The required signature is '{3}'.{4} + + + The member '{0}' does not accept the correct number of arguments. One overload accepts {1} arguments, but {2} were given. The required signature is '{3}'.{4} + + + A simple method name is required here + + + The types System.ValueType, System.Enum, System.Delegate, System.MulticastDelegate and System.Array cannot be used as super types in an object expression or class + + + 'new' must be used with a named type + + + Cannot create an extension of a sealed type + + + No arguments may be given when constructing a record value + + + Interface implementations cannot be given on construction expressions + + + Object construction expressions may only be used to implement constructors in class types + + + Only simple bindings of the form 'id = expr' can be used in construction expressions + + + Objects must be initialized by an object construction expression that calls an inherited object constructor and assigns a value to each field + + + Expected an interface type + + + Constructor expressions for interfaces do not take arguments + + + This object constructor requires arguments + + + 'new' may only be used with object constructors + + + At least one override did not correctly implement its corresponding abstract member + + + This numeric literal requires that a module '{0}' defining functions FromZero, FromOne, FromInt32, FromInt64 and FromString be in scope + + + Invalid record construction + + + The expression form {{ expr with ... }} may only be used with record types. To build object types use {{ new Type(...) with ... }} + + + The inherited type is not an object model type + + + Object construction expressions (i.e. record expressions with inheritance specifications) may only be used to implement constructors in object model types. Use 'new ObjectType(args)' to construct instances of object model types outside of constructors + + + '{{ }}' is not a valid expression. Records must include at least one field. Empty sequences are specified by using Seq.empty or an empty list '[]'. + + + This type is not a record type. Values of class and struct types must be created using calls to object constructors. + + + This type is not a record type + + + This construct is ambiguous as part of a computation expression. Nested expressions may be written using 'let _ = (...)' and nested computations using 'let! res = builder {{ ... }}'. + + + This construct is ambiguous as part of a sequence expression. Nested expressions may be written using 'let _ = (...)' and nested sequences using 'yield! seq {{... }}'. + + + 'do!' cannot be used within sequence expressions + + + The use of 'let! x = coll' in sequence expressions is not permitted. Use 'for x in coll' instead. + + + 'try'/'with' cannot be used within sequence expressions + + + In sequence expressions, multiple results are generated using 'yield!' + + + Invalid assignment + + + Invalid use of a type name + + + This type has no accessible object constructors + + + Invalid use of an interface type + + + Invalid use of a delegate constructor. Use the syntax 'new Type(args)' or just 'Type(args)'. + + + Property '{0}' is not static + + + Property '{0}' is not readable + + + This lookup cannot be used here + + + Property '{0}' is static + + + Property '{0}' cannot be set + + + Constructors must be applied to arguments and cannot be used as first-class values. If necessary use an anonymous function '(fun arg1 ... argN -> new Type(arg1,...,argN))'. + + + The syntax 'expr.id' may only be used with record labels, properties and fields + + + Event '{0}' is static + + + Event '{0}' is not static + + + The named argument '{0}' did not match any argument or mutable property + + + One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. + + + The unnamed arguments do not form a prefix of the arguments of the method called + + + Static optimization conditionals are only for use within the F# library + + + The corresponding formal argument is not optional + + + Invalid optional assignment to a property or field + + + A delegate constructor must be passed a single function value + + + A binding cannot be marked both 'use' and 'rec' + + + The 'VolatileField' attribute may only be used on 'let' bindings in classes + + + Attributes are not permitted on 'let' bindings in expressions + + + The 'DefaultValue' attribute may only be used on 'val' declarations + + + The 'ConditionalAttribute' attribute may only be used on members + + + This is not a valid name for an active pattern + + + The 'EntryPointAttribute' attribute may only be used on function definitions in modules + + + Mutable values cannot be marked 'inline' + + + Mutable values cannot have generic parameters + + + Mutable function values should be written 'let mutable f = (fun args -> ...)' + + + Only functions may be marked 'inline' + + + A literal value cannot be given the [<ThreadStatic>] or [<ContextStatic>] attributes + + + A literal value cannot be marked 'mutable' + + + A literal value cannot be marked 'inline' + + + Literal values cannot have generic parameters + + + This is not a valid constant expression + + + This type is not accessible from this code location + + + Unexpected condition in imported assembly: failed to decode AttributeUsage attribute + + + Unrecognized attribute target. Valid attribute targets are 'assembly', 'module', 'type', 'method', 'property', 'return', 'param', 'field', 'event', 'constructor'. + + + This attribute is not valid for use on this language element. Assembly attributes should be attached to a 'do ()' declaration, if necessary within an F# module. + + + This attribute is not valid for use on this language element + + + Optional arguments cannot be used in custom attributes + + + This property cannot be set + + + This property or field was not found on this custom attribute type + + + A custom attribute must be a reference type + + + The number of args for a custom attribute does not match the expected number of args for the attribute constructor + + + A custom attribute must invoke an object constructor + + + Attribute expressions must be calls to object constructors + + + This attribute cannot be used in this version of F# + + + Invalid inline specification + + + 'use' bindings must be of the form 'use <var> = <expr>' + + + Abstract members are not permitted in an augmentation - they must be defined as part of the type itself + + + Method overrides and interface implementations are not permitted here + + + No abstract or interface member was found that corresponds to this override + + + This override takes a different number of arguments to the corresponding abstract member. The following abstract members were found:{0} + + + This method already has a default implementation + + + The method implemented by this default is ambiguous + + + No abstract property was found that corresponds to this override + + + This property overrides or implements an abstract property but the abstract property doesn't have a corresponding {0} + + + Invalid signature for set member + + + This new member hides the abstract member '{0}'. Rename the member or use 'override' instead. + + + This new member hides the abstract member '{0}' once tuples, functions, units of measure and/or provided types are erased. Rename the member or use 'override' instead. + + + Interfaces cannot contain definitions of static initializers + + + Interfaces cannot contain definitions of object constructors + + + Interfaces cannot contain definitions of member overrides + + + Interfaces cannot contain definitions of concrete members. You may need to define a constructor on your type to indicate that the type is a class. + + + Constructors cannot be specified in exception augmentations + + + Structs cannot have an object constructor with no arguments. This is a restriction imposed on all CLI languages as structs automatically support a default constructor. + + + Constructors cannot be defined for this type + + + Recursive bindings that include member specifications can only occur as a direct augmentation of a type + + + Only simple variable patterns can be bound in 'let rec' constructs + + + Only record fields and simple, non-recursive 'let' bindings may be marked mutable + + + This member is not sufficiently generic + + + A declaration may only be the [<Literal>] attribute if a constant value is also given, e.g. 'val x : int = 1' + + + A declaration may only be given a value in a signature if the declaration has the [<Literal>] attribute + + + Thread-static and context-static variables must be static and given the [<DefaultValue>] attribute to indicate that the value is initialized to the default value on each new thread + + + Volatile fields must be marked 'mutable' and cannot be thread-static + + + Uninitialized 'val' fields must be mutable and marked with the '[<DefaultValue>]' attribute. Consider using a 'let' binding instead of a 'val' field. + + + Static 'val' fields in types must be mutable, private and marked with the '[<DefaultValue>]' attribute. They are initialized to the 'null' or 'zero' value for their type. Consider also using a 'static let mutable' binding in a class type. + + + This field requires a name + + + Invalid namespace, module, type or union case name + + + Explicit type declarations for constructors must be of the form 'ty1 * ... * tyN -> resTy'. Parentheses may be required around 'resTy' + + + Return types of union cases must be identical to the type being defined, up to abbreviations + + + This is not a valid value for an enumeration literal + + + The type '{0}' is not an interface type + + + Duplicate specification of an interface + + + A field/val declaration is not permitted here + + + A inheritance declaration is not permitted here + + + This declaration opens the module '{0}', which is marked as 'RequireQualifiedAccess'. Adjust your code to use qualified references to the elements of the module instead, e.g. 'List.map' instead of 'map'. This change will ensure that your code is robust as new constructs are added to libraries. + + + This declaration opens the namespace or module '{0}' through a partially qualified path. Adjust this code to use the full path of the namespace. This change will make your code more robust as new constructs are added to the F# and CLI libraries. + + + Local class bindings cannot be marked inline. Consider lifting the definition out of the class or else do not mark it as inline. + + + Type abbreviations cannot have members + + + As of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors. + + + Enumerations cannot have members + + + Measure declarations may have only static members + + + Structs cannot contain 'do' bindings because the default constructor for structs would not execute these bindings + + + Structs cannot contain value definitions because the default constructor for structs will not execute these bindings. Consider adding additional arguments to the primary constructor for the type. + + + Static value definitions may only be used in types with a primary constructor. Consider adding arguments to the type definition, e.g. 'type X(args) = ...'. + + + Measure declarations may have only static members: constructors are not available + + + A member and a local class binding both have the name '{0}' + + + Type abbreviations cannot have interface declarations + + + Enumerations cannot have interface declarations + + + This type is not an interface type + + + All implemented interfaces should be declared on the initial declaration of the type + + + A default implementation of this interface has already been added because the explicit implementation of the interface was not specified at the definition of the type + + + This member is not permitted in an interface implementation + + + This declaration element is not permitted in an augmentation + + + Types cannot contain nested type definitions + + + type, exception or module + + + type or module + + + The struct, record or union type '{0}' implements the interface 'System.IStructuralEquatable' explicitly. Apply the 'CustomEquality' attribute to the type. + + + The struct, record or union type '{0}' implements the interface 'System.IEquatable<_>' explicitly. Apply the 'CustomEquality' attribute to the type and provide a consistent implementation of the non-generic override 'System.Object.Equals(obj)'. + + + Explicit type specifications cannot be used for exception constructors + + + Exception abbreviations should not have argument lists + + + Abbreviations for Common IL exceptions cannot take arguments + + + Exception abbreviations must refer to existing exceptions or F# types deriving from System.Exception + + + Abbreviations for Common IL exception types must have a matching object constructor + + + Not an exception + + + Invalid module name + + + Invalid type extension + + + The attributes of this type specify multiple kinds for the type + + + The kind of the type specified by its attributes does not match the kind implied by its definition + + + Measure definitions cannot have type parameters + + + This type requires a definition + + + This type abbreviation has one or more declared type parameters that do not appear in the type being abbreviated. Type abbreviations must use all declared type parameters in the type being abbreviated. Consider removing one or more type parameters, or use a concrete type definition that wraps an underlying type, such as 'type C<'a> = C of ...'. + + + Structs, interfaces, enums and delegates cannot inherit from other types + + + Types cannot inherit from multiple concrete types + + + Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute + + + Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal + + + Generic types cannot be given the 'StructLayout' attribute + + + Only structs and classes without primary constructors may be given the 'StructLayout' attribute + + + The representation of this type is hidden by the signature. It must be given an attribute such as [<Sealed>], [<Class>] or [<Interface>] to indicate the characteristics of the type. + + + Only classes may be given the 'AbstractClass' attribute + + + Only types representing units-of-measure may be given the 'Measure' attribute + + + Accessibility modifiers are not permitted on overrides or interface implementations + + + Discriminated union types are always sealed + + + Record types are always sealed + + + Assembly code types are always sealed + + + Struct types are always sealed + + + Delegate types are always sealed + + + Enum types are always sealed + + + Interface types and delegate types cannot contain fields + + + Abbreviated types cannot be given the 'Sealed' attribute + + + Cannot inherit a sealed type + + + Cannot inherit from interface type. Use interface ... with instead. + + + Struct types cannot contain abstract members + + + Interface types cannot be sealed + + + Delegate specifications must be of the form 'typ -> typ' + + + Delegate specifications must not be curried types. Use 'typ * ... * typ -> typ' for multi-argument delegates, and 'typ -> (typ -> typ)' for delegates returning function values. + + + Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char + + + This type definition involves an immediate cyclic reference through an abbreviation + + + This type definition involves an immediate cyclic reference through a struct field or inheritance relation + + + The syntax 'type X with ...' is reserved for augmentations. Types whose representations are hidden but which have members are now declared in signatures using 'type X = ...'. You may also need to add the '[<Sealed>] attribute to the type definition in the signature + + + Members that extend interface, delegate or enum types must be placed in a module separate to the definition of the type. This module must either have the AutoOpen attribute or be opened explicitly by client code to bring the extension members into scope. + + + One or more of the declared type parameters for this type extension have a missing or wrong type constraint not matching the original type constraints on '{0}' + + + Type definitions may only have one 'inherit' specification and it must be the first declaration + + + 'let' and 'do' bindings must come before member and interface definitions in type definitions + + + This 'inherit' declaration specifies the inherited type but no arguments. Consider supplying arguments, e.g. 'inherit BaseType(args)'. + + + This 'inherit' declaration has arguments, but is not in a type with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. + + + This definition may only be used in a type with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. + + + Type abbreviations cannot have augmentations + + + The path '{0}' is a namespace. A module abbreviation may not abbreviate a namespace. + + + The type '{0}' is used in an invalid way. A value prior to '{1}' has an inferred type involving '{2}', which is an invalid forward reference. + + + The member '{0}' is used in an invalid way. A use of '{1}' has been inferred prior to the definition of '{2}', which is an invalid forward reference. + + + The attribute 'AutoOpen(\"{0}\")' in the assembly '{1}' did not refer to a valid module or namespace in that assembly and has been ignored + + + Undefined value '{0}' + + + Label {0} not found + + + Incorrect number of type arguments to local call + + + Dynamic invocation of {0} is not supported + + + Taking the address of a literal field is invalid + + + This operation involves taking the address of a value '{0}' represented using a local variable or other special representation. This is invalid. + + + Custom marshallers cannot be specified in F# code. Consider using a C# helper function. + + + The MarshalAs attribute could not be decoded + + + The signature for this external function contains type parameters. Constrain the argument and return types to indicate the types of the corresponding C function. + + + The DllImport attribute could not be decoded + + + Literal fields cannot be set + + + GenSetStorage: {0} was represented as a static method but was not an appropriate lambda expression + + + Mutable variables cannot escape their method + + + Compiler error: unexpected unrealized value + + + Main module of program is empty: nothing will happen when it is run + + + This type cannot be used for a literal field + + + Unexpected GetSet annotation on a property + + + The FieldOffset attribute could not be decoded + + + The StructLayout attribute could not be decoded + + + The DefaultAugmentation attribute could not be decoded + + + Reflected definitions cannot contain uses of the prefix splice operator '%' + + + Problem with codepage '{0}': {1} + + + Copyright (c) Microsoft Corporation. All Rights Reserved. + + + Freely distributed under the MIT Open Source License. https://github.com/Microsoft/visualfsharp/blob/master/License.txt + + + Name of the output file (Short form: -o) + + + Build a console executable + + + Build a Windows executable + + + Build a library (Short form: -a) + + + Build a module that can be added to another assembly + + + Delay-sign the assembly using only the public portion of the strong name key + + + Public-sign the assembly using only the public portion of the strong name key, and mark the assembly as signed + + + Write the xmldoc of the assembly to the given file + + + Specify a strong name key file + + + Specify a strong name key container + + + Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. + + + Only include optimization information essential for implementing inlined constructs. Inhibits cross-module inlining but improves binary compatibility. + + + Don't add a resource to the generated assembly containing F#-specific metadata + + + Print the inferred interface of the assembly to a file + + + Reference an assembly (Short form: -r) + + + Specify a Win32 resource file (.res) + + + Specify a Win32 manifest file + + + Do not include the default Win32 manifest + + + Embed all source files in the portable PDB file + + + Embed specific source files in the portable PDB file + + + Source link information file to embed in the portable PDB file + + + --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) + + + --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) + + + Source file is too large to embed in a portable PDB + + + Embed the specified managed resource + + + Link the specified resource to this assembly where the resinfo format is <file>[,<string name>[,public|private]] + + + Emit debug information (Short form: -g) + + + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + + + Enable optimizations (Short form: -O) + + + Enable or disable tailcalls + + + Produce a deterministic assembly (including module version GUID and timestamp) + + + Enable or disable cross-module optimizations + + + Report all warnings as errors + + + Report specific warnings as errors + + + Set a warning level (0-5) + + + Disable specific warning messages + + + Enable specific warnings that may be off by default + + + Generate overflow checks + + + Define conditional compilation symbols (Short form: -d) + + + Ignore ML compatibility warnings + + + Suppress compiler copyright message + + + Display this usage message (Short form: -?) + + + Read response file for more options + + + Specify the codepage used to read source files + + + Output messages in UTF-8 encoding + + + Output messages with fully qualified paths + + + Specify a directory for the include path which is used to resolve source files and assemblies (Short form: -I) + + + Base address for the library to be built + + + Do not reference the default CLI assemblies by default + + + Statically link the F# library and all referenced DLLs that depend on it into the assembly being generated + + + Statically link the given assembly and all referenced DLLs that depend on this assembly. Use an assembly name e.g. mylib, not a DLL name. + + + Use a resident background compilation service to improve compiler startup times. + + + Name the output debug file + + + Resolve assembly references using directory-based rules rather than MSBuild resolution + + + Unrecognized target '{0}', expected 'exe', 'winexe', 'library' or 'module' + + + Unrecognized debug type '{0}', expected 'pdbonly' or 'full' + + + Invalid warning level '{0}' + + + Short form of '{0}' + + + The command-line option '--cliroot' has been deprecated. Use an explicit reference to a specific copy of mscorlib.dll instead. + + + Use to override where the compiler looks for mscorlib.dll and framework components + + + - OUTPUT FILES - + + + - INPUT FILES - + + + - RESOURCES - + + + - CODE GENERATION - + + + - ADVANCED - + + + - MISCELLANEOUS - + + + - LANGUAGE - + + + - ERRORS AND WARNINGS - + + + Unknown --test argument: '{0}' + + + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + + + The command-line option '{0}' is for test purposes only + + + The command-line option '{0}' has been deprecated + + + The command-line option '{0}' has been deprecated. Use '{1}' instead. + + + The command-line option '{0}' has been deprecated. HTML document generation is now part of the F# Power Pack, via the tool FsHtmlDoc.exe. + + + Output warning and error messages in color + + + Enable high-entropy ASLR + + + Specify subsystem version of this assembly + + + Specify target framework profile of this assembly. Valid values are mscorlib, netcore or netstandard. Default - mscorlib + + + Emit debug information in quotations + + + Specify the preferred output language culture name (e.g. es-ES, ja-JP) + + + Don't copy FSharp.Core.dll along the produced binaries + + + Invalid version '{0}' for '--subsystemversion'. The version must be 4.00 or greater. + + + Invalid value '{0}' for '--targetprofile', valid values are 'mscorlib', 'netcore' or 'netstandard'. + + + Full name + + + and {0} other overloads + + + union case + + + active pattern result + + + active recognizer + + + field + + + event + + + property + + + extension + + + custom operation + + + argument + + + anonymous record field + + + patvar + + + namespace + + + module + + + namespace/module + + + from {0} + + + also from {0} + + + generated property + + + generated type + + + Found by AssemblyFolders registry key + + + Found by AssemblyFoldersEx registry key + + + .NET Framework + + + Global Assembly Cache + + + Recursive class hierarchy in type '{0}' + + + Invalid recursive reference to an abstract slot + + + The event '{0}' has a non-standard type. If this event is declared in another CLI language, you may need to access this event using the explicit {1} and {2} methods for the event. If this event is declared in F#, make the type of the event an instantiation of either 'IDelegateEvent<_>' or 'IEvent<_,_>'. + + + The type '{0}' is not accessible from this code location + + + The union cases or fields of the type '{0}' are not accessible from this code location + + + The value '{0}' is not accessible from this code location + + + The union case '{0}' is not accessible from this code location + + + The record, struct or class field '{0}' is not accessible from this code location + + + The struct or class field '{0}' is not accessible from this code location + + + This construct is experimental + + + No Invoke methods found for delegate type + + + More than one Invoke method found for delegate type + + + Delegates are not allowed to have curried signatures + + + Unexpected Expr.TyChoose + + + Note: Lambda-lifting optimizations have not been applied because of the use of this local constrained generic function as a first class value. Adding type constraints may resolve this condition. + + + Identifiers containing '@' are reserved for use in F# code generation + + + The identifier '{0}' is reserved for future use by F# + + + Missing variable '{0}' + + + Partial active patterns may only generate one result + + + The type '{0}' is required here and is unavailable. You must add a reference to assembly '{1}'. + + + A reference to the type '{0}' in assembly '{1}' was found, but the type could not be found in that assembly + + + Internal error or badly formed metadata: not enough type parameters were in scope while importing + + + A reference to the DLL {0} is required by assembly {1}. The imported type {2} is located in the first assembly and could not be resolved. + + + An imported assembly uses the type '{0}' but that type is not public + + + The value '{0}' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible + + + The value '{0}' was marked inline but was not bound in the optimization environment + + + Local value {0} not found during optimization + + + A value marked as 'inline' has an unexpected value + + + A value marked as 'inline' could not be inlined + + + Failed to inline the value '{0}' marked 'inline', perhaps because a recursive value was marked 'inline' + + + Recursive ValValue {0} + + + The indentation of this 'in' token is incorrect with respect to the corresponding 'let' + + + Possible incorrect indentation: this token is offside of context started at position {0}. Try indenting this token further or using standard formatting conventions. + + + The '|' tokens separating rules of this pattern match are misaligned by one column. Consider realigning your code or using further indentation. + + + Invalid module/expression/type + + + Multiple types exist called '{0}', taking different numbers of generic parameters. Provide a type instantiation to disambiguate the type resolution, e.g. '{1}'. + + + The instantiation of the generic type '{0}' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. '{1}'. + + + 'global' may only be used as the first name in a qualified path + + + This is not a constructor or literal, or a constructor is being used incorrectly + + + Unexpected empty long identifier + + + The record type '{0}' does not contain a label '{1}'. + + + Invalid field label + + + Invalid expression '{0}' + + + No constructors are available for the type '{0}' + + + The union type for union case '{0}' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('{1}') in the name you are using. + + + The record type for the record field '{0}' was defined with the RequireQualifiedAccessAttribute. Include the name of the record type ('{1}') in the name you are using. + + + Unexpected error creating debug information file '{0}' + + + This number is outside the allowable range for this integer type + + + '{0}' is not permitted as a character in operator names and is reserved for future use + + + Unexpected character '{0}' + + + This byte array literal contains characters that do not encode as a single byte + + + Identifiers followed by '{0}' are reserved for future use + + + This number is outside the allowable range for 8-bit signed integers + + + This number is outside the allowable range for hexadecimal 8-bit signed integers + + + This number is outside the allowable range for 8-bit unsigned integers + + + This number is outside the allowable range for 16-bit signed integers + + + This number is outside the allowable range for 16-bit unsigned integers + + + This number is outside the allowable range for 32-bit signed integers + + + This number is outside the allowable range for 32-bit unsigned integers + + + This number is outside the allowable range for 64-bit signed integers + + + This number is outside the allowable range for 64-bit unsigned integers + + + This number is outside the allowable range for signed native integers + + + This number is outside the allowable range for unsigned native integers + + + Invalid floating point number + + + This number is outside the allowable range for decimal literals + + + This number is outside the allowable range for 32-bit floats + + + This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0b0001 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). + + + This is not a valid byte literal + + + This is not a valid character literal + + + This Unicode encoding is only valid in string literals + + + This token is reserved for future use + + + TABs are not allowed in F# code unless the #indent \"off\" option is used + + + Invalid line number: '{0}' + + + #if directive must appear as the first non-whitespace character on a line + + + #else has no matching #if + + + #endif required for #else + + + #else directive must appear as the first non-whitespace character on a line + + + #endif has no matching #if + + + #endif directive must appear as the first non-whitespace character on a line + + + #if directive should be immediately followed by an identifier + + + Syntax error. Wrong nested #endif, unexpected tokens before it. + + + #! may only appear as the first line at the start of a file. + + + Expected single line comment or end of line + + + Infix operator member '{0}' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ... + + + Infix operator member '{0}' has {1} initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ... + + + Infix operator member '{0}' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ... + + + All record, union and struct types in FSharp.Core.dll must be explicitly labelled with 'StructuralComparison' or 'NoComparison' + + + The struct, record or union type '{0}' has the 'StructuralComparison' attribute but the type parameter '{1}' does not satisfy the 'comparison' constraint. Consider adding the 'comparison' constraint to the type parameter + + + The struct, record or union type '{0}' has the 'StructuralComparison' attribute but the component type '{1}' does not satisfy the 'comparison' constraint + + + The struct, record or union type '{0}' is not structurally comparable because the type parameter {1} does not satisfy the 'comparison' constraint. Consider adding the 'NoComparison' attribute to the type '{2}' to clarify that the type is not comparable + + + The struct, record or union type '{0}' is not structurally comparable because the type '{1}' does not satisfy the 'comparison' constraint. Consider adding the 'NoComparison' attribute to the type '{2}' to clarify that the type is not comparable + + + The struct, record or union type '{0}' does not support structural equality because the type parameter {1} does not satisfy the 'equality' constraint. Consider adding the 'NoEquality' attribute to the type '{2}' to clarify that the type does not support structural equality + + + The struct, record or union type '{0}' does not support structural equality because the type '{1}' does not satisfy the 'equality' constraint. Consider adding the 'NoEquality' attribute to the type '{2}' to clarify that the type does not support structural equality + + + The struct, record or union type '{0}' has the 'StructuralEquality' attribute but the type parameter '{1}' does not satisfy the 'equality' constraint. Consider adding the 'equality' constraint to the type parameter + + + The struct, record or union type '{0}' has the 'StructuralEquality' attribute but the component type '{1}' does not satisfy the 'equality' constraint + + + Each argument of the primary constructor for a struct must be given a type, for example 'type S(x1:int, x2: int) = ...'. These arguments determine the fields of the struct. + + + The value '{0}' is unused + + + The recursive object reference '{0}' is unused. The presence of a recursive object reference adds runtime initialization checks to members in this and derived types. Consider removing this recursive object reference. + + + A getter property may have at most one argument group + + + A setter property may have at most two argument groups + + + Invalid property getter or setter + + + An indexer property must be given at least one argument + + + This operation accesses a mutable top-level value defined in another assembly in an unsupported way. The value cannot be accessed through its address. Consider copying the expression to a mutable local, e.g. 'let mutable x = ...', and if necessary assigning the value back after the completion of the operation + + + Remove spaces between the type name and type parameter, e.g. \"type C<'T>\", not type \"C <'T>\". Type parameters must be placed directly adjacent to the type name. + + + Remove spaces between the type name and type parameter, e.g. \"C<'T>\", not \"C <'T>\". Type parameters must be placed directly adjacent to the type name. + + + The use of the type syntax 'int C' and 'C <int>' is not permitted here. Consider adjusting this type to be written in the form 'C<int>' + + + The module/namespace '{0}' from compilation unit '{1}' did not contain the module/namespace '{2}' + + + The module/namespace '{0}' from compilation unit '{1}' did not contain the val '{2}' + + + The module/namespace '{0}' from compilation unit '{1}' did not contain the namespace, module or type '{2}' + + + The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case + + + The parameter '{0}' was inferred to have byref type. Parameters of byref type must be given an explicit type annotation, e.g. 'x1: byref<int>'. When used, a byref parameter is implicitly dereferenced. + + + The generic member '{0}' has been used at a non-uniform instantiation prior to this program point. Consider reordering the members so this member occurs first. Alternatively, specify the full type of the member explicitly, including argument types, return type and any additional generic parameters and constraints. + + + The attribute '{0}' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. + + + Cannot call an abstract base member: '{0}' + + + Could not resolve the ambiguity in the use of a generic construct with an 'unmanaged' constraint at or near this position + + + This construct is for ML compatibility. {0}. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'. + + + The type '{0}' has been marked as having an Explicit layout, but the field '{1}' has not been marked with the 'FieldOffset' attribute + + + Interfaces inherited by other interfaces should be declared using 'inherit ...' instead of 'interface ...' + + + Invalid prefix operator + + + Invalid operator definition. Prefix operator definitions must use a valid prefix operator name. + + + The file extensions '.ml' and '.mli' are for ML compatibility + + + Consider using a file with extension '.ml' or '.mli' instead + + + Active pattern '{0}' is not a function + + + Active pattern '{0}' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x' + + + The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit) + + + Optional arguments must come at the end of the argument list, after any non-optional arguments + + + Attribute 'System.Diagnostics.ConditionalAttribute' is only valid on methods or attribute classes + + + Extension members cannot provide operator overloads. Consider defining the operator as part of the type definition instead. + + + The name of the MDB file must be <assembly-file-name>.mdb. The --pdb option will be ignored. + + + MDB generation failed. Could not find compatible member {0} + + + Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. + + + The union case named '{0}' conflicts with the generated type '{1}' + + + ReflectedDefinitionAttribute may not be applied to an instance member on a struct type, because the instance member takes an implicit 'this' byref parameter + + + DLLImport bindings must be static members in a class or function definitions in a module + + + When mscorlib.dll or FSharp.Core.dll is explicitly referenced the {0} option must also be passed + + + FSharp.Core.sigdata not found alongside FSharp.Core. File expected in {0}. Consider upgrading to a more recent version of FSharp.Core, where this file is no longer be required. + + + File '{0}' not found alongside FSharp.Core. File expected in {1}. Consider upgrading to a more recent version of FSharp.Core, where this file is no longer be required. + + + Filename '{0}' contains invalid character '{1}' + + + 'use!' bindings must be of the form 'use! <var> = <expr>' + + + Inner generic functions are not permitted in quoted expressions. Consider adding some type constraints until this function is no longer generic. + + + The type '{0}' is not a valid enumerator type , i.e. does not have a 'MoveNext()' method returning a bool, and a 'Current' property + + + End of file in triple-quote string begun at or before here + + + End of file in triple-quote string embedded in comment begun at or before here + + + This type test or downcast will ignore the unit-of-measure '{0}' + + + Expected type argument or static argument + + + Unmatched '<'. Expected closing '>' + + + Unexpected quotation operator '<@' in type definition. If you intend to pass a verbatim string as a static argument to a type provider, put a space between the '<' and '@' characters. + + + Attempted to parse this as an operator name, but failed + + + \U{0} is not a valid Unicode character escape sequence + + + '{0}' must be applied to an argument of type '{1}', but has been applied to an argument of type '{2}' + + + '{0}' can only be applied to optional arguments + + + The specified .NET Framework version '{0}' is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. + + + Invalid Magic value in CLR Header + + + Bad image format + + + Private key expected + + + RSA key expected + + + Invalid bit Length + + + Invalid RSAParameters structure - '{{0}}' expected + + + Invalid algId - 'Exponent' expected + + + Invalid signature size + + + No signature directory + + + Invalid Public Key blob + + + Exiting - too many errors + + + The documentation file has no .xml suffix + + + No implementation files specified + + + The attribute {0} specified version '{1}', but this value is invalid and has been ignored + + + Conflicting options specified: 'win32manifest' and 'win32res'. Only one of these can be used. + + + The code in assembly '{0}' makes uses of quotation literals. Static linking may not include components that make use of quotation literals unless all assemblies are compiled with at least F# 4.0. + + + Code in this assembly makes uses of quotation literals. Static linking may not include components that make use of quotation literals unless all assemblies are compiled with at least F# 4.0. + + + Static linking may not include a .EXE + + + Static linking may not include a mixed managed/unmanaged DLL + + + Ignoring mixed managed/unmanaged assembly '{0}' during static linking + + + Assembly '{0}' was referenced transitively and the assembly could not be resolved automatically. Static linking will assume this DLL has no dependencies on the F# library or other statically linked DLLs. Consider adding an explicit reference to this DLL. + + + Assembly '{0}' not found in dependency set of target binary. Statically linked roots should be specified using an assembly name, without a DLL or EXE extension. If this assembly was referenced explicitly then it is possible the assembly was not actually required by the generated binary, in which case it should not be statically linked. + + + The key file '{0}' could not be opened + + + A problem occurred writing the binary '{0}': {1} + + + The 'AssemblyVersionAttribute' has been ignored because a version was given using a command line option + + + Error emitting 'System.Reflection.AssemblyCultureAttribute' attribute -- 'Executables cannot be satellite assemblies, Culture should always be empty' + + + Option '--delaysign' overrides attribute 'System.Reflection.AssemblyDelaySignAttribute' given in a source file or added module + + + Option '--keyfile' overrides attribute 'System.Reflection.AssemblyKeyFileAttribute' given in a source file or added module + + + Option '--keycontainer' overrides attribute 'System.Reflection.AssemblyNameAttribute' given in a source file or added module + + + The assembly '{0}' is listed on the command line. Assemblies should be referenced using a command line flag such as '-r'. + + + The resident compilation service was not used because a problem occured in communicating with the server. + + + Problem with filename '{0}': Illegal characters in path. + + + Passing a .resx file ({0}) as a source file to the compiler is deprecated. Use resgen.exe to transform the .resx file into a .resources file to pass as a --resource option. If you are using MSBuild, this can be done via an <EmbeddedResource> item in the .fsproj project file. + + + Static linking may not be used on an assembly referencing mscorlib (e.g. a .NET Framework assembly) when generating an assembly that references System.Runtime (e.g. a .NET Core or Portable assembly). + + + An {0} specified version '{1}', but this value is a wildcard, and you have requested a deterministic build, these are in conflict. + + + Determinstic builds only support portable PDBs (--debug:portable or --debug:embedded) + + + Character '{0}' is not allowed in provided namespace name '{1}' + + + The provided type '{0}' returned a member with a null or empty member name + + + The provided type '{0}' returned a null member + + + The provided type '{0}' member info '{1}' has null declaring type + + + The provided type '{0}' has member '{1}' which has declaring type '{2}'. Expected declaring type to be the same as provided type. + + + Referenced assembly '{0}' has assembly level attribute '{1}' but no public type provider classes were found + + + Type '{0}' from type provider '{1}' has an empty namespace. Use 'null' for the global namespace. + + + Empty namespace found from the type provider '{0}'. Use 'null' for the global namespace. + + + Provided type '{0}' has 'IsGenericType' as true, but generic types are not supported. + + + Provided type '{0}' has 'IsArray' as true, but array types are not supported. + + + Invalid member '{0}' on provided type '{1}'. Provided type members must be public, and not be generic, virtual, or abstract. + + + Invalid member '{0}' on provided type '{1}'. Only properties, methods and constructors are allowed + + + Property '{0}' on provided type '{1}' has CanRead=true but there was no value from GetGetMethod() + + + Property '{0}' on provided type '{1}' has CanRead=false but GetGetMethod() returned a method + + + Property '{0}' on provided type '{1}' has CanWrite=true but there was no value from GetSetMethod() + + + Property '{0}' on provided type '{1}' has CanWrite=false but GetSetMethod() returned a method + + + One or more errors seen during provided type setup + + + Unexpected exception from provided type '{0}' member '{1}': {2} + + + Unsupported constant type '{0}'. Quotations provided by type providers can only contain simple constants. The implementation of the type provider may need to be adjusted by moving a value declared outside a provided quotation literal to be a 'let' binding inside the quotation literal. + + + Unsupported expression '{0}' from type provider. If you are the author of this type provider, consider adjusting it to provide a different provided expression. + + + Expected provided type named '{0}' but provided type has 'Name' with value '{1}' + + + Event '{0}' on provided type '{1}' has no value from GetAddMethod() + + + Event '{0}' on provided type '{1}' has no value from GetRemoveMethod() + + + Assembly attribute '{0}' refers to a designer assembly '{1}' which cannot be loaded or doesn't exist. {2} + + + The type provider does not have a valid constructor. A constructor taking either no arguments or one argument of type 'TypeProviderConfig' was expected. + + + The type provider '{0}' reported an error: {1} + + + The type provider '{0}' used an invalid parameter in the ParameterExpression: {1} + + + The type provider '{0}' provided a method with a name '{1}' and metadata token '{2}', which is not reported among its methods of its declaring type '{3}' + + + The type provider '{0}' provided a constructor which is not reported among the constructors of its declaring type '{1}' + + + A direct reference to the generated type '{0}' is not permitted. Instead, use a type definition, e.g. 'type TypeAlias = <path>'. This indicates that a type provider adds generated types to your assembly. + + + Expected provided type with path '{0}' but provided type has path '{1}' + + + Unexpected 'null' return value from provided type '{0}' member '{1}' + + + Unexpected exception from member '{0}' of provided type '{1}' member '{2}': {3} + + + Nested provided types do not take static arguments or generic parameters + + + Invalid static argument to provided type. Expected an argument of kind '{0}'. + + + An error occured applying the static arguments to a provided type + + + Unknown static argument kind '{0}' when resolving a reference to a provided type or method '{1}' + + + invalid namespace for provided type + + + invalid full name for provided type + + + The type provider returned 'null', which is not a valid return value from '{0}' + + + The type provider constructor has thrown an exception: {0} + + + Type provider '{0}' returned null from GetInvokerExpression. + + + The type provider '{0}' returned an invalid type from 'ApplyStaticArguments'. A type with name '{1}' was expected, but a type with name '{2}' was returned. + + + The type provider '{0}' returned an invalid method from 'ApplyStaticArgumentsForMethod'. A method with name '{1}' was expected, but a method with name '{2}' was returned. + + + This type test or downcast will erase the provided type '{0}' to the type '{1}' + + + This downcast will erase the provided type '{0}' to the type '{1}'. + + + This type test with a provided type '{0}' is not allowed because this provided type will be erased to '{1}' at runtime. + + + Cannot inherit from erased provided type + + + Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + + + Invalid member name. Members may not have name '.ctor' or '.cctor' + + + The function or member '{0}' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is '{1}'. + + + The number of type arguments did not match: '{0}' given, '{1}' expected. This may be related to a previously reported error. + + + Cannot override inherited member '{0}' because it is sealed + + + The type provider '{0}' reported an error in the context of provided type '{1}', member '{2}'. The error: {3} + + + An exception occurred when accessing the '{0}' of a provided type: {1} + + + The '{0}' of a provided type was null or empty. + + + Character '{0}' is not allowed in provided type name '{1}' + + + In queries, '{0}' must use a simple pattern + + + A custom query operation for '{0}' is required but not specified + + + Named static arguments must come after all unnamed static arguments + + + The static parameter '{0}' of the provided type or method '{1}' requires a value. Static parameters to type providers may be optionally specified using named arguments, e.g. '{2}<{3}=...>'. + + + No static parameter exists with name '{0}' + + + The static parameter '{0}' has already been given a value + + + Multiple static parameters exist with name '{0}' + + + A custom operation may not be used in conjunction with a non-value or recursive 'let' binding in another part of this computation expression + + + A custom operation may not be used in conjunction with 'use', 'try/with', 'try/finally', 'if/then/else' or 'match' operators within this computation expression + + + The custom operation '{0}' refers to a method which is overloaded. The implementations of custom operations may not be overloaded. + + + An if/then/else expression may not be used within queries. Consider using either an if/then expression, or use a sequence expression instead. + + + Invalid argument to 'methodhandleof' during codegen + + + A reference to a provided type was missing a value for the static parameter '{0}'. You may need to recompile one or more referenced assemblies. + + + A reference to a provided type had an invalid value '{0}' for a static parameter. You may need to recompile one or more referenced assemblies. + + + '{0}' is not used correctly. This is a custom operation in this query or computation expression. + + + '{0}' is not used correctly. Usage: {1}. This is a custom operation in this query or computation expression. + + + {0} var in collection {1} (outerKey = innerKey). Note that parentheses are required after '{2}' + + + {0} var in collection {1} (outerKey = innerKey) into group. Note that parentheses are required after '{2}' + + + {0} var in collection + + + '{0}' must be followed by a variable name. Usage: {1}. + + + Incorrect syntax for '{0}'. Usage: {1}. + + + '{0}' must come after a 'for' selection clause and be followed by the rest of the query. Syntax: ... {1} ... + + + '{0}' is used with an incorrect number of arguments. This is a custom operation in this query or computation expression. Expected {1} argument(s), but given {2}. + + + Expected an expression after this point + + + Expected a type after this point + + + Unmatched '[<'. Expected closing '>]' + + + Unexpected end of input in 'match' expression. Expected 'match <expr> with | <pat> -> <expr> | <pat> -> <expr> ...'. + + + Unexpected end of input in 'try' expression. Expected 'try <expr> with <rules>' or 'try <expr> finally <expr>'. + + + Unexpected end of input in 'while' expression. Expected 'while <expr> do <expr>'. + + + Unexpected end of input in 'for' expression. Expected 'for <pat> in <expr> do <expr>'. + + + Unexpected end of input in 'match' or 'try' expression + + + Unexpected end of input in 'then' branch of conditional expression. Expected 'if <expr> then <expr>' or 'if <expr> then <expr> else <expr>'. + + + Unexpected end of input in 'else' branch of conditional expression. Expected 'if <expr> then <expr>' or 'if <expr> then <expr> else <expr>'. + + + Unexpected end of input in body of lambda expression. Expected 'fun <pat> ... <pat> -> <expr>'. + + + Unexpected end of input in type arguments + + + Unexpected end of input in type signature + + + Unexpected end of input in type definition + + + Unexpected end of input in object members + + + Unexpected end of input in value, function or member definition + + + Unexpected end of input in expression + + + Unexpected end of type. Expected a name after this point. + + + Incomplete value or function definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword. + + + Incomplete value definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let!' keyword. + + + Incomplete value definition. If this is in an expression, the body of the expression must be indented to the same column as the 'use!' keyword. + + + Incomplete value definition. If this is in an expression, the body of the expression must be indented to the same column as the 'use' keyword. + + + Missing 'do' in 'while' expression. Expected 'while <expr> do <expr>'. + + + Missing 'do' in 'for' expression. Expected 'for <pat> in <expr> do <expr>'. + + + Invalid join relation in '{0}'. Expected 'expr <op> expr', where <op> is =, =?, ?= or ?=?. + + + Calls + + + Invalid number of generic arguments to type '{0}' in provided type. Expected '{1}' arguments, given '{2}'. + + + Invalid value '{0}' for unit-of-measure parameter '{1}' + + + Invalid value unit-of-measure parameter '{0}' + + + Property '{0}' on provided type '{1}' is neither readable nor writable as it has CanRead=false and CanWrite=false + + + A use of 'into' must be followed by the remainder of the computation + + + The operator '{0}' does not accept the use of 'into' + + + The definition of the custom operator '{0}' does not use a valid combination of attribute flags + + + This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute. + + + 'member val' definitions are only permitted in types with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. + + + Property definitions may not be declared mutable. To indicate that this property can be set, use 'member val PropertyName = expr with get,set'. + + + To indicate that this property can be set, use 'member val PropertyName = expr with get,set'. + + + Type '{0}' is illegal because in byref<T>, T cannot contain byref types. + + + F# supports array ranks between 1 and 32. The value {0} is not allowed. + + + In queries, use the form 'for x in n .. m do ...' for ranging over integers + + + 'while' expressions may not be used in queries + + + 'try/finally' expressions may not be used in queries + + + 'use' expressions may not be used in queries + + + 'let!', 'use!' and 'do!' expressions may not be used in queries + + + 'return' and 'return!' may not be used in queries + + + This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type. + + + 'try/with' expressions may not be used in queries + + + This 'let' definition may not be used in a query. Only simple value definitions may be used in queries. + + + Too many static parameters. Expected at most {0} parameters, but got {1} unnamed and {2} named parameters. + + + Invalid provided literal value '{0}' + + + The 'anycpu32bitpreferred' platform can only be used with EXE targets. You must use 'anycpu' instead. + + + This member, function or value declaration may not be declared 'inline' + + + The provider '{0}' returned a non-generated type '{1}' in the context of a set of generated types. Consider adjusting the type provider to only return generated types. + + + Arguments to query operators may require parentheses, e.g. 'where (x > y)' or 'groupBy (x.Length / 10)' + + + A quotation may not involve an assignment to or taking the address of a captured local variable + + + + 1 overload + + + + {0} overloads + + + Erased to + + + Unexpected token '{0}' or incomplete expression + + + Cannot find code target for this attribute, possibly because the code after the attribute is incomplete. + + + Type name cannot be empty. + + + Problem reading assembly '{0}': {1} + + + Invalid provided field. Provided fields of erased provided types must be literals. + + + (loading description...) + + + (description unavailable...) + + + A type variable has been constrained by multiple different class types. A type variable may only have one class constraint. + + + 'match' expressions may not be used in queries + + + Infix operator member '{0}' has {1} initial argument(s). Expected a tuple of 3 arguments + + + The operator '{0}' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'. + + + '{0}' must be followed by 'in'. Usage: {1}. + + + Neither 'member val' nor 'override val' definitions are permitted in object expressions. + + + Copy-and-update record expressions must include at least one field. + + + '_' cannot be used as field name + + + The provided types generated by this use of a type provider may not be used from other F# assemblies and should be marked internal or private. Consider using 'type internal TypeName = ...' or 'type private TypeName = ...'. + + + A property's getter and setter must have the same type. Property '{0}' has getter of type '{1}' but setter of type '{2}'. + + + Array method '{0}' is supplied by the runtime and cannot be directly used in code. For operations with array elements consider using family of GetArray/SetArray functions from LanguagePrimitives.IntrinsicFunctions module. + + + The union case '{0}' does not have a field named '{1}'. + + + The exception '{0}' does not have a field named '{1}'. + + + Active patterns do not have fields. This syntax is invalid. + + + The constructor does not have a field named '{0}'. + + + Union case/exception field '{0}' cannot be used more than once. + + + Named field '{0}' is used more than once. + + + Named field '{0}' conflicts with autogenerated name for anonymous field. + + + This literal expression or attribute argument results in an arithmetic overflow. + + + This is not valid literal expression. The [<Literal>] attribute will be ignored. + + + System.Runtime.InteropServices assembly is required to use UnknownWrapper\DispatchWrapper classes. + + + The mutable local '{0}' is implicitly allocated as a reference cell because it has been captured by a closure. This warning is for informational purposes only to indicate where implicit allocations are performed. + + + A type provider implemented GetStaticParametersForMethod, but ApplyStaticArgumentsForMethod was not implemented or invalid + + + An error occured applying the static arguments to a provided method + + + Unexpected character '{0}' in preprocessor expression + + + Unexpected token '{0}' in preprocessor expression + + + Incomplete preprocessor expression + + + Missing token '{0}' in preprocessor expression + + + An error occurred while reading the F# metadata node at position {0} in table '{1}' of assembly '{2}'. The node had no matching declaration. Please report this warning. You may need to recompile the F# assembly you are using. + + + Type inference caused the type variable {0} to escape its scope. Consider adding an explicit type parameter declaration or adjusting your code to be less generic. + + + Type inference caused an inference type variable to escape its scope. Consider adding type annotations to make your code less generic. + + + Redundant arguments are being ignored in function '{0}'. Expected {1} but got {2} arguments. + + + Lowercase literal '{0}' is being shadowed by a new pattern with the same name. Only uppercase and module-prefixed literals can be used as named patterns. + + + This literal pattern does not take arguments + + + Constructors are not permitted as extension members - they must be defined as part of the original definition of the type + + + Invalid response file '{0}' ( '{1}' ) + + + Response file '{0}' not found in '{1}' + + + Response file name '{0}' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long + + + Cannot find FSharp.Core.dll in compiler's directory + + + One tuple type is a struct tuple, the other is a reference tuple + + + This provided method requires static parameters + + + The conversion from {0} to {1} is a compile-time safe upcast, not a downcast. Consider using 'upcast' instead of 'downcast'. + + + The conversion from {0} to {1} is a compile-time safe upcast, not a downcast. Consider using the :> (upcast) operator instead of the :?> (downcast) operator. + + + The 'rec' on this module is implied by an outer 'rec' declaration and is being ignored + + + In a recursive declaration group, 'open' declarations must come first in each module + + + In a recursive declaration group, module abbreviations must come after all 'open' declarations and before other declarations + + + This declaration is not supported in recursive declaration groups + + + Invalid use of 'rec' keyword + + + If a union type has more than one case and is a struct, then all fields within the union type must be given unique names. + + + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. + + + Invalid use of 'fixed'. 'fixed' may only be used in a declaration of the form 'use x = fixed expr' where the expression is an array, the address of a field, the address of an array element or a string' + + + Could not find method System.Runtime.CompilerServices.OffsetToStringData in references when building 'fixed' expression. + + + The address of the variable '{0}' or a related expression cannot be used at this point. This is to ensure the address of the local value does not escape its scope. + + + {0} is an active pattern and cannot be treated as a discriminated union case with named fields. + + + The default value does not have the same type as the argument. The DefaultParameterValue attribute and any Optional attribute will be ignored. Note: 'null' needs to be annotated with the correct type, e.g. 'DefaultParameterValue(null:obj)'. + + + The system type '{0}' was required but no referenced system DLL contained this type + + + The member '{0}' matches multiple overloads of the same method.\nPlease restrict it to one of the following:{1}. + + + Method or object constructor '{0}' is not static + + + Unexpected symbol '=' in expression. Did you intend to use 'for x in y .. z do' instead? + + + Two anonymous record types are from different assemblies '{0}' and '{1}' + + + Two anonymous record types have mismatched sets of field names '{0}' and '{1}' + + + Indicates a method that either has no implementation in the type in which it is declared or that is virtual and has a default implementation. + + + Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. + + + Used to give the current class object an object name. Also used to give a name to a whole pattern within a pattern match. + + + Used to verify code during debugging. + + + Used as the name of the base class object. + + + In verbose syntax, indicates the start of a code block. + + + In verbose syntax, indicates the start of a class definition. + + + Indicates an implementation of an abstract method; used together with an abstract method declaration to create a virtual method. + + + Used to declare a delegate. + + + Used in looping constructs or to execute imperative code. + + + In verbose syntax, indicates the end of a block of code in a looping expression. + + + Used to convert to a type that is lower in the inheritance chain. + + + In a for expression, used when counting in reverse. + + + Used in conditional branching. A short form of else if. + + + Used in conditional branching. + + + In type definitions and type extensions, indicates the end of a section of member definitions. In verbose syntax, used to specify the end of a code block that starts with the begin keyword. + + + Used to declare an exception type. + + + Indicates that a declared program element is defined in another binary or assembly. + + + Used as a Boolean literal. + + + Used together with try to introduce a block of code that executes regardless of whether an exception occurs. + + + Used in looping constructs. + + + Used in lambda expressions, also known as anonymous functions. + + + Used as a shorter alternative to the fun keyword and a match expression in a lambda expression that has pattern matching on a single argument. + + + Used to reference the top-level .NET namespace. + + + Used in conditional branching constructs. + + + Used for sequence expressions and, in verbose syntax, to separate expressions from bindings. + + + Used to specify a base class or base interface. + + + Used to indicate a function that should be integrated directly into the caller's code. + + + Used to declare and implement interfaces. + + + Used to specify that a member is visible inside an assembly but not outside it. + + + Used to specify a computation that is to be performed only when a result is needed. + + + Used to associate, or bind, a name to a value or function. + + + Used in computation expressions to bind a name to the result of another computation expression. + + + Used to branch by comparing a value to a pattern. + + + Used in computation expressions to pattern match directly over the result of another computation expression. + + + Used to declare a property or method in an object type. + + + Used to associate a name with a group of related types, values, and functions, to logically separate it from other code. + + + Used to declare a variable, that is, a value that can be changed. + + + Used to associate a name with a group of related types and modules, to logically separate it from other code. + + + Used to declare, define, or invoke a constructor that creates or that can create an object. Also used in generic parameter constraints to indicate that a type must have a certain constructor. + + + Not actually a keyword. However, not struct in combination is used as a generic parameter constraint. + + + Indicates the absence of an object. Also used in generic parameter constraints. + + + Used in discriminated unions to indicate the type of categories of values, and in delegate and exception declarations. + + + Used to make the contents of a namespace or module available without qualification. + + + Used with Boolean conditions as a Boolean or operator. Equivalent to ||. Also used in member constraints. + + + Used to implement a version of an abstract or virtual method that differs from the base version. + + + Restricts access to a member to code in the same type or module. + + + Allows access to a member from outside the type. + + + Used to indicate that a function is recursive. + + + Used to provide a value for the result of the containing computation expression. + + + Used to provide a value for the result of the containing computation expression, where that value itself comes from the result another computation expression. + + + Used in query expressions to specify what fields or columns to extract. Note that this is a contextual keyword, which means that it is not actually a reserved word and it only acts like a keyword in appropriate context. + + + Used to indicate a method or property that can be called without an instance of a type, or a value member that is shared among all instances of a type. + + + Used to declare a structure type. Also used in generic parameter constraints. Used for OCaml compatibility in module definitions. + + + Used in conditional expressions. Also used to perform side effects after object construction. + + + Used in for loops to indicate a range. + + + Used to introduce a block of code that might generate an exception. Used together with with or finally. + + + Used to declare a class, record, structure, discriminated union, enumeration type, unit of measure, or type abbreviation. + + + Used to convert to a type that is higher in the inheritance chain. + + + Used instead of let for values that implement IDisposable" + + + Used instead of let! in computation expressions for computation expression results that implement IDisposable. + + + Used in a signature to indicate a value, or in a type to declare a member, in limited situations. + + + Indicates the .NET void type. Used when interoperating with other .NET languages. + + + Used for Boolean conditions (when guards) on pattern matches and to introduce a constraint clause for a generic type parameter. + + + Introduces a looping construct. + + + Used together with the match keyword in pattern matching expressions. Also used in object expressions, record copying expressions, and type extensions to introduce member definitions, and to introduce exception handlers. + + + Used in a sequence expression to produce a value for a sequence. + + + Used in a computation expression to append the result of a given computation expression to a collection of results for the containing computation expression. + + + In function types, delimits arguments and return values. Yields an expression (in sequence expressions); equivalent to the yield keyword. Used in match expressions + + + Assigns a value to a variable. + + + Converts a type to type that is higher in the hierarchy. + + + Converts a type to a type that is lower in the hierarchy. + + + Delimits a typed code quotation. + + + Delimits a untyped code quotation. + + + {0} '{1}' not found in assembly '{2}'. A possible cause may be a version incompatibility. You may need to explicitly reference the correct version of this assembly to allow all referenced components to use the correct version. + + + {0} '{1}' not found in type '{2}' from assembly '{3}'. A possible cause may be a version incompatibility. You may need to explicitly reference the correct version of this assembly to allow all referenced components to use the correct version. + + + is + + + This value is not a function and cannot be applied. + + + This value is not a function and cannot be applied. Did you intend to access the indexer via {0}.[index] instead? + + + This expression is not a function and cannot be applied. Did you intend to access the indexer via expr.[index] instead? + + + + + + + This value is not a function and cannot be applied. Did you forget to terminate a declaration? + + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + + An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. + + + This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. + + + This expression returns a value of type '{0}' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'. + + + This expression returns a value of type '{0}' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'. + + + The file '{0}' changed on disk unexpectedly, please reload. + + + The byref pointer is readonly, so this write is not permitted. + + + A ReadOnly attribute has been applied to a struct type with a mutable field. + + + A byref pointer returned by a function or method is implicitly dereferenced as of F# 4.5. To acquire the return value as a pointer, use the address-of operator, e.g. '&f(x)' or '&obj.Method(arg1, arg2)'. + + + A type annotated with IsByRefLike must also be a struct. Consider adding the [<Struct>] attribute to the type. + + + The address of a value returned from the expression cannot be used at this point. This is to ensure the address of the local value does not escape its scope. + + + This value can't be assigned because the target '{0}' may refer to non-stack-local memory, while the expression being assigned is assessed to potentially refer to stack-local memory. This is to help prevent pointers to stack-bound memory escaping their scope. + + + A value defined in a module must be mutable in order to take its address, e.g. 'let mutable x = ...' + + + A type annotated with IsReadOnly must also be a struct. Consider adding the [<Struct>] attribute to the type. + + + Struct members cannot return the address of fields of the struct by reference + + + The function or method call cannot be used at this point, because one argument that is a byref of a non-stack-local Span or IsByRefLike type is used with another argument that is a stack-local Span or IsByRefLike type. This is to ensure the address of the local value does not escape its scope. + + + The Span or IsByRefLike variable '{0}' cannot be used at this point. This is to ensure the address of the local value does not escape its scope. + + + A Span or IsByRefLike value returned from the expression cannot be used at ths point. This is to ensure the address of the local value does not escape its scope. + + + Cannot take the address of the value returned from the expression. Assign the returned value to a let-bound value before taking the address. + + + Cannot call the byref extension method '{0}. The first parameter requires the value to be mutable or a non-readonly byref type. + + + Byref types are not allowed to have optional type extensions. + + + Cannot partially apply the extension method '{0}' because the first parameter is a byref type. + + + This type does not inherit Attribute, it will not work correctly with other .NET languages. + + + Invalid anonymous record expression + + + Invalid anonymous record type + + + The input to a copy-and-update expression that creates an anonymous record must be either an anonymous record or a record + + + The type '{0}' does not support a nullness qualitification. + + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + + The constraints 'null' and 'not null' are inconsistent + + + The constraints 'struct' and 'null' are inconsistent + + + The constraints 'delegate' and 'comparison' are inconsistent + + + The /checknulls language feature is not enabled + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. + + + The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + + Enable nullness declarations and checks + + + Specify the language version + + \ No newline at end of file diff --git a/src/buildtools/buildtools.proj b/src/buildtools/buildtools.proj index 593f086dd07..630bb678561 100644 --- a/src/buildtools/buildtools.proj +++ b/src/buildtools/buildtools.proj @@ -2,7 +2,8 @@ Debug - + true + @@ -10,23 +11,23 @@ - + - + - + - + - + diff --git a/src/buildtools/buildtools.targets b/src/buildtools/buildtools.targets index 303ab00825d..185fd4d0599 100644 --- a/src/buildtools/buildtools.targets +++ b/src/buildtools/buildtools.targets @@ -20,7 +20,7 @@ BeforeTargets="CoreCompile"> - $(ArtifactsDir)\Bootstrap\fslex.dll + $(ArtifactsDir)\Bootstrap\fslex\fslex.dll @@ -43,7 +43,7 @@ BeforeTargets="CoreCompile"> - $(ArtifactsDir)\Bootstrap\fsyacc.dll + $(ArtifactsDir)\Bootstrap\fsyacc\fsyacc.dll diff --git a/src/fsharp/AccessibilityLogic.fs b/src/fsharp/AccessibilityLogic.fs index 4070ea9b402..5881e2ae9bc 100644 --- a/src/fsharp/AccessibilityLogic.fs +++ b/src/fsharp/AccessibilityLogic.fs @@ -10,6 +10,7 @@ open FSharp.Compiler.Infos open FSharp.Compiler.Tast open FSharp.Compiler.Tastops open FSharp.Compiler.TcGlobals +open FSharp.Compiler.AbstractIL.Internal.Library #if !NO_EXTENSIONTYPING open FSharp.Compiler.ExtensionTyping @@ -81,7 +82,7 @@ let private IsILMemberAccessible g amap m (tcrefOfViewedItem : TyconRef) ad acce match tcrefViewedFromOption with | None -> false | Some tcrefViewedFrom -> - ExistsHeadTypeInEntireHierarchy g amap m (generalizedTyconRef tcrefViewedFrom) tcrefOfViewedItem) + ExistsHeadTypeInEntireHierarchy g amap m (generalizedTyOfTyconRef g tcrefViewedFrom) tcrefOfViewedItem) let accessibleByInternalsVisibleTo = (access = ILMemberAccess.Assembly || access = ILMemberAccess.FamilyOrAssembly) && @@ -93,7 +94,7 @@ let private IsILMemberAccessible g amap m (tcrefOfViewedItem : TyconRef) ad acce match tcrefViewedFromOption with | None -> false | Some tcrefViewedFrom -> - ExistsHeadTypeInEntireHierarchy g amap m (generalizedTyconRef tcrefViewedFrom) tcrefOfViewedItem + ExistsHeadTypeInEntireHierarchy g amap m (generalizedTyOfTyconRef g tcrefViewedFrom) tcrefOfViewedItem (access = ILMemberAccess.Public) || accessibleByFamily || accessibleByInternalsVisibleTo || accessibleByFamilyAndAssembly @@ -327,10 +328,16 @@ let IsPropInfoAccessible g amap m ad = function | ProvidedProp (amap, tppi, m) as pp-> let access = let a = tppi.PUntaint((fun ppi -> - let tryGetILAccessForProvidedMethodBase (mi : ProvidedMethodBase) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let tryGetILAccessForProvidedMethodBase (mi : ProvidedMethodInfo) = +#else + let tryGetILAccessForProvidedMethodBase (mi : ProvidedMethodInfo?) = // TODO NULLNESS: using ProvidedMethodBase? gives a nullness warning +#endif match mi with | null -> None - | mi -> Some(ComputeILAccess mi.IsPublic mi.IsFamily mi.IsFamilyOrAssembly mi.IsFamilyAndAssembly) + | NonNull mi -> + Some(ComputeILAccess mi.IsPublic mi.IsFamily mi.IsFamilyOrAssembly mi.IsFamilyAndAssembly) + match tryGetILAccessForProvidedMethodBase(ppi.GetGetMethod()) with | None -> tryGetILAccessForProvidedMethodBase(ppi.GetSetMethod()) | x -> x), m) diff --git a/src/fsharp/AugmentWithHashCompare.fs b/src/fsharp/AugmentWithHashCompare.fs index ce562dedaa4..562218f93b2 100644 --- a/src/fsharp/AugmentWithHashCompare.fs +++ b/src/fsharp/AugmentWithHashCompare.fs @@ -43,21 +43,21 @@ let mkEqualsSlotSig (g: TcGlobals) = let mkThisTy g ty = if isStructTy g ty then mkByrefTy g ty else ty -let mkCompareObjTy g ty = (mkThisTy g ty) --> (g.obj_ty --> g.int_ty) +let mkCompareObjTy g ty = mkFunTy g (mkThisTy g ty) (mkFunTy g g.obj_ty g.int_ty) -let mkCompareTy g ty = (mkThisTy g ty) --> (ty --> g.int_ty) +let mkCompareTy g ty = mkFunTy g (mkThisTy g ty) (mkFunTy g ty g.int_ty) -let mkCompareWithComparerTy g ty = (mkThisTy g ty) --> ((mkRefTupledTy g [g.obj_ty ; g.IComparer_ty]) --> g.int_ty) +let mkCompareWithComparerTy g ty = mkFunTy g (mkThisTy g ty) (mkFunTy g (mkRefTupledTy g [g.obj_ty ; g.IComparer_ty]) g.int_ty) -let mkEqualsObjTy g ty = (mkThisTy g ty) --> (g.obj_ty --> g.bool_ty) +let mkEqualsObjTy g ty = mkFunTy g (mkThisTy g ty) (mkFunTy g g.obj_ty g.bool_ty) -let mkEqualsTy g ty = (mkThisTy g ty) --> (ty --> g.bool_ty) +let mkEqualsTy g ty = mkFunTy g (mkThisTy g ty) (mkFunTy g ty g.bool_ty) -let mkEqualsWithComparerTy g ty = (mkThisTy g ty) --> ((mkRefTupledTy g [g.obj_ty ; g.IEqualityComparer_ty]) --> g.bool_ty) +let mkEqualsWithComparerTy g ty = mkFunTy g (mkThisTy g ty) (mkFunTy g (mkRefTupledTy g [g.obj_ty ; g.IEqualityComparer_ty]) g.bool_ty) -let mkHashTy g ty = (mkThisTy g ty) --> (g.unit_ty --> g.int_ty) +let mkHashTy g ty = mkFunTy g (mkThisTy g ty) (mkFunTy g g.unit_ty g.int_ty) -let mkHashWithComparerTy g ty = (mkThisTy g ty) --> (g.IEqualityComparer_ty --> g.int_ty) +let mkHashWithComparerTy g ty = mkFunTy g (mkThisTy g ty) (mkFunTy g g.IEqualityComparer_ty g.int_ty) //------------------------------------------------------------------------- // Polymorphic comparison @@ -174,7 +174,7 @@ let mkEqualsTestConjuncts g m exprs = let mkMinimalTy (g: TcGlobals) (tcref: TyconRef) = if tcref.Deref.IsExceptionDecl then [], g.exn_ty - else generalizeTyconRef tcref + else generalizeTyconRef g tcref // check for nulls let mkBindNullComparison g m thise thate expr = @@ -783,7 +783,7 @@ let CheckAugmentationAttribs isImplementation g amap (tycon: Tycon) = errorR(Error(FSComp.SR.augInvalidAttrs(), m)) let hasNominalInterface tcref = - let ty = generalizedTyconRef (mkLocalTyconRef tycon) + let ty = generalizedTyOfTyconRef g (mkLocalTyconRef tycon) ExistsHeadTypeInEntireHierarchy g amap tycon.Range ty tcref let hasExplicitICompare = @@ -950,10 +950,10 @@ let MakeBindingsForCompareAugmentation g (tycon: Tycon) = mkApps g ((exprForValRef m vref2, vref2.Type), (if isNil tinst then [] else [tinst]), [thise;thate], m) - mkLambdas m tps [thisv;thatobjv] (comparee, g.int_ty) + mkLambdas g m tps [thisv; thatobjv] (comparee, g.int_ty) let rhs2 = let thisv, thatv, comparee = comparef g tcref tycon - mkLambdas m tps [thisv;thatv] (comparee, g.int_ty) + mkLambdas g m tps [thisv; thatv] (comparee, g.int_ty) [ // This one must come first because it may be inlined into the second mkCompGenBind vspec2 rhs2 mkCompGenBind vspec1 rhs1; ] @@ -981,7 +981,7 @@ let MakeBindingsForCompareWithComparerAugmentation g (tycon: Tycon) = let rhs = let comparee = comparef g tcref tycon (thisv, thise) (thatobjv, thate) compe let comparee = if isUnitTy g ty then mkZero g m else comparee - mkMultiLambdas m tps [[thisv];[thatobjv;compv]] (comparee, g.int_ty) + mkMultiLambdas g m tps [[thisv]; [thatobjv; compv]] (comparee, g.int_ty) [mkCompGenBind vspec rhs] if tycon.IsUnionTycon then mkCompare mkUnionCompareWithComparer elif tycon.IsRecordTycon || tycon.IsStructOrEnumTycon then mkCompare mkRecdCompareWithComparer @@ -1000,18 +1000,17 @@ let MakeBindingsForEqualityWithComparerAugmentation (g: TcGlobals) (tycon: Tycon let withcGetHashCodeExpr = let compv, compe = mkCompGenLocal m "comp" g.IEqualityComparer_ty let thisv, hashe = hashf g tcref tycon compe - mkLambdas m tps [thisv;compv] (hashe, g.int_ty) + mkLambdas g m tps [thisv; compv] (hashe, g.int_ty) // build the equals rhs let withcEqualsExpr = - let _tinst, ty = mkMinimalTy g tcref - let thisv, thise = mkThisVar g m ty - let thatobjv, thatobje = mkCompGenLocal m "obj" g.obj_ty - let thatv, thate = mkCompGenLocal m "that" ty - let compv, compe = mkCompGenLocal m "comp" g.IEqualityComparer_ty - let equalse = equalsf g tcref tycon (thisv, thise) thatobje (thatv, thate) compe - mkMultiLambdas m tps [[thisv];[thatobjv;compv]] (equalse, g.bool_ty) - + let _tinst,ty = mkMinimalTy g tcref + let thisv,thise = mkThisVar g m ty + let thatobjv,thatobje = mkCompGenLocal m "obj" g.obj_ty + let thatv,thate = mkCompGenLocal m "that" ty + let compv,compe = mkCompGenLocal m "comp" g.IEqualityComparer_ty + let equalse = equalsf g tcref tycon (thisv, thise) thatobje (thatv,thate) compe + mkMultiLambdas g m tps [[thisv];[thatobjv;compv]] (equalse,g.bool_ty) let objGetHashCodeExpr = let tinst, ty = mkMinimalTy g tcref @@ -1024,7 +1023,7 @@ let MakeBindingsForEqualityWithComparerAugmentation (g: TcGlobals) (tycon: Tycon let compe = mkILCallGetEqualityComparer g m mkApps g ((exprForValRef m withcGetHashCodeVal, withcGetHashCodeVal.Type), (if isNil tinst then [] else [tinst]), [thise; compe], m) - mkLambdas m tps [thisv; unitv] (hashe, g.int_ty) + mkLambdas g m tps [thisv; unitv] (hashe, g.int_ty) [(mkCompGenBind withcGetHashCodeVal.Deref withcGetHashCodeExpr) (mkCompGenBind objGetHashCodeVal.Deref objGetHashCodeExpr) @@ -1044,8 +1043,8 @@ let MakeBindingsForEqualsAugmentation (g: TcGlobals) (tycon: Tycon) = | Some (objEqualsVal, nocEqualsVal) -> // this is the body of the real strongly typed implementation let nocEqualsExpr = - let thisv, thatv, equalse = equalsf g tcref tycon - mkLambdas m tps [thisv;thatv] (equalse, g.bool_ty) + let thisv,thatv,equalse = equalsf g tcref tycon + mkLambdas g m tps [thisv;thatv] (equalse, g.bool_ty) // this is the body of the override let objEqualsExpr = @@ -1061,7 +1060,7 @@ let MakeBindingsForEqualsAugmentation (g: TcGlobals) (tycon: Tycon) = (mkApps g ((exprForValRef m nocEqualsVal, nocEqualsVal.Type), (if isNil tinst then [] else [tinst]), [thise;thate], m)) (mkFalse g m) - mkLambdas m tps [thisv;thatobjv] (equalse, g.bool_ty) + mkLambdas g m tps [thisv;thatobjv] (equalse, g.bool_ty) [ mkCompGenBind nocEqualsVal.Deref nocEqualsExpr diff --git a/src/fsharp/CheckFormatStrings.fs b/src/fsharp/CheckFormatStrings.fs index 1622a61351c..4b791ab0241 100644 --- a/src/fsharp/CheckFormatStrings.fs +++ b/src/fsharp/CheckFormatStrings.fs @@ -257,27 +257,27 @@ let parseFormatStringInternal (m:range) (g: TcGlobals) (context: FormatStringChe | 'O' -> checkOtherFlags ch collectSpecifierLocation relLine relCol 1 - parseLoop ((posi, NewInferenceType ()) :: acc) (i+1, relLine, relCol+1) + parseLoop ((posi, NewInferenceType g) :: acc) (i+1, relLine, relCol+1) | 'A' -> match info.numPrefixIfPos with | None // %A has BindingFlags=Public, %+A has BindingFlags=Public | NonPublic | Some '+' -> collectSpecifierLocation relLine relCol 1 - parseLoop ((posi, NewInferenceType ()) :: acc) (i+1, relLine, relCol+1) + parseLoop ((posi, NewInferenceType g) :: acc) (i+1, relLine, relCol+1) | Some _ -> failwithf "%s" <| FSComp.SR.forDoesNotSupportPrefixFlag(ch.ToString(), (Option.get info.numPrefixIfPos).ToString()) | 'a' -> checkOtherFlags ch - let xty = NewInferenceType () - let fty = bty --> (xty --> cty) + let xty = NewInferenceType g + let fty = mkFunTy g bty (mkFunTy g xty cty) collectSpecifierLocation relLine relCol 2 parseLoop ((Option.map ((+)1) posi, xty) :: (posi, fty) :: acc) (i+1, relLine, relCol+1) | 't' -> checkOtherFlags ch collectSpecifierLocation relLine relCol 1 - parseLoop ((posi, bty --> cty) :: acc) (i+1, relLine, relCol+1) + parseLoop ((posi, mkFunTy g bty cty) :: acc) (i+1, relLine, relCol+1) | c -> failwithf "%s" <| FSComp.SR.forBadFormatSpecifierGeneral(String.make 1 c) @@ -289,7 +289,7 @@ let parseFormatStringInternal (m:range) (g: TcGlobals) (context: FormatStringChe let ParseFormatString m g formatStringCheckContext fmt bty cty dty = let argtys, specifierLocations = parseFormatStringInternal m g formatStringCheckContext fmt bty cty - let aty = List.foldBack (-->) argtys dty + let aty = List.foldBack (mkFunTy g) argtys dty let ety = mkRefTupledTy g argtys (aty, ety), specifierLocations diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 237b6ae70dd..b51cb081a32 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -192,7 +192,11 @@ let GetRangeOfDiagnostic(err: PhasedDiagnostic) = | NonRigidTypar(_, _, _, _, _, m) | ConstraintSolverTupleDiffLengths(_, _, _, m, _) | ConstraintSolverInfiniteTypes(_, _, _, _, m, _) - | ConstraintSolverMissingConstraint(_, _, _, m, _) + | ConstraintSolverMissingConstraint(_, _, _, m, _) + | ConstraintSolverNullnessWarningEquivWithTypes(_, _, _, _, _, m, _) + | ConstraintSolverNullnessWarningWithTypes(_, _, _, _, _, m, _) + | ConstraintSolverNullnessWarningWithType(_, _, _, m, _) + | ConstraintSolverNonNullnessWarningWithType(_, _, _, m, _) | ConstraintSolverTypesNotInEqualityRelation(_, _, _, m, _, _) | ConstraintSolverError(_, m, _) | ConstraintSolverTypesNotInSubsumptionRelation(_, _, _, m, _) @@ -370,6 +374,10 @@ let GetDiagnosticNumber(err: PhasedDiagnostic) = | :? TypeProviderError as e -> e.Number #endif | ErrorsFromAddingSubsumptionConstraint (_, _, _, _, _, ContextInfo.DowncastUsedInsteadOfUpcast _, _) -> fst (FSComp.SR.considerUpcast("", "")) + | ConstraintSolverNullnessWarningEquivWithTypes _ -> 3261 + | ConstraintSolverNullnessWarningWithTypes _ -> 3262 + | ConstraintSolverNullnessWarningWithType _ -> 3263 + | ConstraintSolverNonNullnessWarningWithType _ -> 3264 | _ -> 193 GetFromException err.Exception @@ -441,6 +449,10 @@ let ConstraintSolverTupleDiffLengthsE() = DeclareResourceString("ConstraintSolve let ConstraintSolverInfiniteTypesE() = DeclareResourceString("ConstraintSolverInfiniteTypes", "%s%s") let ConstraintSolverMissingConstraintE() = DeclareResourceString("ConstraintSolverMissingConstraint", "%s") let ConstraintSolverTypesNotInEqualityRelation1E() = DeclareResourceString("ConstraintSolverTypesNotInEqualityRelation1", "%s%s") +let ConstraintSolverNullnessWarningEquivWithTypesE() = DeclareResourceString("ConstraintSolverNullnessWarningEquivWithTypes", "%s%s%s%s") +let ConstraintSolverNullnessWarningWithTypesE() = DeclareResourceString("ConstraintSolverNullnessWarningWithTypes", "%s%s%s%s") +let ConstraintSolverNullnessWarningWithTypeE() = DeclareResourceString("ConstraintSolverNullnessWarningWithType", "%s") +let ConstraintSolverNonNullnessWarningWithTypeE() = DeclareResourceString("ConstraintSolverNonNullnessWarningWithType", "%s") let ConstraintSolverTypesNotInEqualityRelation2E() = DeclareResourceString("ConstraintSolverTypesNotInEqualityRelation2", "%s%s") let ConstraintSolverTypesNotInSubsumptionRelationE() = DeclareResourceString("ConstraintSolverTypesNotInSubsumptionRelation", "%s%s%s") let ErrorFromAddingTypeEquation1E() = DeclareResourceString("ErrorFromAddingTypeEquation1", "%s%s%s") @@ -630,11 +642,45 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (suggestNames if m.StartLine <> m2.StartLine then os.Append(SeeAlsoE().Format (stringOfRange m)) |> ignore + | ConstraintSolverNullnessWarningEquivWithTypes(denv, ty1, ty2, nullness1, nullness2, m, m2) -> + + let t1, t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2 + + os.Append(ConstraintSolverNullnessWarningEquivWithTypesE().Format t1 t2 (nullness1.ToString()) (nullness2.ToString())) |> ignore + + if m.StartLine <> m2.StartLine then + os.Append(SeeAlsoE().Format (stringOfRange m)) |> ignore + + | ConstraintSolverNullnessWarningWithTypes(denv, ty1, ty2, nullness1, nullness2, m, m2) -> + + let t1, t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2 + + os.Append(ConstraintSolverNullnessWarningWithTypesE().Format t1 t2 (nullness1.ToString()) (nullness2.ToString())) |> ignore + + if m.StartLine <> m2.StartLine then + os.Append(SeeAlsoE().Format (stringOfRange m)) |> ignore + + | ConstraintSolverNullnessWarningWithType(denv, ty, _nullness, m, m2) -> + + let t = NicePrint.minimalStringOfType denv ty + os.Append(ConstraintSolverNullnessWarningWithTypeE().Format (t)) |> ignore + + if m.StartLine <> m2.StartLine then + os.Append(SeeAlsoE().Format (stringOfRange m)) |> ignore + + | ConstraintSolverNonNullnessWarningWithType(denv, ty, _nullness, m, m2) -> + + let t = NicePrint.minimalStringOfType denv ty + os.Append(ConstraintSolverNonNullnessWarningWithTypeE().Format (t)) |> ignore + + if m.StartLine <> m2.StartLine then + os.Append(SeeAlsoE().Format (stringOfRange m)) |> ignore + | ConstraintSolverTypesNotInEqualityRelation(denv, (TType_measure _ as t1), (TType_measure _ as t2), m, m2, _) -> // REVIEW: consider if we need to show _cxs (the type parameter constraints) let t1, t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv t1 t2 - os.Append(ConstraintSolverTypesNotInEqualityRelation1E().Format t1 t2 ) |> ignore + os.Append(ConstraintSolverTypesNotInEqualityRelation1E().Format t1 t2) |> ignore if m.StartLine <> m2.StartLine then os.Append(SeeAlsoE().Format (stringOfRange m)) |> ignore @@ -1244,7 +1290,7 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (suggestNames // we need to check if unit was used as a type argument let rec hasUnitTType_app (types: TType list) = match types with - | TType_app (maybeUnit, []) :: ts -> + | TType_app (maybeUnit, [], _) :: ts -> match maybeUnit.TypeAbbrev with | Some ttype when Tastops.isUnitTy g ttype -> true | _ -> hasUnitTType_app ts @@ -1252,7 +1298,7 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (suggestNames | [] -> false match minfoVirt.ApparentEnclosingType with - | TType_app (t, types) when t.IsFSharpInterfaceTycon && hasUnitTType_app types -> + | TType_app (t, types, _) when t.IsFSharpInterfaceTycon && hasUnitTType_app types -> // match abstract member with 'unit' passed as generic argument os.Append(OverrideDoesntOverride4E().Format sig1) |> ignore | _ -> @@ -1880,24 +1926,35 @@ type VersionFlag = /// Represents a reference to an assembly. May be backed by a real assembly on disk, or a cross-project /// reference backed by information generated by the the compiler service. type IRawFSharpAssemblyData = + /// The raw list AutoOpenAttribute attributes in the assembly abstract GetAutoOpenAttributes: ILGlobals -> string list + /// The raw list InternalsVisibleToAttribute attributes in the assembly - abstract GetInternalsVisibleToAttributes: ILGlobals -> string list + abstract GetInternalsVisibleToAttributes: ILGlobals -> string list + /// The raw IL module definition in the assembly, if any. This is not present for cross-project references /// in the language service abstract TryGetILModuleDef: unit -> ILModuleDef option + /// The raw F# signature data in the assembly, if any - abstract GetRawFSharpSignatureData: range * ilShortAssemName: string * fileName: string -> (string * (unit -> byte[])) list + abstract GetRawFSharpSignatureData: range * ilShortAssemName: string * fileName: string -> (string * ((unit -> byte[]) * (unit -> byte[]) option)) list + /// The raw F# optimization data in the assembly, if any - abstract GetRawFSharpOptimizationData: range * ilShortAssemName: string * fileName: string -> (string * (unit -> byte[])) list + abstract GetRawFSharpOptimizationData: range * ilShortAssemName: string * fileName: string -> (string * ((unit -> byte[]) * (unit -> byte[]) option)) list + /// The table of type forwarders in the assembly abstract GetRawTypeForwarders: unit -> ILExportedTypesAndForwarders + /// The identity of the module abstract ILScopeRef: ILScopeRef + abstract ILAssemblyRefs: ILAssemblyRef list + abstract ShortAssemblyName: string + abstract HasAnyFSharpSignatureDataAttribute: bool + abstract HasMatchingFSharpSignatureDataAttribute: ILGlobals -> bool /// Cache of time stamps as we traverse a project description @@ -2026,6 +2083,9 @@ type TcConfigBuilder = mutable embedResources: string list mutable errorSeverityOptions: FSharpErrorSeverityOptions mutable mlCompatibility: bool + mutable assumeNullOnImport: bool + mutable checkNullness: bool + mutable langVersion: double mutable checkOverflow: bool mutable showReferenceResolutions: bool mutable outputFile: string option @@ -2079,7 +2139,7 @@ type TcConfigBuilder = mutable win32manifest: string mutable includewin32manifest: bool mutable linkResources: string list - mutable legacyReferenceResolver: ReferenceResolver.Resolver + mutable legacyReferenceResolver: ReferenceResolver.Resolver mutable showFullPaths: bool mutable errorStyle: ErrorStyle @@ -2154,7 +2214,7 @@ type TcConfigBuilder = mutable pathMap: PathMap } - static member Initial = + static member Initial(legacyReferenceResolver) = { primaryAssembly = PrimaryAssembly.Mscorlib // defaut value, can be overridden using the command line switch light = None @@ -2187,6 +2247,9 @@ type TcConfigBuilder = subsystemVersion = 4, 0 // per spec for 357994 useHighEntropyVA = false mlCompatibility = false + assumeNullOnImport = false + checkNullness = false + langVersion = 5.0 checkOverflow = false showReferenceResolutions = false outputFile = None @@ -2243,7 +2306,7 @@ type TcConfigBuilder = win32manifest = "" includewin32manifest = true linkResources = [] - legacyReferenceResolver = null + legacyReferenceResolver = legacyReferenceResolver showFullPaths = false errorStyle = ErrorStyle.DefaultErrors @@ -2298,7 +2361,7 @@ type TcConfigBuilder = if (String.IsNullOrEmpty defaultFSharpBinariesDir) then failwith "Expected a valid defaultFSharpBinariesDir" - { TcConfigBuilder.Initial with + { TcConfigBuilder.Initial(legacyReferenceResolver) with implicitIncludeDir = implicitIncludeDir defaultFSharpBinariesDir = defaultFSharpBinariesDir reduceMemoryUsage = reduceMemoryUsage @@ -2670,6 +2733,9 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member x.embedResources = data.embedResources member x.errorSeverityOptions = data.errorSeverityOptions member x.mlCompatibility = data.mlCompatibility + member x.assumeNullOnImport = data.assumeNullOnImport + member x.checkNullness = data.checkNullness + member x.langVersion = data.langVersion member x.checkOverflow = data.checkOverflow member x.showReferenceResolutions = data.showReferenceResolutions member x.outputFile = data.outputFile @@ -3586,13 +3652,21 @@ let IsSignatureDataResource (r: ILResource) = r.Name.StartsWithOrdinal FSharpSignatureDataResourceName || r.Name.StartsWithOrdinal FSharpSignatureDataResourceName2 +let IsSignatureDataResourceB (r: ILResource) = + r.Name.StartsWithOrdinal FSharpSignatureDataResourceNameB + let IsOptimizationDataResource (r: ILResource) = - r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName|| + r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName || r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName2 +let IsOptimizationDataResourceB (r: ILResource) = + r.Name.StartsWithOrdinal FSharpOptimizationDataResourceNameB + let GetSignatureDataResourceName (r: ILResource) = if r.Name.StartsWithOrdinal FSharpSignatureDataResourceName then String.dropPrefix r.Name FSharpSignatureDataResourceName + elif r.Name.StartsWithOrdinal FSharpSignatureDataResourceNameB then + String.dropPrefix r.Name FSharpSignatureDataResourceNameB elif r.Name.StartsWithOrdinal FSharpSignatureDataResourceName2 then String.dropPrefix r.Name FSharpSignatureDataResourceName2 else failwith "GetSignatureDataResourceName" @@ -3600,12 +3674,14 @@ let GetSignatureDataResourceName (r: ILResource) = let GetOptimizationDataResourceName (r: ILResource) = if r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName then String.dropPrefix r.Name FSharpOptimizationDataResourceName + elif r.Name.StartsWithOrdinal FSharpOptimizationDataResourceNameB then + String.dropPrefix r.Name FSharpOptimizationDataResourceNameB elif r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName2 then String.dropPrefix r.Name FSharpOptimizationDataResourceName2 else failwith "GetOptimizationDataResourceName" let IsReflectedDefinitionsResource (r: ILResource) = - r.Name.StartsWithOrdinal(QuotationPickler.SerializedReflectedDefinitionsResourceNameBase) + r.Name.StartsWithOrdinal QuotationPickler.SerializedReflectedDefinitionsResourceNameBase let MakeILResource rname bytes = { Name = rname @@ -3614,25 +3690,30 @@ let MakeILResource rname bytes = CustomAttrsStored = storeILCustomAttrs emptyILCustomAttrs MetadataIndex = NoMetadataIdx } -let PickleToResource inMem file (g: TcGlobals) scope rname p x = +let PickleToResource inMem file (g: TcGlobals) scope rname rnameB p x = let file = PathMap.apply g.pathMap file - + let bytes, bytesB = pickleObjWithDanglingCcus inMem file g scope p x { Name = rname - Location = (let bytes = pickleObjWithDanglingCcus inMem file g scope p x in ILResourceLocation.LocalOut bytes) + Location = ILResourceLocation.LocalOut bytes + Access = ILResourceAccess.Public + CustomAttrsStored = storeILCustomAttrs emptyILCustomAttrs + MetadataIndex = NoMetadataIdx }, + { Name = rnameB + Location = ILResourceLocation.LocalOut bytesB Access = ILResourceAccess.Public CustomAttrsStored = storeILCustomAttrs emptyILCustomAttrs MetadataIndex = NoMetadataIdx } -let GetSignatureData (file, ilScopeRef, ilModule, byteReader) : PickledDataWithReferences = - unpickleObjWithDanglingCcus file ilScopeRef ilModule unpickleCcuInfo (byteReader()) +let GetSignatureData (file, ilScopeRef, ilModule, byteReader, byteReaderB) : PickledDataWithReferences = + unpickleObjWithDanglingCcus file ilScopeRef ilModule unpickleCcuInfo (byteReader()) (match byteReaderB with None -> [| |] | Some br -> br()) -let WriteSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, ccu: CcuThunk, file, inMem) : ILResource = +let WriteSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, ccu: CcuThunk, file, inMem) : ILResource * ILResource = let mspec = ccu.Contents let mspec = ApplyExportRemappingToEntity tcGlobals exportRemapping mspec // For historical reasons, we use a different resource name for FSharp.Core, so older F# compilers // don't complain when they see the resource. - let rname = if ccu.AssemblyName = getFSharpCoreLibraryName then FSharpSignatureDataResourceName2 else FSharpSignatureDataResourceName - + let rname = if ccu.AssemblyName = getFSharpCoreLibraryName then FSharpSignatureDataResourceName2 else FSharpSignatureDataResourceName + let rnameB = FSharpSignatureDataResourceNameB let includeDir = if String.IsNullOrEmpty tcConfig.implicitIncludeDir then "" else @@ -3640,19 +3721,20 @@ let WriteSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, ccu: Ccu |> System.IO.Path.GetFullPath |> PathMap.applyDir tcGlobals.pathMap - PickleToResource inMem file tcGlobals ccu (rname+ccu.AssemblyName) pickleCcuInfo + PickleToResource inMem file tcGlobals ccu (rname+ccu.AssemblyName) (rnameB+ccu.AssemblyName) pickleCcuInfo { mspec=mspec compileTimeWorkingDir=includeDir usesQuotations = ccu.UsesFSharp20PlusQuotations } -let GetOptimizationData (file, ilScopeRef, ilModule, byteReader) = - unpickleObjWithDanglingCcus file ilScopeRef ilModule Optimizer.u_CcuOptimizationInfo (byteReader()) +let GetOptimizationData (file, ilScopeRef, ilModule, byteReader, byteReaderB) = + unpickleObjWithDanglingCcus file ilScopeRef ilModule Optimizer.u_CcuOptimizationInfo (byteReader()) (match byteReaderB with None -> [| |] | Some br -> br()) let WriteOptimizationData (tcGlobals, file, inMem, ccu: CcuThunk, modulInfo) = // For historical reasons, we use a different resource name for FSharp.Core, so older F# compilers // don't complain when they see the resource. let rname = if ccu.AssemblyName = getFSharpCoreLibraryName then FSharpOptimizationDataResourceName2 else FSharpOptimizationDataResourceName - PickleToResource inMem file tcGlobals ccu (rname+ccu.AssemblyName) Optimizer.p_CcuOptimizationInfo modulInfo + let rnameB = FSharpOptimizationDataResourceNameB + PickleToResource inMem file tcGlobals ccu (rname+ccu.AssemblyName) (rnameB+ccu.AssemblyName) Optimizer.p_CcuOptimizationInfo modulInfo //---------------------------------------------------------------------------- // Abstraction for project reference @@ -3660,30 +3742,60 @@ let WriteOptimizationData (tcGlobals, file, inMem, ccu: CcuThunk, modulInfo) = type RawFSharpAssemblyDataBackedByFileOnDisk (ilModule: ILModuleDef, ilAssemblyRefs) = let externalSigAndOptData = ["FSharp.Core"] interface IRawFSharpAssemblyData with + member __.GetAutoOpenAttributes ilg = GetAutoOpenAttributes ilg ilModule + member __.GetInternalsVisibleToAttributes ilg = GetInternalsVisibleToAttributes ilg ilModule + member __.TryGetILModuleDef() = Some ilModule + member __.GetRawFSharpSignatureData(m, ilShortAssemName, filename) = let resources = ilModule.Resources.AsList + let sigDataReaders = [ for iresource in resources do if IsSignatureDataResource iresource then let ccuName = GetSignatureDataResourceName iresource - yield (ccuName, fun () -> iresource.GetBytes()) ] - + let readerA = fun () -> iresource.GetBytes() + let readerB = + resources |> List.tryPick (fun iresourceB -> + if IsSignatureDataResourceB iresourceB then + let ccuNameB = GetSignatureDataResourceName iresourceB + if ccuName = ccuNameB then + Some (fun () -> iresourceB.GetBytes() ) + else None + else None) + yield (ccuName, (readerA, readerB)) ] + let sigDataReaders = if sigDataReaders.IsEmpty && List.contains ilShortAssemName externalSigAndOptData then let sigFileName = Path.ChangeExtension(filename, "sigdata") if not (FileSystem.SafeExists sigFileName) then error(Error(FSComp.SR.buildExpectedSigdataFile (FileSystem.GetFullPathShim sigFileName), m)) - [ (ilShortAssemName, fun () -> FileSystem.ReadAllBytesShim sigFileName)] + [ (ilShortAssemName, ((fun () -> FileSystem.ReadAllBytesShim sigFileName), None))] else sigDataReaders sigDataReaders + member __.GetRawFSharpOptimizationData(m, ilShortAssemName, filename) = + let resources = ilModule.Resources.AsList let optDataReaders = - ilModule.Resources.AsList - |> List.choose (fun r -> if IsOptimizationDataResource r then Some(GetOptimizationDataResourceName r, (fun () -> r.GetBytes())) else None) + resources + |> List.choose (fun r -> + if IsOptimizationDataResource r then + let ccuName = GetOptimizationDataResourceName r + let readerA = (fun () -> r.GetBytes()) + let readerB = + resources |> List.tryPick (fun iresourceB -> + if IsOptimizationDataResourceB iresourceB then + let ccuNameB = GetOptimizationDataResourceName iresourceB + if ccuName = ccuNameB then + Some (fun () -> iresourceB.GetBytes() ) + else None + else None) + Some(ccuName, (readerA, readerB)) + else + None) // Look for optimization data in a file let optDataReaders = @@ -3691,14 +3803,16 @@ type RawFSharpAssemblyDataBackedByFileOnDisk (ilModule: ILModuleDef, ilAssemblyR let optDataFile = Path.ChangeExtension(filename, "optdata") if not (FileSystem.SafeExists optDataFile) then error(Error(FSComp.SR.buildExpectedFileAlongSideFSharpCore(optDataFile, FileSystem.GetFullPathShim optDataFile), m)) - [ (ilShortAssemName, (fun () -> FileSystem.ReadAllBytesShim optDataFile))] + [ (ilShortAssemName, ((fun () -> FileSystem.ReadAllBytesShim optDataFile), None))] else optDataReaders optDataReaders + member __.GetRawTypeForwarders() = match ilModule.Manifest with | Some manifest -> manifest.ExportedTypes | None -> mkILExportedTypes [] + member __.ShortAssemblyName = GetNameOfILModule ilModule member __.ILScopeRef = MakeScopeRefForILModule ilModule member __.ILAssemblyRefs = ilAssemblyRefs @@ -3882,11 +3996,19 @@ type TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAssemblyResolu #if !NO_EXTENSIONTYPING +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE member tcImports.GetProvidedAssemblyInfo(ctok, m, assembly: Tainted) = - let anameOpt = assembly.PUntaint((fun assembly -> match assembly with null -> None | a -> Some (a.GetName())), m) - match anameOpt with - | None -> false, None - | Some aname -> +#else + member tcImports.GetProvidedAssemblyInfo(ctok, m, assembly: Tainted) = +#endif + match assembly with + | Tainted.Null -> false,None +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + | assembly -> +#else + | Tainted.NonNull assembly -> +#endif + let aname = assembly.PUntaint((fun a -> a.GetName()), m) let ilShortAssemName = aname.Name match tcImports.FindCcu (ctok, m, ilShortAssemName, lookupOnly=true) with | ResolvedCcu ccu -> @@ -4121,7 +4243,7 @@ type TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAssemblyResolu member tcImports.ImportTypeProviderExtensions (ctok, tcConfig: TcConfig, - fileNameOfRuntimeAssembly, + fileNameOfRuntimeAssembly: string, ilScopeRefOfRuntimeAssembly, runtimeAssemblyAttributes: ILAttribute list, entityToInjectInto, invalidateCcu: Event<_>, m) = @@ -4134,7 +4256,7 @@ type TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAssemblyResolu runtimeAssemblyAttributes |> List.choose (TryDecodeTypeProviderAssemblyAttr (defaultArg ilGlobalsOpt EcmaMscorlibILGlobals)) // If no design-time assembly is specified, use the runtime assembly - |> List.map (function null -> fileNameOfRuntimeAssembly | s -> s) + |> List.map (function null -> fileNameOfRuntimeAssembly | NonNull s -> s) // For each simple name of a design-time assembly, we take the first matching one in the order they are // specified in the attributes |> List.distinctBy (fun s -> try Path.GetFileNameWithoutExtension s with _ -> s) @@ -4316,8 +4438,8 @@ type TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAssemblyResolu let ccuRawDataAndInfos = ilModule.GetRawFSharpSignatureData(m, ilShortAssemName, filename) - |> List.map (fun (ccuName, sigDataReader) -> - let data = GetSignatureData (filename, ilScopeRef, ilModule.TryGetILModuleDef(), sigDataReader) + |> List.map (fun (ccuName, (sigDataReader, sigDataReaderB)) -> + let data = GetSignatureData (filename, ilScopeRef, ilModule.TryGetILModuleDef(), sigDataReader, sigDataReaderB) let optDatas = Map.ofList optDataReaders @@ -4355,8 +4477,8 @@ type TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAssemblyResolu | None -> if verbose then dprintf "*** no optimization data for CCU %s, was DLL compiled with --no-optimization-data??\n" ccuName None - | Some info -> - let data = GetOptimizationData (filename, ilScopeRef, ilModule.TryGetILModuleDef(), info) + | Some (readerA, readerB) -> + let data = GetOptimizationData (filename, ilScopeRef, ilModule.TryGetILModuleDef(), readerA, readerB) let res = data.OptionalFixup(fun nm -> availableToOptionalCcu(tcImports.FindCcu(ctok, m, nm, lookupOnly=false))) if verbose then dprintf "found optimization data for CCU %s\n" ccuName Some res) @@ -4643,9 +4765,10 @@ type TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAssemblyResolu // OK, now we have both mscorlib.dll and FSharp.Core.dll we can create TcGlobals let tcGlobals = TcGlobals(tcConfig.compilingFslib, ilGlobals, fslibCcu, - tcConfig.implicitIncludeDir, tcConfig.mlCompatibility, - tcConfig.isInteractive, tryFindSysTypeCcu, tcConfig.emitDebugInfoInQuotations, - tcConfig.noDebugData, tcConfig.pathMap) + tcConfig.implicitIncludeDir, tcConfig.mlCompatibility, + tcConfig.isInteractive, tcConfig.assumeNullOnImport, tcConfig.checkNullness, tcConfig.langVersion, + tryFindSysTypeCcu, tcConfig.emitDebugInfoInQuotations, + tcConfig.noDebugData, tcConfig.pathMap) #if DEBUG // the global_g reference cell is used only for debug printing diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 94d9bf53713..e50b5fa15c0 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -142,24 +142,35 @@ exception HashLoadedScriptConsideredSource of range /// Represents a reference to an F# assembly. May be backed by a real assembly on disk (read by Abstract IL), or a cross-project /// reference in FSharp.Compiler.Service. type IRawFSharpAssemblyData = + /// The raw list AutoOpenAttribute attributes in the assembly abstract GetAutoOpenAttributes: ILGlobals -> string list + /// The raw list InternalsVisibleToAttribute attributes in the assembly abstract GetInternalsVisibleToAttributes: ILGlobals -> string list + /// The raw IL module definition in the assembly, if any. This is not present for cross-project references /// in the language service abstract TryGetILModuleDef: unit -> ILModuleDef option + abstract HasAnyFSharpSignatureDataAttribute: bool + abstract HasMatchingFSharpSignatureDataAttribute: ILGlobals -> bool + /// The raw F# signature data in the assembly, if any - abstract GetRawFSharpSignatureData: range * ilShortAssemName: string * fileName: string -> (string * (unit -> byte[])) list + abstract GetRawFSharpSignatureData : range * ilShortAssemName: string * fileName: string -> (string * ((unit -> byte[]) * (unit -> byte[]) option)) list + /// The raw F# optimization data in the assembly, if any - abstract GetRawFSharpOptimizationData: range * ilShortAssemName: string * fileName: string -> (string * (unit -> byte[])) list + abstract GetRawFSharpOptimizationData : range * ilShortAssemName: string * fileName: string -> (string * ((unit -> byte[]) * (unit -> byte[]) option)) list + /// The table of type forwarders in the assembly abstract GetRawTypeForwarders: unit -> ILExportedTypesAndForwarders + /// The identity of the module abstract ILScopeRef: ILScopeRef + abstract ILAssemblyRefs: ILAssemblyRef list + abstract ShortAssemblyName: string type TimeStampCache = @@ -273,6 +284,9 @@ type TcConfigBuilder = mutable embedResources: string list mutable errorSeverityOptions: FSharpErrorSeverityOptions mutable mlCompatibility:bool + mutable assumeNullOnImport: bool + mutable checkNullness: bool + mutable langVersion: double mutable checkOverflow:bool mutable showReferenceResolutions:bool mutable outputFile: string option @@ -377,7 +391,7 @@ type TcConfigBuilder = mutable pathMap : PathMap } - static member Initial: TcConfigBuilder + static member Initial: ReferenceResolver.Resolver -> TcConfigBuilder static member CreateNew: legacyReferenceResolver: ReferenceResolver.Resolver * @@ -433,6 +447,9 @@ type TcConfig = member embedResources: string list member errorSeverityOptions: FSharpErrorSeverityOptions member mlCompatibility:bool + member assumeNullOnImport: bool + member checkNullness: bool + member langVersion: double member checkOverflow:bool member showReferenceResolutions:bool member outputFile: string option @@ -640,6 +657,9 @@ type TcImports = /// Determine if an IL resource attached to an F# assembly is an F# signature data resource val IsSignatureDataResource: ILResource -> bool +/// Determine if an IL resource attached to an F# assembly is an F# signature data resource (data stream B) +val IsSignatureDataResourceB: ILResource -> bool + /// Determine if an IL resource attached to an F# assembly is an F# optimization data resource val IsOptimizationDataResource: ILResource -> bool @@ -648,14 +668,10 @@ val IsReflectedDefinitionsResource: ILResource -> bool val GetSignatureDataResourceName: ILResource -> string /// Write F# signature data as an IL resource -val WriteSignatureData: TcConfig * TcGlobals * Tastops.Remap * CcuThunk * filename: string * inMem: bool -> ILResource +val WriteSignatureData: TcConfig * TcGlobals * Tastops.Remap * CcuThunk * filename: string * inMem: bool -> ILResource * ILResource /// Write F# optimization data as an IL resource -val WriteOptimizationData: TcGlobals * filename: string * inMem: bool * CcuThunk * Optimizer.LazyModuleInfo -> ILResource - -//---------------------------------------------------------------------------- -// #r and other directives -//-------------------------------------------------------------------------- +val WriteOptimizationData: TcGlobals * filename: string * inMem: bool * CcuThunk * Optimizer.LazyModuleInfo -> ILResource * ILResource //---------------------------------------------------------------------------- // #r and other directives diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 3a30ed50077..e5b042e3928 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -615,6 +615,10 @@ let errorsAndWarningsFlags (tcConfigB: TcConfigBuilder) = CompilerOption("warnon", tagWarnList, OptionStringList (fun n -> tcConfigB.TurnWarningOn(rangeCmdArgs, trimFS n)), None, Some (FSComp.SR.optsWarnOn())) + CompilerOption("checknulls", tagNone, OptionSwitch (fun switch -> tcConfigB.checkNullness <- (switch = OptionSwitch.On)), None, Some (FSComp.SR.optsCheckNulls())) + + CompilerOption("langversion", tagNone, OptionString (fun switch -> tcConfigB.langVersion <- double switch), None, Some (FSComp.SR.optsLangVersion())) + CompilerOption("consolecolors", tagNone, OptionSwitch (fun switch -> enableConsoleColoring <- switch = OptionSwitch.On), None, Some (FSComp.SR.optsConsoleColors())) ] @@ -986,6 +990,7 @@ let testFlag tcConfigB = ("test", tagString, OptionString (fun s -> match s with + | "AssumeNullOnImport" -> tcConfigB.assumeNullOnImport <- true | "StackSpan" -> tcConfigB.internalTestSpanStackReferring <- true | "ErrorRanges" -> tcConfigB.errorStyle <- ErrorStyle.TestErrors | "Tracking" -> Lib.tracking := true (* general purpose on/off diagnostics flag *) diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index 74036e1687c..2e86194cdb7 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -53,6 +53,10 @@ open FSharp.Compiler.Tastops open FSharp.Compiler.TcGlobals open FSharp.Compiler.TypeRelations +#if !NO_EXTENSIONTYPING +open FSharp.Compiler.ExtensionTyping +#endif + //------------------------------------------------------------------------- // Generate type variables and record them in within the scope of the // compilation environment, which currently corresponds to the scope @@ -72,25 +76,33 @@ let NewAnonTypar (kind, m, rigid, var, dyn) = let NewNamedInferenceMeasureVar (_m, rigid, var, id) = NewTypar(TyparKind.Measure, rigid, Typar(id, var, false), false, TyparDynamicReq.No, [], false, false) -let NewInferenceMeasurePar () = NewCompGenTypar (TyparKind.Measure, TyparRigidity.Flexible, NoStaticReq, TyparDynamicReq.No, false) +let NewInferenceMeasurePar () = + NewCompGenTypar (TyparKind.Measure, TyparRigidity.Flexible, NoStaticReq, TyparDynamicReq.No, false) -let NewErrorTypar () = NewCompGenTypar (TyparKind.Type, TyparRigidity.Flexible, NoStaticReq, TyparDynamicReq.No, true) +let NewErrorTypar () = + NewCompGenTypar (TyparKind.Type, TyparRigidity.Flexible, NoStaticReq, TyparDynamicReq.No, true) -let NewErrorMeasureVar () = NewCompGenTypar (TyparKind.Measure, TyparRigidity.Flexible, NoStaticReq, TyparDynamicReq.No, true) +let NewErrorMeasureVar () = + NewCompGenTypar (TyparKind.Measure, TyparRigidity.Flexible, NoStaticReq, TyparDynamicReq.No, true) -let NewInferenceType () = mkTyparTy (NewTypar (TyparKind.Type, TyparRigidity.Flexible, Typar(compgenId, NoStaticReq, true), false, TyparDynamicReq.No, [], false, false)) - -let NewErrorType () = mkTyparTy (NewErrorTypar ()) +let NewInferenceType (g: TcGlobals) = + let tp = NewTypar (TyparKind.Type, TyparRigidity.Flexible, Typar(compgenId, NoStaticReq, true), false, TyparDynamicReq.No, [], false, false) + let nullness = if g.langFeatureNullness then NewNullnessVar() else KnownAmbivalentToNull + TType_var (tp, nullness) + +let NewErrorType () = + mkTyparTy (NewErrorTypar ()) -let NewErrorMeasure () = Measure.Var (NewErrorMeasureVar ()) +let NewErrorMeasure () = + Measure.Var (NewErrorMeasureVar ()) let NewByRefKindInferenceType (g: TcGlobals) m = let tp = NewTypar (TyparKind.Type, TyparRigidity.Flexible, Typar(compgenId, HeadTypeStaticReq, true), false, TyparDynamicReq.No, [], false, false) if g.byrefkind_InOut_tcr.CanDeref then - tp.SetConstraints [TyparConstraint.DefaultsTo(10, TType_app(g.byrefkind_InOut_tcr, []), m)] + tp.SetConstraints [TyparConstraint.DefaultsTo(10, TType_app(g.byrefkind_InOut_tcr, [], g.knownWithoutNull), m)] mkTyparTy tp -let NewInferenceTypes l = l |> List.map (fun _ -> NewInferenceType ()) +let NewInferenceTypes g l = l |> List.map (fun _ -> NewInferenceType g) // QUERY: should 'rigid' ever really be 'true'? We set this when we know // we are going to have to generalize a typar, e.g. when implementing a @@ -103,8 +115,11 @@ let FreshenAndFixupTypars m rigid fctps tinst tpsorig = let renaming, tinst = FixupNewTypars m fctps tinst tpsorig tps tps, renaming, tinst -let FreshenTypeInst m tpsorig = FreshenAndFixupTypars m TyparRigidity.Flexible [] [] tpsorig -let FreshMethInst m fctps tinst tpsorig = FreshenAndFixupTypars m TyparRigidity.Flexible fctps tinst tpsorig +let FreshenTypeInst m tpsorig = + FreshenAndFixupTypars m TyparRigidity.Flexible [] [] tpsorig + +let FreshMethInst m fctps tinst tpsorig = + FreshenAndFixupTypars m TyparRigidity.Flexible fctps tinst tpsorig let FreshenTypars m tpsorig = match tpsorig with @@ -160,6 +175,10 @@ exception ConstraintSolverInfiniteTypes of displayEnv: DisplayEn exception ConstraintSolverTypesNotInEqualityRelation of displayEnv: DisplayEnv * TType * TType * range * range * ContextInfo exception ConstraintSolverTypesNotInSubsumptionRelation of displayEnv: DisplayEnv * TType * TType * range * range exception ConstraintSolverMissingConstraint of displayEnv: DisplayEnv * Tast.Typar * Tast.TyparConstraint * range * range +exception ConstraintSolverNullnessWarningEquivWithTypes of DisplayEnv * TType * TType * NullnessInfo * NullnessInfo * range * range +exception ConstraintSolverNullnessWarningWithTypes of DisplayEnv * TType * TType * NullnessInfo * NullnessInfo * range * range +exception ConstraintSolverNullnessWarningWithType of DisplayEnv * TType * NullnessInfo * range * range +exception ConstraintSolverNonNullnessWarningWithType of DisplayEnv * TType * NullnessInfo * range * range exception ConstraintSolverError of string * range * range exception ConstraintSolverRelatedInformation of string option * range * exn @@ -230,11 +249,11 @@ let MakeConstraintSolverEnv contextInfo css m denv = let rec occursCheck g un ty = match stripTyEqns g ty with | TType_ucase(_, l) - | TType_app (_, l) + | TType_app (_, l, _) | TType_anon(_, l) | TType_tuple (_, l) -> List.exists (occursCheck g un) l - | TType_fun (d, r) -> occursCheck g un d || occursCheck g un r - | TType_var r -> typarEq un r + | TType_fun (d, r, _nullness) -> occursCheck g un d || occursCheck g un r + | TType_var (r, _) -> typarEq un r | TType_forall (_, tau) -> occursCheck g un tau | _ -> false @@ -586,11 +605,11 @@ let SimplifyMeasure g vars ms = let rec SimplifyMeasuresInType g resultFirst ((generalizable, generalized) as param) ty = match stripTyparEqns ty with | TType_ucase(_, l) - | TType_app (_, l) - | TType_anon (_,l) + | TType_app (_, l, _) + | TType_anon (_, l) | TType_tuple (_, l) -> SimplifyMeasuresInTypes g param l - | TType_fun (d, r) -> if resultFirst then SimplifyMeasuresInTypes g param [r;d] else SimplifyMeasuresInTypes g param [d;r] + | TType_fun (d, r, _nullness) -> if resultFirst then SimplifyMeasuresInTypes g param [r;d] else SimplifyMeasuresInTypes g param [d;r] | TType_var _ -> param | TType_forall (_, tau) -> SimplifyMeasuresInType g resultFirst param tau | TType_measure unt -> @@ -624,11 +643,11 @@ let rec SimplifyMeasuresInConstraints g param cs = let rec GetMeasureVarGcdInType v ty = match stripTyparEqns ty with | TType_ucase(_, l) - | TType_app (_, l) - | TType_anon (_,l) + | TType_app (_, l, _) + | TType_anon (_, l) | TType_tuple (_, l) -> GetMeasureVarGcdInTypes v l - | TType_fun (d, r) -> GcdRational (GetMeasureVarGcdInType v d) (GetMeasureVarGcdInType v r) + | TType_fun (d, r, _nullness) -> GcdRational (GetMeasureVarGcdInType v d) (GetMeasureVarGcdInType v r) | TType_var _ -> ZeroRational | TType_forall (_, tau) -> GetMeasureVarGcdInType v tau | TType_measure unt -> MeasureVarExponent v unt @@ -720,7 +739,7 @@ let rec SolveTyparEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: Optio let m = csenv.m do! DepthCheck ndeep m match ty1 with - | TType_var r | TType_measure (Measure.Var r) -> + | TType_var (r, _) | TType_measure (Measure.Var r) -> // The types may still be equivalent due to abbreviations, which we are trying not to eliminate if typeEquiv csenv.g ty1 ty then () else // The famous 'occursCheck' check to catch "infinite types" like 'a = list<'a> - see also https://github.com/Microsoft/visualfsharp/issues/1170 @@ -770,7 +789,8 @@ and solveTypMeetsTyparConstraints (csenv: ConstraintSolverEnv) ndeep m2 trace ty | ValueSome destTypar -> AddConstraint csenv ndeep m2 trace destTypar (TyparConstraint.DefaultsTo(priority, dty, m)) - | TyparConstraint.SupportsNull m2 -> SolveTypeSupportsNull csenv ndeep m2 trace ty + | TyparConstraint.NotSupportsNull m2 -> SolveTypeDefnNotSupportsNull csenv ndeep m2 trace ty + | TyparConstraint.SupportsNull m2 -> SolveTypeDefnSupportsNull csenv ndeep m2 trace ty | TyparConstraint.IsEnum(underlying, m2) -> SolveTypeIsEnum csenv ndeep m2 trace ty underlying | TyparConstraint.SupportsComparison(m2) -> SolveTypeSupportsComparison csenv ndeep m2 trace ty | TyparConstraint.SupportsEquality(m2) -> SolveTypeSupportsEquality csenv ndeep m2 trace ty @@ -785,6 +805,73 @@ and solveTypMeetsTyparConstraints (csenv: ConstraintSolverEnv) ndeep m2 trace ty SolveMemberConstraint csenv false false ndeep m2 trace traitInfo |> OperationResult.ignore } +// nullness1: actual +// nullness2: expected +and SolveNullnessEquiv (csenv:ConstraintSolverEnv) m2 (trace: OptionalTrace) ty1 ty2 nullness1 nullness2 = + match nullness1, nullness2 with + | Nullness.Variable nv1, Nullness.Variable nv2 when nv1 === nv2 -> + CompleteD + | Nullness.Variable nv1, _ when nv1.IsSolved -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nv1.Solution nullness2 + | _, Nullness.Variable nv2 when nv2.IsSolved -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nv2.Solution + | Nullness.Variable nv1, _ -> + trace.Exec (fun () -> nv1.Set nullness2) (fun () -> nv1.Unset()) + CompleteD + | _, Nullness.Variable nv2 -> + trace.Exec (fun () -> nv2.Set nullness1) (fun () -> nv2.Unset()) + CompleteD + | Nullness.Known n1, Nullness.Known n2 -> + match n1, n2 with + | NullnessInfo.AmbivalentToNull, _ -> CompleteD + | _, NullnessInfo.AmbivalentToNull -> CompleteD + | NullnessInfo.WithNull, NullnessInfo.WithNull -> CompleteD + | NullnessInfo.WithoutNull, NullnessInfo.WithoutNull -> CompleteD + // Allow expected of WithNull and actual of WithoutNull + // TODO NULLNESS: this is not sound in contravariant cases etc. + | NullnessInfo.WithNull, NullnessInfo.WithoutNull -> CompleteD + | _ -> + // NOTE: we never give nullness warnings for the 'obj' type + if csenv.g.checkNullness then + if not (isObjTy csenv.g ty1) && not (isObjTy csenv.g ty2) then + WarnD(ConstraintSolverNullnessWarningEquivWithTypes(csenv.DisplayEnv, ty1, ty2, n1, n2, csenv.m, m2)) + else + CompleteD + else + CompleteD + +// nullness1: target +// nullness2: source +and SolveNullnessSubsumesNullness (csenv:ConstraintSolverEnv) m2 (trace: OptionalTrace) ty1 ty2 nullness1 nullness2 = + match nullness1, nullness2 with + | Nullness.Variable nv1, Nullness.Variable nv2 when nv1 === nv2 -> + CompleteD + | Nullness.Variable nv1, _ when nv1.IsSolved -> + SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nv1.Solution nullness2 + | _, Nullness.Variable nv2 when nv2.IsSolved -> + SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 nv2.Solution + | Nullness.Variable nv1, _ -> + trace.Exec (fun () -> nv1.Set nullness2) (fun () -> nv1.Unset()) + CompleteD + | _, Nullness.Variable nv2 -> + trace.Exec (fun () -> nv2.Set nullness1) (fun () -> nv2.Unset()) + CompleteD + | Nullness.Known n1, Nullness.Known n2 -> + match n1, n2 with + | NullnessInfo.AmbivalentToNull, _ -> CompleteD + | _, NullnessInfo.AmbivalentToNull -> CompleteD + | NullnessInfo.WithNull, NullnessInfo.WithNull -> CompleteD + | NullnessInfo.WithoutNull, NullnessInfo.WithoutNull -> CompleteD + // Allow target of WithNull and actual of WithoutNull + | NullnessInfo.WithNull, NullnessInfo.WithoutNull -> CompleteD + | NullnessInfo.WithoutNull, NullnessInfo.WithNull -> + if csenv.g.checkNullness then + if not (isObjTy csenv.g ty1) && not (isObjTy csenv.g ty2) then + WarnD(ConstraintSolverNullnessWarningWithTypes(csenv.DisplayEnv, ty1, ty2, n1, n2, csenv.m, m2)) + else + CompleteD + else + CompleteD and SolveAnonInfoEqualsAnonInfo (csenv: ConstraintSolverEnv) m2 (anonInfo1: AnonRecdTypeInfo) (anonInfo2: AnonRecdTypeInfo) = if evalTupInfoIsStruct anonInfo1.TupInfo <> evalTupInfoIsStruct anonInfo2.TupInfo then ErrorD (ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m,m2)) else @@ -800,7 +887,7 @@ and SolveAnonInfoEqualsAnonInfo (csenv: ConstraintSolverEnv) m2 (anonInfo1: Anon /// Add the constraint "ty1 = ty2" to the constraint problem. /// Propagate all effects of adding this constraint, e.g. to solve type variables -and SolveTypeEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) (cxsln:(TraitConstraintInfo * TraitConstraintSln) option) ty1 ty2 = +and SolveTypeEqualsType (csenv:ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) (cxsln:(TraitConstraintInfo * TraitConstraintSln) option) ty1 ty2 = let ndeep = ndeep + 1 let aenv = csenv.EquivEnv let g = csenv.g @@ -819,30 +906,100 @@ and SolveTypeEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTr match sty1, sty2 with // type vars inside forall-types may be alpha-equivalent - | TType_var tp1, TType_var tp2 when typarEq tp1 tp2 || (match aenv.EquivTypars.TryFind tp1 with | Some v when typeEquiv g v ty2 -> true | _ -> false) -> CompleteD + | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when typarEq tp1 tp2 || (match aenv.EquivTypars.TryFind tp1 with | Some v when typeEquiv g v ty2 -> true | _ -> false) -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 + + | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when PreferUnifyTypar tp1 tp2 -> + match nullness1.TryEvaluate(), nullness2.TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty1 (TType_var (tp2, g.knownWithoutNull)) + //// Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty1 (TType_var (tp2, g.knownWithoutNull)) + | _ -> + SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 ++ (fun () -> + let nullnessAfterSolution1 = combineNullness (nullnessOfTy g sty1) nullness1 + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullnessAfterSolution1 nullness2 + ) + + | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when not csenv.MatchingOnly && PreferUnifyTypar tp2 tp1 -> + match nullness1.TryEvaluate(), nullness2.TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty2 (TType_var (tp1, g.knownWithoutNull)) + //// Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty2 (TType_var (tp1, g.knownWithoutNull)) + | _ -> + // Unifying 'T1 ? and 'T2 % + // Unifying 'T1 % and 'T2 ? + SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 ++ (fun () -> + let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullnessAfterSolution2 + ) + + | TType_var (tp1, nullness1), _ when (tp1.Rigidity <> TyparRigidity.Rigid) -> + match nullness1.TryEvaluate(), (nullnessOfTy g sty2).TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty1 (replaceNullnessOfTy g.knownWithoutNull sty2) + //// Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty1 (replaceNullnessOfTy g.knownWithoutNull sty2) + | _ -> + SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 ++ (fun () -> + let nullnessAfterSolution1 = combineNullness (nullnessOfTy g sty1) nullness1 + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullnessAfterSolution1 (nullnessOfTy g sty2) + ) + + | _, TType_var (tp2, nullness2) when (tp2.Rigidity <> TyparRigidity.Rigid) && not csenv.MatchingOnly -> + match (nullnessOfTy g sty1).TryEvaluate(), nullness2.TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty2 (replaceNullnessOfTy g.knownWithoutNull sty1) + //// Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty2 (replaceNullnessOfTy g.knownWithoutNull sty1) + | _ -> + SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 ++ (fun () -> + let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 + SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) nullnessAfterSolution2 + ) - | TType_var tp1, TType_var tp2 when PreferUnifyTypar tp1 tp2 -> SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 - | TType_var tp1, TType_var tp2 when not csenv.MatchingOnly && PreferUnifyTypar tp2 tp1 -> SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 + // Catch float<_>=float<1>, float32<_>=float32<1> and decimal<_>=decimal<1> + | (_, TType_app (tc2, [ms2], nullness2)) when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms2])) -> + SolveTypeEqualsType csenv ndeep m2 trace None (TType_measure Measure.One) ms2 ++ (fun () -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) nullness2 + ) - | TType_var r, _ when (r.Rigidity <> TyparRigidity.Rigid) -> SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 - | _, TType_var r when (r.Rigidity <> TyparRigidity.Rigid) && not csenv.MatchingOnly -> SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 + | (TType_app (tc1, [ms1], nullness1), _) when (tc1.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc1 [ms1])) -> + SolveTypeEqualsType csenv ndeep m2 trace None ms1 (TType_measure Measure.One) ++ (fun () -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 (nullnessOfTy g sty2) + ) - // Catch float<_>=float<1>, float32<_>=float32<1> and decimal<_>=decimal<1> - | (_, TType_app (tc2, [ms])) when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms])) - -> SolveTypeEqualsType csenv ndeep m2 trace None ms (TType_measure Measure.One) - | (TType_app (tc2, [ms]), _) when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms])) - -> SolveTypeEqualsType csenv ndeep m2 trace None ms (TType_measure Measure.One) + | TType_app (tc1, l1, nullness1), TType_app (tc2, l2, nullness2) when tyconRefEq g tc1 tc2 -> + SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 ++ (fun () -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 + ) - | TType_app (tc1, l1), TType_app (tc2, l2) when tyconRefEq g tc1 tc2 -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 - | TType_app (_, _), TType_app (_, _) -> localAbortD - | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> + | TType_app _, TType_app _ -> localAbortD + + | TType_tuple (tupInfo1, l1) , TType_tuple (tupInfo2, l2) -> if evalTupInfoIsStruct tupInfo1 <> evalTupInfoIsStruct tupInfo2 then ErrorD (ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m, m2)) else SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 + + | TType_fun (d1, r1, nullness1) , TType_fun (d2, r2, nullness2) -> + SolveFunTypeEqn csenv ndeep m2 trace None d1 d2 r1 r2 ++ (fun () -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 + ) + + | TType_measure ms1 , TType_measure ms2 -> + UnifyMeasures csenv trace ms1 ms2 + | TType_anon (anonInfo1, l1),TType_anon (anonInfo2, l2) -> SolveAnonInfoEqualsAnonInfo csenv m2 anonInfo1 anonInfo2 ++ (fun () -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2) - | TType_fun (d1, r1), TType_fun (d2, r2) -> SolveFunTypeEqn csenv ndeep m2 trace None d1 d2 r1 r2 - | TType_measure ms1, TType_measure ms2 -> UnifyMeasures csenv trace ms1 ms2 | TType_forall(tps1, rty1), TType_forall(tps2, rty2) -> if tps1.Length <> tps2.Length then localAbortD else let aenv = aenv.BindEquivTypars tps1 tps2 @@ -850,11 +1007,14 @@ and SolveTypeEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTr if not (typarsAEquiv g aenv tps1 tps2) then localAbortD else SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace rty1 rty2 - | TType_ucase (uc1, l1), TType_ucase (uc2, l2) when g.unionCaseRefEq uc1 uc2 -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 + | TType_ucase (uc1, l1) , TType_ucase (uc2, l2) when g.unionCaseRefEq uc1 uc2 -> + SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 + | _ -> localAbortD -and SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty1 ty2 = SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace None ty1 ty2 +and SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty1 ty2 = + SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace None ty1 ty2 and private SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ty1 ty2 = // Back out of expansions of type abbreviations to give improved error messages. @@ -878,7 +1038,9 @@ and SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln origl1 origl2 = loop origl1 origl2 and SolveFunTypeEqn csenv ndeep m2 trace cxsln d1 d2 r1 r2 = trackErrors { - do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln d1 d2 + // TODO NULLNESS: consider whether flipping the actual and expected in argument position + // causes other problems, e.g. better/worse diagnostics + do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln d2 d1 return! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln r1 r2 } @@ -900,47 +1062,69 @@ and SolveTypeSubsumesType (csenv: ConstraintSolverEnv) ndeep m2 (trace: Optional let aenv = csenv.EquivEnv let denv = csenv.DisplayEnv match sty1, sty2 with - | TType_var tp1, _ -> + | TType_var (tp1, nullness1) , _ -> match aenv.EquivTypars.TryFind tp1 with | Some v -> SolveTypeSubsumesType csenv ndeep m2 trace cxsln v ty2 | _ -> match sty2 with - | TType_var r2 when typarEq tp1 r2 -> CompleteD - | TType_var r when not csenv.MatchingOnly -> SolveTyparSubtypeOfType csenv ndeep m2 trace r ty1 + | TType_var (r2, nullness2) when typarEq tp1 r2 -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 + | TType_var (r2, nullness2) when not csenv.MatchingOnly -> + SolveTyparSubtypeOfType csenv ndeep m2 trace r2 ty1 ++ (fun () -> + let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 + SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 nullnessAfterSolution2 + ) | _ -> SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ty1 ty2 - | _, TType_var r when not csenv.MatchingOnly -> SolveTyparSubtypeOfType csenv ndeep m2 trace r ty1 + | _, TType_var (r2, nullness2) when not csenv.MatchingOnly -> + SolveTyparSubtypeOfType csenv ndeep m2 trace r2 ty1 ++ (fun () -> + let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 + SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) nullnessAfterSolution2 + ) | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> if evalTupInfoIsStruct tupInfo1 <> evalTupInfoIsStruct tupInfo2 then ErrorD (ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m, m2)) else SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 (* nb. can unify since no variance *) + + | TType_fun (d1, r1, nullness1) , TType_fun (d2, r2, nullness2) -> + (* nb. can unify since no variance *) + SolveFunTypeEqn csenv ndeep m2 trace cxsln d1 d2 r1 r2 ++ (fun () -> + SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 nullness2 + ) + | TType_anon (anonInfo1, l1), TType_anon (anonInfo2, l2) -> SolveAnonInfoEqualsAnonInfo csenv m2 anonInfo1 anonInfo2 ++ (fun () -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2) (* nb. can unify since no variance *) - | TType_fun (d1, r1), TType_fun (d2, r2) -> SolveFunTypeEqn csenv ndeep m2 trace cxsln d1 d2 r1 r2 (* nb. can unify since no variance *) | TType_measure ms1, TType_measure ms2 -> UnifyMeasures csenv trace ms1 ms2 // Enforce the identities float=float<1>, float32=float32<1> and decimal=decimal<1> - | (_, TType_app (tc2, [ms])) when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms])) - -> SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms (TType_measure Measure.One) - | (TType_app (tc2, [ms]), _) when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms])) - -> SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms (TType_measure Measure.One) + | (_, TType_app (tc2, [ms2], nullness2)) when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms2])) -> + SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms2 (TType_measure Measure.One) ++ (fun () -> + SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) nullness2 + ) + + | (TType_app (tc1, [ms1], nullness1), _) when (tc1.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc1 [ms1])) -> + SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms1 (TType_measure Measure.One) ++ (fun () -> + SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 (nullnessOfTy g sty2) + ) // Special subsumption rule for byref tags - | TType_app (tc1, l1), TType_app (tc2, l2) when tyconRefEq g tc1 tc2 && g.byref2_tcr.CanDeref && tyconRefEq g g.byref2_tcr tc1 -> + | TType_app (tc1, l1, _nullness1) , TType_app (tc2, l2, _nullness2) when tyconRefEq g tc1 tc2 && g.byref2_tcr.CanDeref && tyconRefEq g g.byref2_tcr tc1 -> match l1, l2 with | [ h1; tag1 ], [ h2; tag2 ] -> trackErrors { do! SolveTypeEqualsType csenv ndeep m2 trace None h1 h2 match stripTyEqnsA csenv.g canShortcut tag1, stripTyEqnsA csenv.g canShortcut tag2 with - | TType_app(tagc1, []), TType_app(tagc2, []) + | TType_app(tagc1, [], _), TType_app(tagc2, [], _) when (tyconRefEq g tagc2 g.byrefkind_InOut_tcr && (tyconRefEq g tagc1 g.byrefkind_In_tcr || tyconRefEq g tagc1 g.byrefkind_Out_tcr) ) -> () | _ -> return! SolveTypeEqualsType csenv ndeep m2 trace cxsln tag1 tag2 } | _ -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 - | TType_app (tc1, l1), TType_app (tc2, l2) when tyconRefEq g tc1 tc2 -> - SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 + | TType_app (tc1, l1, nullness1) , TType_app (tc2, l2, nullness2) when tyconRefEq g tc1 tc2 -> + SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 ++ (fun () -> + SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 nullness2 + ) | TType_ucase (uc1, l1), TType_ucase (uc2, l2) when g.unionCaseRefEq uc1 uc2 -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 @@ -992,7 +1176,8 @@ and SolveTypeSubsumesTypeKeepAbbrevs csenv ndeep m2 trace cxsln ty1 ty2 = //------------------------------------------------------------------------- -and SolveTyparSubtypeOfType (csenv: ConstraintSolverEnv) ndeep m2 trace tp ty1 = +// 'T :> ty +and SolveTyparSubtypeOfType (csenv:ConstraintSolverEnv) ndeep m2 trace tp ty1 = let g = csenv.g if isObjTy g ty1 then CompleteD elif typeEquiv g ty1 (mkTyparTy tp) then CompleteD @@ -1475,14 +1660,14 @@ and MemberConstraintSolutionOfMethInfo css m minfo minst = let allArgVars, allArgs = minfo.GetParamTypes(amap, m, minst) |> List.concat |> List.mapi (fun i ty -> mkLocal m ("arg"+string i) ty) |> List.unzip let objArgVars, objArgs = (if minfo.IsInstance then [mkLocal m "this" minfo.ApparentEnclosingType] else []) |> List.unzip let callMethInfoOpt, callExpr, callExprTy = ProvidedMethodCalls.BuildInvokerExpressionForProvidedMethodCall css.TcVal (g, amap, mi, objArgs, NeverMutates, false, ValUseFlag.NormalValUse, allArgs, m) - let closedExprSln = ClosedExprSln (mkLambdas m [] (objArgVars@allArgVars) (callExpr, callExprTy) ) + let closedExprSln = ClosedExprSln (mkLambdas g m [] (objArgVars@allArgVars) (callExpr, callExprTy) ) // If the call is a simple call to an IL method with all the arguments in the natural order, then revert to use ILMethSln. // This is important for calls to operators on generated provided types. There is an (unchecked) condition // that generative providers do not re=order arguments or insert any more information into operator calls. match callMethInfoOpt, callExpr with | Some methInfo, Expr.Op (TOp.ILCall (_useCallVirt, _isProtected, _, _isNewObj, NormalValUse, _isProp, _noTailCall, ilMethRef, _actualTypeInst, actualMethInst, _ilReturnTys), [], args, m) - when (args, (objArgVars@allArgVars)) ||> List.lengthsEqAndForall2 (fun a b -> match a with Expr.Val (v, _, _) -> valEq v.Deref b | _ -> false) -> - let declaringType = Import.ImportProvidedType amap m (methInfo.PApply((fun x -> x.DeclaringType), m)) + when (args, (objArgVars@allArgVars)) ||> List.lengthsEqAndForall2 (fun a b -> match a with Expr.Val(v, _, _) -> valEq v.Deref b | _ -> false) -> + let declaringType = Import.ImportProvidedType amap m (methInfo.PApply((fun x -> nonNull x.DeclaringType), m)) if isILAppTy g declaringType then let extOpt = None // EXTENSION METHODS FROM TYPE PROVIDERS: for extension methods coming from the type providers we would have something here. ILMethSln(declaringType, extOpt, ilMethRef, actualMethInst) @@ -1680,12 +1865,21 @@ and AddConstraint (csenv: ConstraintSolverEnv) ndeep m2 trace tp newConstraint } | TyparConstraint.SupportsComparison _, TyparConstraint.IsDelegate _ - | TyparConstraint.IsDelegate _, TyparConstraint.SupportsComparison _ + | TyparConstraint.IsDelegate _ , TyparConstraint.SupportsComparison _ -> + ErrorD (Error(FSComp.SR.csDelegateComparisonConstraintInconsistent(), m)) + + | TyparConstraint.NotSupportsNull _, TyparConstraint.SupportsNull _ + | TyparConstraint.SupportsNull _, TyparConstraint.NotSupportsNull _ -> + ErrorD (Error(FSComp.SR.csNullNotNullConstraintInconsistent(), m)) + + | TyparConstraint.SupportsNull _, TyparConstraint.IsNonNullableStruct _ + | TyparConstraint.IsNonNullableStruct _, TyparConstraint.SupportsNull _ -> + ErrorD (Error(FSComp.SR.csStructNullConstraintInconsistent(), m)) + | TyparConstraint.IsNonNullableStruct _, TyparConstraint.IsReferenceType _ | TyparConstraint.IsReferenceType _, TyparConstraint.IsNonNullableStruct _ -> ErrorD (Error(FSComp.SR.csStructConstraintInconsistent(), m)) - | TyparConstraint.SupportsComparison _, TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _, TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _, TyparConstraint.SupportsNull _ @@ -1721,6 +1915,7 @@ and AddConstraint (csenv: ConstraintSolverEnv) ndeep m2 trace tp newConstraint // comparison implies equality | TyparConstraint.SupportsComparison _, TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _, TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _, TyparConstraint.NotSupportsNull _ | TyparConstraint.IsNonNullableStruct _, TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsUnmanaged _, TyparConstraint.IsUnmanaged _ | TyparConstraint.IsReferenceType _, TyparConstraint.IsReferenceType _ @@ -1788,20 +1983,129 @@ and AddConstraint (csenv: ConstraintSolverEnv) ndeep m2 trace tp newConstraint } -and SolveTypeSupportsNull (csenv: ConstraintSolverEnv) ndeep m2 trace ty = +and SolveNullnessSupportsNull (csenv:ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) ty nullness = trackErrors { let g = csenv.g let m = csenv.m let denv = csenv.DisplayEnv - match tryDestTyparTy g ty with - | ValueSome destTypar -> - AddConstraint csenv ndeep m2 trace destTypar (TyparConstraint.SupportsNull m) - | ValueNone -> - if TypeSatisfiesNullConstraint g m ty then CompleteD else + match nullness with + | Nullness.Variable nv -> + if nv.IsSolved then + do! SolveNullnessSupportsNull csenv ndeep m2 trace ty nv.Solution + else + trace.Exec (fun () -> nv.Set KnownWithNull) (fun () -> nv.Unset()) + | Nullness.Known n1 -> + match n1 with + | NullnessInfo.AmbivalentToNull -> () + | NullnessInfo.WithNull -> () + | NullnessInfo.WithoutNull -> + if g.checkNullness then + if not (isObjTy g ty) then + return! WarnD(ConstraintSolverNullnessWarningWithType(denv, ty, n1, m, m2)) + } + +and SolveTypeSupportsNullCore (csenv:ConstraintSolverEnv) ndeep m2 trace ty = trackErrors { + let g = csenv.g + let m = csenv.m + let denv = csenv.DisplayEnv + if TypeNullIsExtraValueNew g m ty then + () + else match ty with | NullableTy g _ -> - ErrorD (ConstraintSolverError(FSComp.SR.csNullableTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2)) + return! ErrorD (ConstraintSolverError(FSComp.SR.csNullableTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2)) | _ -> - ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2)) + // If langFeatureNullness is on then solve, maybe give warnings + if g.langFeatureNullness then + let nullness = nullnessOfTy g ty + do! SolveNullnessSupportsNull csenv ndeep m2 trace ty nullness + + // If langFeatureNullness or checkNullness are off give the same errors as F# 4.5 + if not g.langFeatureNullness || not g.checkNullness then + if not (TypeNullIsExtraValueOld g m ty) then + return! ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2)) + } + +// This version prefers to constrain a type parameter definiton +and SolveTypeDefnSupportsNull (csenv:ConstraintSolverEnv) ndeep m2 trace ty = + let g = csenv.g + let m = csenv.m + match stripTyparEqns ty with + // If you set a type variable constrained with a T: null to U? then you don't induce an inference constraint + // of U: null. + // TODO: what about Obsolete? + | TType_var(_, nullness) when nullness.Evaluate() = NullnessInfo.WithNull -> CompleteD + | _ -> + match tryDestTyparTy g ty with + | ValueSome tp -> + AddConstraint csenv ndeep m2 trace tp (TyparConstraint.SupportsNull m) + | ValueNone -> + SolveTypeSupportsNullCore csenv ndeep m2 trace ty + +// This version prefers to constrain the nullness annotation +and SolveTypeUseSupportsNull (csenv:ConstraintSolverEnv) ndeep m2 trace ty = + let m = csenv.m + match stripTyparEqns ty with + | TType_var(tp, nullness) -> + AddConstraint csenv ndeep m2 trace tp (TyparConstraint.IsReferenceType m) ++ (fun () -> + SolveNullnessSupportsNull csenv ndeep m2 trace ty nullness) + | _ -> + SolveTypeSupportsNullCore csenv ndeep m2 trace ty + +and SolveNullnessNotSupportsNull (csenv:ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) ty nullness = trackErrors { + let g = csenv.g + let m = csenv.m + let denv = csenv.DisplayEnv + match nullness with + | Nullness.Variable nv -> + if nv.IsSolved then + do! SolveNullnessNotSupportsNull csenv ndeep m2 trace ty nv.Solution + else + trace.Exec (fun () -> nv.Set KnownWithoutNull) (fun () -> nv.Unset()) + | Nullness.Known n1 -> + match n1 with + | NullnessInfo.AmbivalentToNull -> () + | NullnessInfo.WithoutNull -> () + | NullnessInfo.WithNull -> + if g.checkNullness then + if not (isObjTy g ty) then + return! WarnD(ConstraintSolverNonNullnessWarningWithType(denv, ty, n1, m, m2)) + else + if TypeNullIsExtraValueOld g m ty then + return! ErrorD (ConstraintSolverError(FSComp.SR.csTypeHasNullAsExtraValue(NicePrint.minimalStringOfType denv ty), m, m2)) + } + +and SolveTypeNotSupportsNullCore (csenv:ConstraintSolverEnv) ndeep m2 trace ty = trackErrors { + let g = csenv.g + let m = csenv.m + let denv = csenv.DisplayEnv + if TypeNullIsTrueValue g ty then + // We can only give warnings here as F# 5.0 introduces these constraints into existing + // code via Option.ofObj and Option.toObj + do! WarnD (ConstraintSolverError(FSComp.SR.csTypeHasNullAsTrueValue(NicePrint.minimalStringOfType denv ty), m, m2)) + elif TypeNullIsExtraValueNew g m ty then + if g.checkNullness || TypeNullIsExtraValueOld g m ty then + do! WarnD (ConstraintSolverError(FSComp.SR.csTypeHasNullAsExtraValue(NicePrint.minimalStringOfType denv ty), m, m2)) + else + if g.checkNullness then + let nullness = nullnessOfTy g ty + do! SolveNullnessNotSupportsNull csenv ndeep m2 trace ty nullness + } + +// This version prefers to constrain a type parameter definiton +and SolveTypeDefnNotSupportsNull (csenv:ConstraintSolverEnv) ndeep m2 trace ty = + let g = csenv.g + let m = csenv.m + //match stripTyparEqns ty with + //// If you set a type variable constrained with a T: not null to U then you don't induce an inference constraint + //// of U: not null. + //// TODO: what about Obsolete? + //| TType_var(_, nullness) when nullness.TryEvaluate() = Some NullnessInfo.WithoutNull || nullness.TryEvaluate() = Some NullnessInfo.AmbivalentToNull -> CompleteD + //| _ -> + match tryDestTyparTy g ty with + | ValueSome tp -> + AddConstraint csenv ndeep m2 trace tp (TyparConstraint.NotSupportsNull m) + | ValueNone -> + SolveTypeNotSupportsNullCore csenv ndeep m2 trace ty and SolveTypeSupportsComparison (csenv: ConstraintSolverEnv) ndeep m2 trace ty = let g = csenv.g @@ -1984,7 +2288,7 @@ and SolveTypeRequiresDefaultConstructor (csenv: ConstraintSolverEnv) ndeep m2 tr | ValueSome destTypar -> AddConstraint csenv ndeep m2 trace destTypar (TyparConstraint.RequiresDefaultConstructor m) | _ -> - if isStructTy g ty && TypeHasDefaultValue g m ty then + if isStructTy g ty && TypeHasDefaultValueOld g m ty then CompleteD else if GetIntrinsicConstructorInfosOfType csenv.InfoReader m ty @@ -2047,12 +2351,16 @@ and CanMemberSigsMatchUpToCheck else return! ErrorD(Error (FSComp.SR.csMemberIsNotInstance(minfo.LogicalName), m)) else - do! Iterate2D subsumeTypes calledObjArgTys callerObjArgTys + // The object types must be non-null + let nonNullCalledObjArgTys = calledObjArgTys |> List.map (replaceNullnessOfTy g.knownWithoutNull) + do! Iterate2D subsumeTypes nonNullCalledObjArgTys callerObjArgTys + for argSet in calledMeth.ArgSets do if argSet.UnnamedCalledArgs.Length <> argSet.UnnamedCallerArgs.Length then return! ErrorD(Error(FSComp.SR.csArgumentLengthMismatch(), m)) else do! Iterate2D subsumeArg argSet.UnnamedCalledArgs argSet.UnnamedCallerArgs + match calledMeth.ParamArrayCalledArgOpt with | Some calledArg -> if isArray1DTy g calledArg.CalledArgumentType then @@ -2707,8 +3015,18 @@ let AddCxMethodConstraint denv css m trace traitInfo = (fun res -> ErrorD (ErrorFromAddingConstraint(denv, res, m))) |> RaiseOperationResult -let AddCxTypeMustSupportNull denv css m trace ty = - TryD (fun () -> SolveTypeSupportsNull (MakeConstraintSolverEnv ContextInfo.NoContext css m denv) 0 m trace ty) +let AddCxTypeDefnSupportsNull denv css m trace ty = + TryD (fun () -> SolveTypeDefnSupportsNull (MakeConstraintSolverEnv ContextInfo.NoContext css m denv) 0 m trace ty) + (fun res -> ErrorD (ErrorFromAddingConstraint(denv, res, m))) + |> RaiseOperationResult + +let AddCxTypeDefnNotSupportsNull denv css m trace ty = + TryD (fun () -> SolveTypeDefnNotSupportsNull (MakeConstraintSolverEnv ContextInfo.NoContext css m denv) 0 m trace ty) + (fun res -> ErrorD (ErrorFromAddingConstraint(denv, res, m))) + |> RaiseOperationResult + +let AddCxTypeUseSupportsNull denv css m trace ty = + TryD (fun () -> SolveTypeUseSupportsNull (MakeConstraintSolverEnv ContextInfo.NoContext css m denv) 0 m trace ty) (fun res -> ErrorD (ErrorFromAddingConstraint(denv, res, m))) |> RaiseOperationResult diff --git a/src/fsharp/ConstraintSolver.fsi b/src/fsharp/ConstraintSolver.fsi index 59c271b126b..b78af7fdf41 100644 --- a/src/fsharp/ConstraintSolver.fsi +++ b/src/fsharp/ConstraintSolver.fsi @@ -1,3 +1,4 @@ + // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. /// Solves constraints using a mutable constraint-solver state @@ -20,7 +21,7 @@ open FSharp.Compiler.InfoReader val NewAnonTypar : TyparKind * range * TyparRigidity * TyparStaticReq * TyparDynamicReq -> Typar /// Create an inference type variable -val NewInferenceType : unit -> TType +val NewInferenceType : TcGlobals -> TType /// Create an inference type variable for the kind of a byref pointer val NewByRefKindInferenceType : TcGlobals -> range -> TType @@ -32,7 +33,7 @@ val NewErrorType : unit -> TType val NewErrorMeasure : unit -> Measure /// Create a list of inference type variables, one for each element in the input list -val NewInferenceTypes : 'a list -> TType list +val NewInferenceTypes : TcGlobals -> 'a list -> TType list /// Given a set of formal type parameters and their constraints, make new inference type variables for /// each and ensure that the constraints on the new type variables are adjusted to refer to these. @@ -81,6 +82,10 @@ exception ConstraintSolverInfiniteTypes of displayEnv: DisplayEn exception ConstraintSolverTypesNotInEqualityRelation of displayEnv: DisplayEnv * TType * TType * range * range * ContextInfo exception ConstraintSolverTypesNotInSubsumptionRelation of displayEnv: DisplayEnv * TType * TType * range * range exception ConstraintSolverMissingConstraint of displayEnv: DisplayEnv * Typar * TyparConstraint * range * range +exception ConstraintSolverNullnessWarningEquivWithTypes of DisplayEnv * TType * TType * NullnessInfo * NullnessInfo * range * range +exception ConstraintSolverNullnessWarningWithTypes of DisplayEnv * TType * TType * NullnessInfo * NullnessInfo * range * range +exception ConstraintSolverNullnessWarningWithType of DisplayEnv * TType * NullnessInfo * range * range +exception ConstraintSolverNonNullnessWarningWithType of DisplayEnv * TType * NullnessInfo * range * range exception ConstraintSolverError of string * range * range exception ConstraintSolverRelatedInformation of string option * range * exn @@ -131,7 +136,9 @@ val AddCxTypeMustSubsumeType : ContextInfo -> DisplayEnv -> Con val AddCxTypeMustSubsumeTypeUndoIfFailed : DisplayEnv -> ConstraintSolverState -> range -> TType -> TType -> bool val AddCxTypeMustSubsumeTypeMatchingOnlyUndoIfFailed : DisplayEnv -> ConstraintSolverState -> range -> TType -> TType -> bool val AddCxMethodConstraint : DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TraitConstraintInfo -> unit -val AddCxTypeMustSupportNull : DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> unit +val AddCxTypeDefnNotSupportsNull : DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> unit +val AddCxTypeDefnSupportsNull : DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> unit +val AddCxTypeUseSupportsNull : DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> unit val AddCxTypeMustSupportComparison : DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> unit val AddCxTypeMustSupportEquality : DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> unit val AddCxTypeMustSupportDefaultCtor : DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> unit diff --git a/src/fsharp/DetupleArgs.fs b/src/fsharp/DetupleArgs.fs index 9af6d4f32ac..271e00f5ccd 100644 --- a/src/fsharp/DetupleArgs.fs +++ b/src/fsharp/DetupleArgs.fs @@ -484,7 +484,7 @@ let mkTransform g (f: Val) m tps x1Ntys rty (callPattern, tyfringes: (TType list let tys1r = List.collect fst tyfringes (* types for collapsed initial r args *) let tysrN = List.drop tyfringes.Length x1Ntys (* types for remaining args *) let argtys = tys1r @ tysrN - let fCty = mkLambdaTy tps argtys rty + let fCty = mkLambdaTy g tps argtys rty let transformedVal = mkLocalVal f.Range (globalNng.FreshCompilerGeneratedName (f.LogicalName, f.Range)) fCty topValInfo { transformCallPattern = callPattern transformedFormals = transformedFormals @@ -800,8 +800,8 @@ let passBind penv (TBind(fOrig, repr, letSeqPtOpt) as bind) = let rebinds = List.concat (List.map2 transRebind transformedFormals x1ps) // fCBody - rebuild // fCBody = TLambda tps. Lam formals. let rebinds in body - let rbody, rt = mkLetsBind m rebinds body, rty - let bind = mkMultiLambdaBind transformedVal letSeqPtOpt m tps formals (rbody, rt) + let rbody, rt = mkLetsBind m rebinds body, rty + let bind = mkMultiLambdaBind penv.g transformedVal letSeqPtOpt m tps formals (rbody, rt) // result bind diff --git a/src/fsharp/ErrorLogger.fs b/src/fsharp/ErrorLogger.fs index e84b5c69e4b..c7c4f961e82 100755 --- a/src/fsharp/ErrorLogger.fs +++ b/src/fsharp/ErrorLogger.fs @@ -231,7 +231,6 @@ type PhasedDiagnostic = | BuildPhaseSubcategory.Parameter | BuildPhaseSubcategory.Parse | BuildPhaseSubcategory.TypeCheck -> true - | null | BuildPhaseSubcategory.DefaultPhase | BuildPhaseSubcategory.CodeGen | BuildPhaseSubcategory.Optimize @@ -634,8 +633,14 @@ let NewlineifyErrorString (message:string) = message.Replace(stringThatIsAProxyF /// fixes given string by replacing all control chars with spaces. /// NOTE: newlines are recognized and replaced with stringThatIsAProxyForANewlineInFlatErrors (ASCII 29, the 'group separator'), /// which is decoded by the IDE with 'NewlineifyErrorString' back into newlines, so that multi-line errors can be displayed in QuickInfo +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let NormalizeErrorString (text : string) = if isNull text then nullArg "text" +#else +let NormalizeErrorString (text : string?) = + let text = nullArgCheck "text" text +#endif + let text = text.Trim() let buf = System.Text.StringBuilder() diff --git a/src/fsharp/ExtensionTyping.fs b/src/fsharp/ExtensionTyping.fs index 9f58399d333..77afc04505e 100755 --- a/src/fsharp/ExtensionTyping.fs +++ b/src/fsharp/ExtensionTyping.fs @@ -45,9 +45,9 @@ module internal ExtensionTyping = // Detect the host tooling context let toolingCompatibleVersions() = if typeof.Assembly.GetName().Name = "mscorlib" then - [ "net461"; "net452"; "net451"; "net45"; "netstandard2.0"] + [ "net471"; "net47"; "net462"; "net461"; "net452"; "net451"; "net45"; "netstandard2.0"] elif typeof.Assembly.GetName().Name = "System.Private.CoreLib" then - [ "netcoreapp2.0"; "netstandard2.0"] + [ "netcoreapp2.1"; "netcoreapp2.0"; "netstandard2.0"] else System.Diagnostics.Debug.Assert(false, "Couldn't determine runtime tooling context, assuming it supports at least .NET Standard 2.0") [ "netstandard2.0"] @@ -131,8 +131,11 @@ module internal ExtensionTyping = let filtered = [ for t in exportedTypes do let ca = t.GetCustomAttributes(typeof, true) - if ca <> null && ca.Length > 0 then - yield t ] + match ca with + | null -> () + | NonNull ca -> + if ca.Length > 0 then + yield t ] filtered with e -> raiseError e @@ -235,7 +238,7 @@ module internal ExtensionTyping = let unmarshal (t: Tainted<_>) = t.PUntaintNoFailure id /// Try to access a member on a provided type, catching and reporting errors - let TryTypeMember(st: Tainted<_>, fullName, memberName, m, recover, f) = + let TryTypeMember<'T,'U>(st: Tainted<'T>, fullName, memberName, m, recover, f: 'T -> 'U) = try st.PApply (f, m) with :? TypeProviderError as tpe -> @@ -244,16 +247,11 @@ module internal ExtensionTyping = /// Try to access a member on a provided type, where the result is an array of values, catching and reporting errors let TryTypeMemberArray (st: Tainted<_>, fullName, memberName, m, f) = - let result = - try - st.PApplyArray(f, memberName, m) - with :? TypeProviderError as tpe -> - tpe.Iter (fun e -> error(Error(FSComp.SR.etUnexpectedExceptionFromProvidedTypeMember(fullName, memberName, e.ContextualErrorMessage), m))) - [||] - - match result with - | null -> error(Error(FSComp.SR.etUnexpectedNullFromProvidedTypeMember(fullName, memberName), m)); [||] - | r -> r + try + st.PApplyArray(f, memberName, m) + with :? TypeProviderError as tpe -> + tpe.Iter (fun e -> error(Error(FSComp.SR.etUnexpectedExceptionFromProvidedTypeMember(fullName, memberName, e.ContextualErrorMessage), m))) + [||] /// Try to access a member on a provided type, catching and reporting errors and checking the result is non-null, let TryTypeMemberNonNull (st: Tainted<_>, fullName, memberName, m, recover, f) = @@ -261,7 +259,7 @@ module internal ExtensionTyping = | Tainted.Null -> errorR(Error(FSComp.SR.etUnexpectedNullFromProvidedTypeMember(fullName, memberName), m)); st.PApplyNoFailure(fun _ -> recover) - | r -> r + | Tainted.NonNull r -> r /// Try to access a property or method on a provided member, catching and reporting errors let TryMemberMember (mi: Tainted<_>, typeName, memberName, memberMemberName, m, recover, f) = @@ -276,8 +274,14 @@ module internal ExtensionTyping = resolver.PUntaint((fun tp -> tp.GetType().Name), m) /// Validate a provided namespace name - let ValidateNamespaceName(name, typeProvider: Tainted, m, nsp: string) = - if nsp<>null then // Null namespace designates the global namespace. +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let ValidateNamespaceName(name, typeProvider: Tainted, m, nsp:string) = +#else + let ValidateNamespaceName(name, typeProvider: Tainted, m, nsp:string?) = +#endif + match nsp with + | null -> () + | NonNull nsp -> if String.IsNullOrWhiteSpace nsp then // Empty namespace is not allowed errorR(Error(FSComp.SR.etEmptyNamespaceOfTypeNotAllowed(name, typeProvider.PUntaint((fun tp -> tp.GetType().Name), m)), m)) @@ -361,7 +365,10 @@ module internal ExtensionTyping = type CustomAttributeNamedArgument = System.Reflection.CustomAttributeNamedArgument type CustomAttributeTypedArgument = System.Reflection.CustomAttributeTypedArgument - [] + [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif type ProvidedType (x: System.Type, ctxt: ProvidedTypeContext) = inherit ProvidedMemberInfo(x, ctxt) let provide () = ProvidedCustomAttributeProvider.Create (fun _provider -> x.CustomAttributes) @@ -380,7 +387,11 @@ module internal ExtensionTyping = member __.IsSuppressRelocate = (x.Attributes &&& enum (int32 TypeProviderTypeAttributes.SuppressRelocate)) <> enum 0 member __.IsErased = (x.Attributes &&& enum (int32 TypeProviderTypeAttributes.IsErased)) <> enum 0 member __.IsGenericType = x.IsGenericType - member __.Namespace = x.Namespace +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + member __.Namespace : string = x.Namespace +#else + member __.Namespace : string? = x.Namespace +#endif member __.FullName = x.FullName member __.IsArray = x.IsArray member __.Assembly = x.Assembly |> ProvidedAssembly.Create ctxt @@ -421,16 +432,39 @@ module internal ExtensionTyping = member __.GetArrayRank() = x.GetArrayRank() member __.GenericParameterPosition = x.GenericParameterPosition member __.RawSystemType = x + /// Type.GetEnumUnderlyingType either returns type or raises exception, null is not permitted member __.GetEnumUnderlyingType() = x.GetEnumUnderlyingType() |> ProvidedType.CreateWithNullCheck ctxt "EnumUnderlyingType" - static member Create ctxt x = match x with null -> null | t -> ProvidedType (t, ctxt) - static member CreateWithNullCheck ctxt name x = match x with null -> nullArg name | t -> ProvidedType (t, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedType.Create ctxt) - static member CreateNoContext (x: Type) = ProvidedType.Create ProvidedTypeContext.Empty x + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + static member Create ctxt x : ProvidedType = +#else + static member Create ctxt x : ProvidedType? = +#endif + match x with + | null -> null + | NonNull t -> ProvidedType (t, ctxt) + + static member CreateNonNull ctxt x = ProvidedType (x, ctxt) + + static member CreateWithNullCheck ctxt name x = + match x with + | null -> nullArg name + | t -> ProvidedType (t, ctxt) + + static member CreateArray ctxt xs = + match box xs with + | null -> [| |] + | _ -> xs |> Array.map (ProvidedType.CreateNonNull ctxt) + + static member CreateNoContext (x:Type) = ProvidedType.Create ProvidedTypeContext.Empty x + static member Void = ProvidedType.CreateNoContext typeof + member __.Handle = x + override __.Equals y = assert false; match y with :? ProvidedType as y -> x.Equals y.Handle | _ -> false override __.GetHashCode() = assert false; x.GetHashCode() member __.TryGetILTypeRef() = ctxt.TryGetILTypeRef x @@ -440,12 +474,22 @@ module internal ExtensionTyping = static member TaintedEquals (pt1: Tainted, pt2: Tainted) = Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle)) - and [] + and +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif IProvidedCustomAttributeProvider = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE abstract GetDefinitionLocationAttribute : provider: ITypeProvider -> (string * int * int) option +#else + abstract GetDefinitionLocationAttribute : provider: ITypeProvider -> (string? * int * int) option +#endif + abstract GetXmlDocAttributes : provider: ITypeProvider -> string[] - abstract GetHasTypeProviderEditorHideMethodsAttribute : provider: ITypeProvider -> bool - abstract GetAttributeConstructorArgs: provider: ITypeProvider * attribName: string -> (obj option list * (string * obj option) list) option + + abstract GetHasTypeProviderEditorHideMethodsAttribute : provider:ITypeProvider -> bool + + abstract GetAttributeConstructorArgs: provider:ITypeProvider * attribName:string -> (obj option list * (string * obj option) list) option and ProvidedCustomAttributeProvider = static member Create (attributes :(ITypeProvider -> seq)) : IProvidedCustomAttributeProvider = @@ -491,7 +535,10 @@ module internal ExtensionTyping = None) |> Seq.toArray } - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedMemberInfo (x: System.Reflection.MemberInfo, ctxt) = let provide () = ProvidedCustomAttributeProvider.Create (fun _provider -> x.CustomAttributes) member __.Name = x.Name @@ -503,39 +550,72 @@ module internal ExtensionTyping = member __.GetXmlDocAttributes provider = provide().GetXmlDocAttributes provider member __.GetAttributeConstructorArgs (provider, attribName) = provide().GetAttributeConstructorArgs (provider, attribName) - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedParameterInfo (x: System.Reflection.ParameterInfo, ctxt) = let provide () = ProvidedCustomAttributeProvider.Create (fun _provider -> x.CustomAttributes) - member __.Name = x.Name + member __.Name = let nm = x.Name in match box nm with null -> "" | _ -> nm member __.IsOut = x.IsOut member __.IsIn = x.IsIn member __.IsOptional = x.IsOptional member __.RawDefaultValue = x.RawDefaultValue member __.HasDefaultValue = x.Attributes.HasFlag(System.Reflection.ParameterAttributes.HasDefault) /// ParameterInfo.ParameterType cannot be null - member __.ParameterType = ProvidedType.CreateWithNullCheck ctxt "ParameterType" x.ParameterType - static member Create ctxt x = match x with null -> null | t -> ProvidedParameterInfo (t, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedParameterInfo.Create ctxt) // TODO null wrong? + member __.ParameterType = ProvidedType.CreateWithNullCheck ctxt "ParameterType" x.ParameterType + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + static member Create ctxt (x: ParameterInfo) : ProvidedParameterInfo = +#else + static member Create ctxt (x: ParameterInfo?) : ProvidedParameterInfo? = +#endif + match x with + | null -> null + | NonNull x -> ProvidedParameterInfo (x, ctxt) + + static member CreateNonNull ctxt x = ProvidedParameterInfo (x, ctxt) + + static member CreateArray ctxt (xs: ParameterInfo[]) : ProvidedParameterInfo[] = + match box xs with + | null -> [| |] + | _ -> xs |> Array.map (ProvidedParameterInfo.CreateNonNull ctxt) + interface IProvidedCustomAttributeProvider with member __.GetHasTypeProviderEditorHideMethodsAttribute provider = provide().GetHasTypeProviderEditorHideMethodsAttribute provider member __.GetDefinitionLocationAttribute provider = provide().GetDefinitionLocationAttribute provider member __.GetXmlDocAttributes provider = provide().GetXmlDocAttributes provider member __.GetAttributeConstructorArgs (provider, attribName) = provide().GetAttributeConstructorArgs (provider, attribName) + member __.Handle = x override __.Equals y = assert false; match y with :? ProvidedParameterInfo as y -> x.Equals y.Handle | _ -> false override __.GetHashCode() = assert false; x.GetHashCode() - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedAssembly (x: System.Reflection.Assembly, _ctxt) = member __.GetName() = x.GetName() member __.FullName = x.FullName - member __.GetManifestModuleContents(provider: ITypeProvider) = provider.GetGeneratedAssemblyContents x - static member Create ctxt x = match x with null -> null | t -> ProvidedAssembly (t, ctxt) + member __.GetManifestModuleContents (provider: ITypeProvider) = provider.GetGeneratedAssemblyContents x + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + static member Create ctxt x : ProvidedAssembly = match x with null -> null | t -> ProvidedAssembly (t, ctxt) +#else + static member Create ctxt x : ProvidedAssembly? = match x with null -> null | t -> ProvidedAssembly (t, ctxt) +#endif + member __.Handle = x + override __.Equals y = assert false; match y with :? ProvidedAssembly as y -> x.Equals y.Handle | _ -> false + override __.GetHashCode() = assert false; x.GetHashCode() - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedMethodBase (x: System.Reflection.MethodBase, ctxt) = inherit ProvidedMemberInfo(x, ctxt) member __.Context = ctxt @@ -553,8 +633,12 @@ module internal ExtensionTyping = member __.GetParameters() = x.GetParameters() |> ProvidedParameterInfo.CreateArray ctxt member __.GetGenericArguments() = x.GetGenericArguments() |> ProvidedType.CreateArray ctxt member __.Handle = x + static member TaintedGetHashCode (x: Tainted) = - Tainted.GetHashCodeTainted (x.PApplyNoFailure(fun st -> (st.Name, st.DeclaringType.Assembly.FullName, st.DeclaringType.FullName))) + Tainted.GetHashCodeTainted + (x.PApplyNoFailure(fun st -> (st.Name, (nonNull (nonNull st.DeclaringType).Assembly).FullName, + (nonNull st.DeclaringType).FullName))) + static member TaintedEquals (pt1: Tainted, pt2: Tainted) = Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle)) @@ -597,16 +681,34 @@ module internal ExtensionTyping = | :? System.Reflection.MethodBase as mb -> mb | _ -> failwith (FSComp.SR.estApplyStaticArgumentsForMethodNotImplemented()) match mb with - | :? System.Reflection.MethodInfo as mi -> (mi |> ProvidedMethodInfo.Create ctxt : ProvidedMethodInfo) :> ProvidedMethodBase - | :? System.Reflection.ConstructorInfo as ci -> (ci |> ProvidedConstructorInfo.Create ctxt : ProvidedConstructorInfo) :> ProvidedMethodBase + | :? System.Reflection.MethodInfo as mi -> (mi |> ProvidedMethodInfo.CreateNonNull ctxt : ProvidedMethodInfo) :> ProvidedMethodBase + | :? System.Reflection.ConstructorInfo as ci -> (ci |> ProvidedConstructorInfo.CreateNonNull ctxt : ProvidedConstructorInfo) :> ProvidedMethodBase | _ -> failwith (FSComp.SR.estApplyStaticArgumentsForMethodNotImplemented()) - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedFieldInfo (x: System.Reflection.FieldInfo, ctxt) = inherit ProvidedMemberInfo(x, ctxt) - static member Create ctxt x = match x with null -> null | t -> ProvidedFieldInfo (t, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedFieldInfo.Create ctxt) + + static member CreateNonNull ctxt x = ProvidedFieldInfo (x, ctxt) + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + static member Create ctxt x : ProvidedFieldInfo = +#else + static member Create ctxt x : ProvidedFieldInfo? = +#endif + match x with + | null -> null + | NonNull x -> ProvidedFieldInfo (x, ctxt) + + static member CreateArray ctxt xs : ProvidedFieldInfo[] = + match box xs with + | null -> [| |] + | _ -> xs |> Array.map (ProvidedFieldInfo.CreateNonNull ctxt) + member __.IsInitOnly = x.IsInitOnly member __.IsStatic = x.IsStatic member __.IsSpecialName = x.IsSpecialName @@ -627,15 +729,32 @@ module internal ExtensionTyping = - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedMethodInfo (x: System.Reflection.MethodInfo, ctxt) = inherit ProvidedMethodBase(x, ctxt) member __.ReturnType = x.ReturnType |> ProvidedType.CreateWithNullCheck ctxt "ReturnType" - static member Create ctxt x = match x with null -> null | t -> ProvidedMethodInfo (t, ctxt) + static member CreateNonNull ctxt (x: MethodInfo) : ProvidedMethodInfo = + ProvidedMethodInfo (x, ctxt) + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + static member Create ctxt (x: MethodInfo) : ProvidedMethodInfo = +#else + static member Create ctxt (x: MethodInfo?) : ProvidedMethodInfo? = +#endif + match x with + | null -> null + | NonNull x -> ProvidedMethodInfo (x, ctxt) + + static member CreateArray ctxt (xs: MethodInfo[]) : ProvidedMethodInfo[] = + match box xs with + | null -> [| |] + | _ -> xs |> Array.map (ProvidedMethodInfo.CreateNonNull ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedMethodInfo.Create ctxt) member __.Handle = x #if !FX_NO_REFLECTION_METADATA_TOKENS member __.MetadataToken = x.MetadataToken @@ -643,7 +762,10 @@ module internal ExtensionTyping = override __.Equals y = assert false; match y with :? ProvidedMethodInfo as y -> x.Equals y.Handle | _ -> false override __.GetHashCode() = assert false; x.GetHashCode() - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedPropertyInfo (x: System.Reflection.PropertyInfo, ctxt) = inherit ProvidedMemberInfo(x, ctxt) member __.GetGetMethod() = x.GetGetMethod() |> ProvidedMethodInfo.Create ctxt @@ -653,64 +775,160 @@ module internal ExtensionTyping = member __.GetIndexParameters() = x.GetIndexParameters() |> ProvidedParameterInfo.CreateArray ctxt /// PropertyInfo.PropertyType cannot be null member __.PropertyType = x.PropertyType |> ProvidedType.CreateWithNullCheck ctxt "PropertyType" - static member Create ctxt x = match x with null -> null | t -> ProvidedPropertyInfo (t, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedPropertyInfo.Create ctxt) + + static member CreateNonNull ctxt x = ProvidedPropertyInfo (x, ctxt) + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + static member Create ctxt x : ProvidedPropertyInfo = +#else + static member Create ctxt x : ProvidedPropertyInfo? = +#endif + match x with + | null -> null + | NonNull x -> ProvidedPropertyInfo (x, ctxt) + + static member CreateArray ctxt xs : ProvidedPropertyInfo[] = + match box xs with + | null -> [| |] + | _ -> xs |> Array.map (ProvidedPropertyInfo.CreateNonNull ctxt) + member __.Handle = x + override __.Equals y = assert false; match y with :? ProvidedPropertyInfo as y -> x.Equals y.Handle | _ -> false + override __.GetHashCode() = assert false; x.GetHashCode() + static member TaintedGetHashCode (x: Tainted) = - Tainted.GetHashCodeTainted (x.PApplyNoFailure(fun st -> (st.Name, st.DeclaringType.Assembly.FullName, st.DeclaringType.FullName))) + Tainted.GetHashCodeTainted + (x.PApplyNoFailure(fun st -> (st.Name, (nonNull (nonNull st.DeclaringType).Assembly).FullName, + (nonNull st.DeclaringType).FullName))) + static member TaintedEquals (pt1: Tainted, pt2: Tainted) = Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle)) - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedEventInfo (x: System.Reflection.EventInfo, ctxt) = inherit ProvidedMemberInfo(x, ctxt) member __.GetAddMethod() = x.GetAddMethod() |> ProvidedMethodInfo.Create ctxt member __.GetRemoveMethod() = x.GetRemoveMethod() |> ProvidedMethodInfo.Create ctxt /// EventInfo.EventHandlerType cannot be null member __.EventHandlerType = x.EventHandlerType |> ProvidedType.CreateWithNullCheck ctxt "EventHandlerType" - static member Create ctxt x = match x with null -> null | t -> ProvidedEventInfo (t, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedEventInfo.Create ctxt) + + static member CreateNonNull ctxt x = ProvidedEventInfo (x, ctxt) + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + static member Create ctxt x : ProvidedEventInfo = +#else + static member Create ctxt x : ProvidedEventInfo? = +#endif + match x with + | null -> null + | NonNull x -> ProvidedEventInfo (x, ctxt) + + static member CreateArray ctxt xs : ProvidedEventInfo[] = + match box xs with + | null -> [| |] + | _ -> xs |> Array.map (ProvidedEventInfo.CreateNonNull ctxt) + member __.Handle = x + override __.Equals y = assert false; match y with :? ProvidedEventInfo as y -> x.Equals y.Handle | _ -> false + override __.GetHashCode() = assert false; x.GetHashCode() + static member TaintedGetHashCode (x: Tainted) = - Tainted.GetHashCodeTainted (x.PApplyNoFailure(fun st -> (st.Name, st.DeclaringType.Assembly.FullName, st.DeclaringType.FullName))) + Tainted.GetHashCodeTainted + (x.PApplyNoFailure(fun st -> (st.Name, (nonNull (nonNull st.DeclaringType).Assembly).FullName, + (nonNull st.DeclaringType).FullName))) + static member TaintedEquals (pt1: Tainted, pt2: Tainted) = Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle)) - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedConstructorInfo (x: System.Reflection.ConstructorInfo, ctxt) = inherit ProvidedMethodBase(x, ctxt) - static member Create ctxt x = match x with null -> null | t -> ProvidedConstructorInfo (t, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedConstructorInfo.Create ctxt) + + static member CreateNonNull ctxt x = ProvidedConstructorInfo (x, ctxt) + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + static member Create ctxt (x: ConstructorInfo) : ProvidedConstructorInfo = +#else + static member Create ctxt (x: ConstructorInfo?) : ProvidedConstructorInfo? = +#endif + match x with + | null -> null + | NonNull x -> ProvidedConstructorInfo (x, ctxt) + + static member CreateArray ctxt xs : ProvidedConstructorInfo[] = + match box xs with + | null -> [| |] + | _ -> xs |> Array.map (ProvidedConstructorInfo.CreateNonNull ctxt) + member __.Handle = x override __.Equals y = assert false; match y with :? ProvidedConstructorInfo as y -> x.Equals y.Handle | _ -> false override __.GetHashCode() = assert false; x.GetHashCode() - [] + [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif type ProvidedExpr (x: Quotations.Expr, ctxt) = member __.Type = x.Type |> ProvidedType.Create ctxt member __.Handle = x member __.Context = ctxt member __.UnderlyingExpressionString = x.ToString() - static member Create ctxt t = match box t with null -> null | _ -> ProvidedExpr (t, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedExpr.Create ctxt) + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + static member Create ctxt t : ProvidedExpr = +#else + static member Create ctxt t : ProvidedExpr? = +#endif + match box t with + | null -> null + | _ -> ProvidedExpr (t, ctxt) + + static member CreateNonNull ctxt t : ProvidedExpr = + ProvidedExpr (t, ctxt) + + static member CreateArray ctxt xs : ProvidedExpr[] = + match box xs with + | null -> [| |] + | _ -> xs |> Array.map (ProvidedExpr.CreateNonNull ctxt) + override __.Equals y = match y with :? ProvidedExpr as y -> x.Equals y.Handle | _ -> false + override __.GetHashCode() = x.GetHashCode() - [] + [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif type ProvidedVar (x: Quotations.Var, ctxt) = member __.Type = x.Type |> ProvidedType.Create ctxt member __.Name = x.Name member __.IsMutable = x.IsMutable member __.Handle = x member __.Context = ctxt - static member Create ctxt t = match box t with null -> null | _ -> ProvidedVar (t, ctxt) - static member Fresh (nm, ty: ProvidedType) = ProvidedVar.Create ty.Context (new Quotations.Var(nm, ty.Handle)) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedVar.Create ctxt) + + static member CreateNonNull ctxt t = + ProvidedVar (t, ctxt) + + static member Fresh (nm, ty: ProvidedType) = + ProvidedVar.CreateNonNull ty.Context (new Quotations.Var(nm, ty.Handle)) + + static member CreateArray ctxt xs = + match box xs with + | null -> [| |] + | _ -> xs |> Array.map (ProvidedVar.CreateNonNull ctxt) + override __.Equals y = match y with :? ProvidedVar as y -> x.Equals y.Handle | _ -> false + override __.GetHashCode() = x.GetHashCode() @@ -789,7 +1007,7 @@ module internal ExtensionTyping = /// Detect a provided lambda expression let (|ProvidedLambdaExpr|_|) (x: ProvidedExpr) = match x.Handle with - | Quotations.Patterns.Lambda(v, body) -> Some (ProvidedVar.Create x.Context v, ProvidedExpr.Create x.Context body) + | Quotations.Patterns.Lambda(v, body) -> Some (ProvidedVar.CreateNonNull x.Context v, ProvidedExpr.Create x.Context body) | _ -> None /// Detect a provided try/finally expression @@ -801,7 +1019,7 @@ module internal ExtensionTyping = /// Detect a provided try/with expression let (|ProvidedTryWithExpr|_|) (x: ProvidedExpr) = match x.Handle with - | Quotations.Patterns.TryWith(b, v1, e1, v2, e2) -> Some (ProvidedExpr.Create x.Context b, ProvidedVar.Create x.Context v1, ProvidedExpr.Create x.Context e1, ProvidedVar.Create x.Context v2, ProvidedExpr.Create x.Context e2) + | Quotations.Patterns.TryWith(b, v1, e1, v2, e2) -> Some (ProvidedExpr.Create x.Context b, ProvidedVar.CreateNonNull x.Context v1, ProvidedExpr.Create x.Context e1, ProvidedVar.CreateNonNull x.Context v2, ProvidedExpr.Create x.Context e2) | _ -> None #if PROVIDED_ADDRESS_OF @@ -820,7 +1038,7 @@ module internal ExtensionTyping = /// Detect a provided 'let' expression let (|ProvidedLetExpr|_|) (x: ProvidedExpr) = match x.Handle with - | Quotations.Patterns.Let(v, e, b) -> Some (ProvidedVar.Create x.Context v, ProvidedExpr.Create x.Context e, ProvidedExpr.Create x.Context b) + | Quotations.Patterns.Let(v, e, b) -> Some (ProvidedVar.CreateNonNull x.Context v, ProvidedExpr.Create x.Context e, ProvidedExpr.Create x.Context b) | _ -> None @@ -828,7 +1046,7 @@ module internal ExtensionTyping = let (|ProvidedForIntegerRangeLoopExpr|_|) (x: ProvidedExpr) = match x.Handle with | Quotations.Patterns.ForIntegerRangeLoop (v, e1, e2, e3) -> - Some (ProvidedVar.Create x.Context v, + Some (ProvidedVar.CreateNonNull x.Context v, ProvidedExpr.Create x.Context e1, ProvidedExpr.Create x.Context e2, ProvidedExpr.Create x.Context e3) @@ -837,7 +1055,7 @@ module internal ExtensionTyping = /// Detect a provided 'set variable' expression let (|ProvidedVarSetExpr|_|) (x: ProvidedExpr) = match x.Handle with - | Quotations.Patterns.VarSet(v, e) -> Some (ProvidedVar.Create x.Context v, ProvidedExpr.Create x.Context e) + | Quotations.Patterns.VarSet(v, e) -> Some (ProvidedVar.CreateNonNull x.Context v, ProvidedExpr.Create x.Context e) | _ -> None /// Detect a provided 'IfThenElse' expression @@ -849,7 +1067,7 @@ module internal ExtensionTyping = /// Detect a provided 'Var' expression let (|ProvidedVarExpr|_|) (x: ProvidedExpr) = match x.Handle with - | Quotations.Patterns.Var v -> Some (ProvidedVar.Create x.Context v) + | Quotations.Patterns.Var v -> Some (ProvidedVar.CreateNonNull x.Context v) | _ -> None /// Get the provided invoker expression for a particular use of a method. @@ -874,7 +1092,7 @@ module internal ExtensionTyping = errorR(Error(FSComp.SR.etMustNotBeGeneric fullName, m)) if TryTypeMember(st, fullName, "IsArray", m, false, fun st->st.IsArray) |> unmarshal then errorR(Error(FSComp.SR.etMustNotBeAnArray fullName, m)) - TryTypeMemberNonNull(st, fullName, "GetInterfaces", m, [||], fun st -> st.GetInterfaces()) |> ignore + TryTypeMember(st, fullName, "GetInterfaces", m, [||], fun st -> st.GetInterfaces()) |> ignore /// Verify that a provided type has the expected name @@ -883,15 +1101,21 @@ module internal ExtensionTyping = if name <> expectedName then raise (TypeProviderError(FSComp.SR.etProvidedTypeHasUnexpectedName(expectedName, name), st.TypeProviderDesignation, m)) +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let namespaceName = TryTypeMember(st, name, "Namespace", m, "", fun st -> st.Namespace) |> unmarshal +#else + let namespaceName = TryTypeMember<_, string?>(st, name, "Namespace", m, "", fun st -> st.Namespace) |> unmarshal // TODO NULLNESS: why is this explicit instantiation needed? +#endif + let rec declaringTypes (st: Tainted) accu = match TryTypeMember(st, name, "DeclaringType", m, null, fun st -> st.DeclaringType) with - | Tainted.Null -> accu - | dt -> declaringTypes dt (CheckAndComputeProvidedNameProperty(m, dt, (fun dt -> dt.Name), "Name") :: accu) + | Tainted.Null -> accu + | Tainted.NonNull dt -> declaringTypes dt (CheckAndComputeProvidedNameProperty(m, dt, (fun dt -> dt.Name), "Name") :: accu) + let path = [| match namespaceName with | null -> () - | _ -> yield! namespaceName.Split([|'.'|]) + | NonNull namespaceName -> yield! namespaceName.Split([|'.'|]) yield! declaringTypes st [] |] if path <> expectedPath then @@ -904,7 +1128,11 @@ module internal ExtensionTyping = // Do all the calling into st up front with recovery let fullName, namespaceName, usedMembers = let name = CheckAndComputeProvidedNameProperty(m, st, (fun st -> st.Name), "Name") +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let namespaceName = TryTypeMember(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal +#else + let namespaceName = TryTypeMember<_, string?>(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal +#endif let fullName = TryTypeMemberNonNull(st, name, "FullName", m, FSComp.SR.invalidFullNameForProvidedType(), fun st -> st.FullName) |> unmarshal ValidateExpectedName m expectedPath expectedName st // Must be able to call (GetMethods|GetEvents|GetPropeties|GetNestedTypes|GetConstructors)(bindingFlags). @@ -929,7 +1157,7 @@ module internal ExtensionTyping = for mi in usedMembers do match mi with | Tainted.Null -> errorR(Error(FSComp.SR.etNullMember fullName, m)) - | _ -> + | Tainted.NonNull _ -> let memberName = TryMemberMember(mi, fullName, "Name", "Name", m, "invalid provided type member name", fun mi -> mi.Name) |> unmarshal if String.IsNullOrEmpty memberName then errorR(Error(FSComp.SR.etNullOrEmptyMemberName fullName, m)) @@ -940,7 +1168,7 @@ module internal ExtensionTyping = | Tainted.Null when (mi.OfType().IsSome) -> () | Tainted.Null -> errorR(Error(FSComp.SR.etNullMemberDeclaringType(fullName, memberName), m)) - | _ -> + | Tainted.NonNull miDeclaringType -> let miDeclaringTypeFullName = TryMemberMember(miDeclaringType, fullName, memberName, "FullName", m, "invalid declaring type full name", fun miDeclaringType -> miDeclaringType.FullName) |> unmarshal @@ -1006,7 +1234,11 @@ module internal ExtensionTyping = // Validate the Name, Namespace and FullName properties let name = CheckAndComputeProvidedNameProperty(m, st, (fun st -> st.Name), "Name") +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let _namespaceName = TryTypeMember(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal +#else + let _namespaceName = TryTypeMember<_, (string?)>(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal +#endif let _fullname = TryTypeMemberNonNull(st, name, "FullName", m, FSComp.SR.invalidFullNameForProvidedType(), fun st -> st.FullName) |> unmarshal ValidateExpectedName m expectedPath expectedName st @@ -1025,7 +1257,11 @@ module internal ExtensionTyping = /// Resolve a (non-nested) provided type given a full namespace name and a type name. /// May throw an exception which will be turned into an error message by one of the 'Try' function below. /// If resolution is successful the type is then validated. - let ResolveProvidedType (resolver: Tainted, m, moduleOrNamespace: string[], typeName) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let ResolveProvidedType (resolver: Tainted, m, moduleOrNamespace: string[], typeName) : Tainted = +#else + let ResolveProvidedType (resolver: Tainted, m, moduleOrNamespace: string[], typeName) : Tainted = +#endif let displayName = String.Join(".", moduleOrNamespace) // Try to find the type in the given provided namespace @@ -1038,8 +1274,8 @@ module internal ExtensionTyping = if displayName = providedNamespaceName then let resolvedType = providedNamespace.PApply((fun providedNamespace -> ProvidedType.CreateNoContext(providedNamespace.ResolveTypeName typeName)), range=m) match resolvedType with - | Tainted.Null -> None - | result -> + | Tainted.Null -> None + | Tainted.NonNull result -> ValidateProvidedTypeDefinition(m, result, moduleOrNamespace, typeName) Some result else @@ -1061,7 +1297,7 @@ module internal ExtensionTyping = try match ResolveProvidedType(resolver, m, moduleOrNamespace, typeName) with | Tainted.Null -> None - | ty -> Some ty + | Tainted.NonNull ty -> Some ty with e -> errorRecovery e m None @@ -1073,13 +1309,13 @@ module internal ExtensionTyping = | Tainted.Null -> match st.PUntaint((fun st -> st.Namespace), m) with | null -> typeName - | ns -> ns + "." + typeName + | NonNull ns -> ns + "." + typeName | _ -> typeName let rec encContrib (st: Tainted) = match st.PApply((fun st ->st.DeclaringType), m) with | Tainted.Null -> [] - | enc -> encContrib enc @ [ nameContrib enc ] + | Tainted.NonNull enc -> encContrib enc @ [ nameContrib enc ] encContrib st, nameContrib st @@ -1103,7 +1339,7 @@ module internal ExtensionTyping = match methBeforeArgs.PApplyWithProvider((fun (mb, provider) -> mb.ApplyStaticArgumentsForMethod(provider, mangledName, staticArgs)), range=m) with | Tainted.Null -> None - | methWithArguments -> + | Tainted.NonNull methWithArguments -> let actualName = methWithArguments.PUntaint((fun x -> x.Name), m) if actualName <> mangledName then error(Error(FSComp.SR.etProvidedAppliedMethodHadWrongName(methWithArguments.TypeProviderDesignation, mangledName, actualName), m)) @@ -1130,7 +1366,7 @@ module internal ExtensionTyping = match typeBeforeArguments.PApplyWithProvider((fun (typeBeforeArguments, provider) -> typeBeforeArguments.ApplyStaticArguments(provider, Array.ofList fullTypePathAfterArguments, staticArgs)), range=m) with | Tainted.Null -> None - | typeWithArguments -> + | Tainted.NonNull typeWithArguments -> let actualName = typeWithArguments.PUntaint((fun x -> x.Name), m) let checkTypeName() = let expectedTypeNameAfterArguments = fullTypePathAfterArguments.[fullTypePathAfterArguments.Length-1] @@ -1154,7 +1390,7 @@ module internal ExtensionTyping = match typeBeforeArguments with | Tainted.Null -> None - | _ -> + | Tainted.NonNull typeBeforeArguments -> // Take the static arguments (as strings, taken from the text in the reference we're relinking), // and convert them to objects of the appropriate type, based on the expected kind. let staticParameters = typeBeforeArguments.PApplyWithProvider((fun (typeBeforeArguments, resolver) -> typeBeforeArguments.GetStaticParameters resolver), range=range0) @@ -1208,27 +1444,43 @@ module internal ExtensionTyping = | None -> None /// Get the parts of a .NET namespace. Special rules: null means global, empty is not allowed. +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let GetPartsOfNamespaceRecover(namespaceName: string) = - if namespaceName=null then [] - elif namespaceName.Length = 0 then [""] - else splitNamespace namespaceName +#else + let GetPartsOfNamespaceRecover(namespaceName: string?) = +#endif + match namespaceName with + | null -> [] + | NonNull namespaceName -> + if namespaceName.Length = 0 then [""] + else splitNamespace (nonNull namespaceName) /// Get the parts of a .NET namespace. Special rules: null means global, empty is not allowed. - let GetProvidedNamespaceAsPath (m, resolver: Tainted, namespaceName: string) = - if namespaceName<>null && namespaceName.Length = 0 then - errorR(Error(FSComp.SR.etEmptyNamespaceNotAllowed(DisplayNameOfTypeProvider(resolver.TypeProvider, m)), m)) - - GetPartsOfNamespaceRecover namespaceName +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let GetProvidedNamespaceAsPath (m, resolver:Tainted, namespaceName:string) = +#else + let GetProvidedNamespaceAsPath (m, resolver:Tainted, namespaceName:string?) = +#endif + match namespaceName with + | null -> [] + | NonNull namespaceName -> + if namespaceName.Length = 0 then + errorR(Error(FSComp.SR.etEmptyNamespaceNotAllowed(DisplayNameOfTypeProvider(resolver.TypeProvider, m)), m)) + GetPartsOfNamespaceRecover namespaceName /// Get the parts of the name that encloses the .NET type including nested types. let GetFSharpPathToProvidedType (st: Tainted, m) = // Can't use st.Fullname because it may be like IEnumerable // We want [System;Collections;Generic] let namespaceParts = GetPartsOfNamespaceRecover(st.PUntaint((fun st -> st.Namespace), m)) +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let rec walkUpNestedClasses(st: Tainted, soFar) = +#else + let rec walkUpNestedClasses(st: Tainted, soFar) = +#endif match st with | Tainted.Null -> soFar - | st -> walkUpNestedClasses(st.PApply((fun st ->st.DeclaringType), m), soFar) @ [st.PUntaint((fun st -> st.Name), m)] + | Tainted.NonNull st -> walkUpNestedClasses(st.PApply((fun st ->st.DeclaringType), m), soFar) @ [st.PUntaint((fun st -> st.Name), m)] walkUpNestedClasses(st.PApply((fun st ->st.DeclaringType), m), namespaceParts) @@ -1243,7 +1495,7 @@ module internal ExtensionTyping = /// any type relocations or static linking for generated types. let GetOriginalILTypeRefOfProvidedType (st: Tainted, m) = - let aref = GetOriginalILAssemblyRefOfProvidedAssembly (st.PApply((fun st -> st.Assembly), m), m) + let aref = GetOriginalILAssemblyRefOfProvidedAssembly (st.PApply((fun st -> nonNull st.Assembly), m), m) // TODO: why is explicit instantiation needed here let scoperef = ILScopeRef.Assembly aref let enc, nm = ILPathToProvidedType (st, m) let tref = ILTypeRef.Create(scoperef, enc, nm) diff --git a/src/fsharp/ExtensionTyping.fsi b/src/fsharp/ExtensionTyping.fsi index d4b58be8cb0..2e6cba85d6f 100755 --- a/src/fsharp/ExtensionTyping.fsi +++ b/src/fsharp/ExtensionTyping.fsi @@ -86,18 +86,29 @@ module internal ExtensionTyping = /// Map the TyconRef objects, if any member RemapTyconRefs : (obj -> obj) -> ProvidedTypeContext - type [] + type [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedType = inherit ProvidedMemberInfo member IsSuppressRelocate : bool member IsErased : bool member IsGenericType : bool +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE member Namespace : string +#else + member Namespace : string? +#endif member FullName : string member IsArray : bool member GetInterfaces : unit -> ProvidedType[] member Assembly : ProvidedAssembly +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE member BaseType : ProvidedType +#else + member BaseType : ProvidedType? +#endif member GetNestedType : string -> ProvidedType member GetNestedTypes : unit -> ProvidedType[] member GetAllNestedTypes : unit -> ProvidedType[] @@ -137,27 +148,47 @@ module internal ExtensionTyping = interface IProvidedCustomAttributeProvider static member TaintedEquals : Tainted * Tainted -> bool - and [] + and +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif IProvidedCustomAttributeProvider = abstract GetHasTypeProviderEditorHideMethodsAttribute : provider:ITypeProvider -> bool +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE abstract GetDefinitionLocationAttribute : provider:ITypeProvider -> (string * int * int) option +#else + abstract GetDefinitionLocationAttribute : provider:ITypeProvider -> (string? * int * int) option +#endif abstract GetXmlDocAttributes : provider:ITypeProvider -> string[] abstract GetAttributeConstructorArgs: provider:ITypeProvider * attribName:string -> (obj option list * (string * obj option) list) option - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedAssembly = member GetName : unit -> System.Reflection.AssemblyName member FullName : string member GetManifestModuleContents : ITypeProvider -> byte[] member Handle : System.Reflection.Assembly - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedMemberInfo = member Name :string +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE member DeclaringType : ProvidedType +#else + member DeclaringType : ProvidedType? +#endif interface IProvidedCustomAttributeProvider - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedMethodBase = inherit ProvidedMemberInfo member IsGenericMethod : bool @@ -177,7 +208,10 @@ module internal ExtensionTyping = static member TaintedGetHashCode : Tainted -> int static member TaintedEquals : Tainted * Tainted -> bool - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedMethodInfo = inherit ProvidedMethodBase member ReturnType : ProvidedType @@ -185,9 +219,12 @@ module internal ExtensionTyping = member MetadataToken : int #endif - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedParameterInfo = - member Name :string + member Name : string member ParameterType : ProvidedType member IsIn : bool member IsOut : bool @@ -196,7 +233,10 @@ module internal ExtensionTyping = member HasDefaultValue : bool interface IProvidedCustomAttributeProvider - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedFieldInfo = inherit ProvidedMemberInfo member IsInitOnly : bool @@ -212,19 +252,39 @@ module internal ExtensionTyping = member IsPrivate : bool static member TaintedEquals : Tainted * Tainted -> bool - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedPropertyInfo = inherit ProvidedMemberInfo + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE member GetGetMethod : unit -> ProvidedMethodInfo + member GetSetMethod : unit -> ProvidedMethodInfo +#else + member GetGetMethod : unit -> ProvidedMethodInfo? + + member GetSetMethod : unit -> ProvidedMethodInfo? +#endif + member GetIndexParameters : unit -> ProvidedParameterInfo[] + member CanRead : bool + member CanWrite : bool + member PropertyType : ProvidedType + static member TaintedGetHashCode : Tainted -> int + static member TaintedEquals : Tainted * Tainted -> bool - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedEventInfo = inherit ProvidedMemberInfo member GetAddMethod : unit -> ProvidedMethodInfo @@ -233,17 +293,26 @@ module internal ExtensionTyping = static member TaintedGetHashCode : Tainted -> int static member TaintedEquals : Tainted * Tainted -> bool - and [] + and [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif ProvidedConstructorInfo = inherit ProvidedMethodBase - [] + [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif type ProvidedExpr = member Type : ProvidedType /// Convert the expression to a string for diagnostics member UnderlyingExpressionString : string - [] + [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + [] +#endif type ProvidedVar = member Type : ProvidedType member Name : string diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index c28343c01bc..498a619db5b 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1459,6 +1459,22 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3243,parsInvalidAnonRecdExpr,"Invalid anonymous record expression" 3244,parsInvalidAnonRecdType,"Invalid anonymous record type" 3245,tcCopyAndUpdateNeedsRecordType,"The input to a copy-and-update expression that creates an anonymous record must be either an anonymous record or a record" +3260,tcTypeDoesNotHaveAnyNull,"The type '%s' does not support a nullness qualitification." +#3261 reserved for ConstraintSolverNullnessWarningEquivWithTypes +#3262 reserved for ConstraintSolverNullnessWarningWithTypes +#3263 reserved for ConstraintSolverNullnessWarningWithType +#3264 reserved for ConstraintSolverNonNullnessWarningWithType +3265,tcLangFeatureNotEnabled50,"This language feature is not enabled, use /langversion:5.0 or greater to enable it" +3266,tcDefaultStructConstructorCallNulls,"Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable." +3267,chkValueWithDefaultValueMustHaveDefaultValueNulls,"Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable." +3268,csNullNotNullConstraintInconsistent,"The constraints 'null' and 'not null' are inconsistent" +3269,csStructNullConstraintInconsistent,"The constraints 'struct' and 'null' are inconsistent" +3270,csDelegateComparisonConstraintInconsistent,"The constraints 'delegate' and 'comparison' are inconsistent" +3271,tcNullnessCheckingNotEnabled,"The /checknulls language feature is not enabled" +csTypeHasNullAsTrueValue,"The type '%s' has 'null' as a true representation value but a constraint does not permit this" +csTypeHasNullAsExtraValue,"The type '%s' has 'null' as an extra value but a constraint does not permit this" 3300,chkInvalidFunctionParameterType,"The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL." 3301,chkInvalidFunctionReturnType,"The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL." useSdkRefs,"Use reference assemblies for .NET framework references when available (Enabled by default)." +optsCheckNulls,"Enable nullness declarations and checks" +optsLangVersion,"Specify the language version" diff --git a/src/fsharp/FSStrings.resx b/src/fsharp/FSStrings.resx index 05cd75cc669..ca37d5395f1 100644 --- a/src/fsharp/FSStrings.resx +++ b/src/fsharp/FSStrings.resx @@ -129,6 +129,18 @@ A type parameter is missing a constraint '{0}' + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + Nullness warning: The type '{0}' does not support nullness. + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + The unit of measure '{0}' does not match the unit of measure '{1}' diff --git a/src/fsharp/FSharp.Build/FSharp.Build.fsproj b/src/fsharp/FSharp.Build/FSharp.Build.fsproj index 0dad55058b0..47f627a73bf 100644 --- a/src/fsharp/FSharp.Build/FSharp.Build.fsproj +++ b/src/fsharp/FSharp.Build/FSharp.Build.fsproj @@ -9,6 +9,7 @@ FSharp.Build $(NoWarn);45;55;62;75;1204 true + $(OtherFlags) --checknulls $(OtherFlags) --maxerrors:20 --extraoptimizationloops:1 true @@ -33,7 +34,9 @@ - + + + diff --git a/src/fsharp/FSharp.Build/FSharpCommandLineBuilder.fs b/src/fsharp/FSharp.Build/FSharpCommandLineBuilder.fs index 0ea056694c6..c4f33c0e922 100644 --- a/src/fsharp/FSharp.Build/FSharpCommandLineBuilder.fs +++ b/src/fsharp/FSharp.Build/FSharpCommandLineBuilder.fs @@ -32,7 +32,7 @@ type FSharpCommandLineBuilder () = /// Return a full command line (with quoting for the cmd.exe shell) override x.ToString() = builder.ToString() - member x.AppendFileNamesIfNotNull(filenames:ITaskItem array, sep:string) = + member x.AppendFileNamesIfNotNull(filenames:ITaskItem[], sep:string) = builder.AppendFileNamesIfNotNull(filenames, sep) // do not update "args", not used for item in filenames do @@ -42,7 +42,7 @@ type FSharpCommandLineBuilder () = if s <> String.Empty then srcs <- tmp.ToString() :: srcs - member x.AppendSwitchIfNotNull(switch:string, values:string array, sep:string) = + member x.AppendSwitchesIfNotNull(switch:string, values:string[], sep:string) = builder.AppendSwitchIfNotNull(switch, values, sep) let tmp = new CommandLineBuilder() tmp.AppendSwitchUnquotedIfNotNull(switch, values, sep) @@ -50,7 +50,11 @@ type FSharpCommandLineBuilder () = if s <> String.Empty then args <- s :: args - member x.AppendSwitchIfNotNull(switch:string, value:string, ?metadataNames:string array) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + member x.AppendSwitchIfNotNull(switch:string, value:string, ?metadataNames:string[]) = +#else + member x.AppendSwitchIfNotNull(switch:string, value:string?, ?metadataNames:string[]) = +#endif let metadataNames = defaultArg metadataNames [||] builder.AppendSwitchIfNotNull(switch, value) let tmp = new CommandLineBuilder() @@ -65,7 +69,11 @@ type FSharpCommandLineBuilder () = if s <> String.Empty then args <- s :: args +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE member x.AppendSwitchUnquotedIfNotNull(switch:string, value:string) = +#else + member x.AppendSwitchUnquotedIfNotNull(switch:string, value:string?) = +#endif assert(switch = "") // we only call this method for "OtherFlags" // Unfortunately we still need to mimic what cmd.exe does, but only for "OtherFlags". let ParseCommandLineArgs(commandLine:string) = // returns list in reverse order diff --git a/src/fsharp/FSharp.Build/FSharpEmbedResXSource.fs b/src/fsharp/FSharp.Build/FSharpEmbedResXSource.fs index 80ab03249f0..fe0e3862b3e 100644 --- a/src/fsharp/FSharp.Build/FSharpEmbedResXSource.fs +++ b/src/fsharp/FSharp.Build/FSharpEmbedResXSource.fs @@ -13,8 +13,13 @@ open Microsoft.Build.Framework open Microsoft.Build.Utilities type FSharpEmbedResXSource() = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let mutable _buildEngine : IBuildEngine = null let mutable _hostObject : ITaskHost = null +#else + let mutable _buildEngine : IBuildEngine? = null + let mutable _hostObject : ITaskHost? = null +#endif let mutable _embeddedText : ITaskItem[] = [||] let mutable _generatedSource : ITaskItem[] = [||] let mutable _outputPath : string = "" @@ -27,9 +32,9 @@ namespace {0} open System.Reflection module internal {1} = - type private C (_dummy:System.Object) = class end + type private C (_dummy:System.Int32) = class end let mutable Culture = System.Globalization.CultureInfo.CurrentUICulture - let ResourceManager = new System.Resources.ResourceManager(""{2}"", C(null).GetType().GetTypeInfo().Assembly) + let ResourceManager = new System.Resources.ResourceManager(""{2}"", C(0).GetType().GetTypeInfo().Assembly) let GetString(name:System.String) : System.String = ResourceManager.GetString(name, Culture)" let boilerplateGetObject = " let GetObject(name:System.String) : System.Object = ResourceManager.GetObject(name, Culture)" diff --git a/src/fsharp/FSharp.Build/FSharpEmbedResourceText.fs b/src/fsharp/FSharp.Build/FSharpEmbedResourceText.fs index a40017edf5d..10a43cdc903 100644 --- a/src/fsharp/FSharp.Build/FSharpEmbedResourceText.fs +++ b/src/fsharp/FSharp.Build/FSharpEmbedResourceText.fs @@ -8,8 +8,13 @@ open Microsoft.Build.Framework open Microsoft.Build.Utilities type FSharpEmbedResourceText() = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let mutable _buildEngine : IBuildEngine = null let mutable _hostObject : ITaskHost = null +#else + let mutable _buildEngine : IBuildEngine? = null + let mutable _hostObject : ITaskHost? = null +#endif let mutable _embeddedText : ITaskItem[] = [||] let mutable _generatedSource : ITaskItem[] = [||] let mutable _generatedResx : ITaskItem[] = [||] diff --git a/src/fsharp/FSharp.Build/Fsc.fs b/src/fsharp/FSharp.Build/Fsc.fs index 19d8cd171fa..f06b03c81a1 100644 --- a/src/fsharp/FSharp.Build/Fsc.fs +++ b/src/fsharp/FSharp.Build/Fsc.fs @@ -11,6 +11,12 @@ open Microsoft.Build.Framework open Microsoft.Build.Utilities open Internal.Utilities +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE +[] +module Utils = + let inline (|NonNull|) x = match x with null -> raise (NullReferenceException()) | v -> v +#endif + //There are a lot of flags on fsc.exe. //For now, not all of them are represented in the "Fsc class" object model. //The goal is to have the most common/important flags available via the Fsc class, and the @@ -21,65 +27,95 @@ type public Fsc () as this = inherit ToolTask () - let mutable baseAddress : string = null let mutable capturedArguments : string list = [] // list of individual args, to pass to HostObject Compile() let mutable capturedFilenames : string list = [] // list of individual source filenames, to pass to HostObject Compile() - let mutable codePage : string = null let mutable commandLineArgs : ITaskItem list = [] let mutable debugSymbols = false - let mutable debugType : string = null let mutable defineConstants : ITaskItem[] = [||] let mutable delaySign : bool = false let mutable deterministic : bool = false - let mutable disabledWarnings : string = null - let mutable documentationFile : string = null - let mutable dotnetFscCompilerPath : string = null let mutable embedAllSources = false let mutable embeddedFiles : ITaskItem[] = [||] - let mutable generateInterfaceFile : string = null let mutable highEntropyVA : bool = false - let mutable keyFile : string = null let mutable noFramework = false let mutable optimize : bool = true - let mutable otherFlags : string = null - let mutable outputAssembly : string = null - let mutable pathMap : string = null - let mutable pdbFile : string = null - let mutable platform : string = null let mutable prefer32bit : bool = false - let mutable preferredUILang : string = null let mutable publicSign : bool = false let mutable provideCommandLineArgs : bool = false let mutable references : ITaskItem[] = [||] - let mutable referencePath : string = null let mutable resources : ITaskItem[] = [||] let mutable skipCompilerExecution : bool = false let mutable sources : ITaskItem[] = [||] - let mutable sourceLink : string = null - let mutable subsystemVersion : string = null let mutable tailcalls : bool = true - let mutable targetProfile : string = null - let mutable targetType : string = null let mutable toolExe : string = "fsc.exe" - let mutable toolPath : string = - let locationOfThisDll = - try Some(Path.GetDirectoryName(typeof.Assembly.Location)) - with _ -> None - match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(locationOfThisDll) with - | Some s -> s - | None -> "" let mutable treatWarningsAsErrors : bool = false let mutable useStandardResourceNames : bool = false + let mutable vserrors : bool = false + let mutable utf8output : bool = false + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let mutable baseAddress : string = null + let mutable codePage : string = null + let mutable debugType : string = null + let mutable disabledWarnings : string = null + let mutable documentationFile : string = null + let mutable dotnetFscCompilerPath : string = null + let mutable generateInterfaceFile : string = null + let mutable keyFile : string = null + let mutable otherFlags : string = null + let mutable outputAssembly : string = null + let mutable pathMap : string = null + let mutable pdbFile : string = null + let mutable platform : string = null + let mutable preferredUILang : string = null + let mutable referencePath : string = null + let mutable sourceLink : string = null + let mutable subsystemVersion : string = null + let mutable targetProfile : string = null + let mutable targetType : string = null let mutable warningsAsErrors : string = null let mutable warningsNotAsErrors : string = null let mutable versionFile : string = null let mutable warningLevel : string = null let mutable win32res : string = null let mutable win32manifest : string = null - let mutable vserrors : bool = false let mutable vslcid : string = null - let mutable utf8output : bool = false +#else + let mutable baseAddress : string? = null + let mutable codePage : string? = null + let mutable debugType : string? = null + let mutable disabledWarnings : string? = null + let mutable documentationFile : string? = null + let mutable dotnetFscCompilerPath : string? = null + let mutable generateInterfaceFile : string? = null + let mutable keyFile : string? = null + let mutable otherFlags : string? = null + let mutable outputAssembly : string? = null + let mutable pathMap : string? = null + let mutable pdbFile : string? = null + let mutable platform : string? = null + let mutable preferredUILang : string? = null + let mutable referencePath : string? = null + let mutable sourceLink : string? = null + let mutable subsystemVersion : string? = null + let mutable targetProfile : string? = null + let mutable targetType : string? = null + let mutable warningsAsErrors : string? = null + let mutable warningsNotAsErrors : string? = null + let mutable versionFile : string? = null + let mutable warningLevel : string? = null + let mutable win32res : string? = null + let mutable win32manifest : string? = null + let mutable vslcid : string? = null +#endif + let mutable toolPath : string = + let locationOfThisDll = + try Some(Path.GetDirectoryName(typeof.Assembly.Location)) + with _ -> None + match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(locationOfThisDll) with + | Some s -> s + | None -> "" // See bug 6483; this makes parallel build faster, and is fine to set unconditionally do this.YieldDuringToolExecution <- true @@ -94,7 +130,9 @@ type public Fsc () as this = builder.AppendSwitch("-g") // DebugType builder.AppendSwitchIfNotNull("--debug:", - if debugType = null then null else + match debugType with + | null -> null + | NonNull debugType -> match debugType.ToUpperInvariant() with | "NONE" -> null | "PORTABLE" -> "portable" @@ -104,9 +142,8 @@ type public Fsc () as this = | _ -> null) if embedAllSources then builder.AppendSwitch("--embed+") - if embeddedFiles <> null then - for item in embeddedFiles do - builder.AppendSwitchIfNotNull("--embed:", item.ItemSpec) + for item in embeddedFiles do + builder.AppendSwitchIfNotNull("--embed:", item.ItemSpec) builder.AppendSwitchIfNotNull("--sourcelink:", sourceLink) // NoFramework if noFramework then @@ -114,9 +151,8 @@ type public Fsc () as this = // BaseAddress builder.AppendSwitchIfNotNull("--baseaddress:", baseAddress) // DefineConstants - if defineConstants <> null then - for item in defineConstants do - builder.AppendSwitchIfNotNull("--define:", item.ItemSpec) + for item in defineConstants do + builder.AppendSwitchIfNotNull("--define:", item.ItemSpec) // DocumentationFile builder.AppendSwitchIfNotNull("--doc:", documentationFile) @@ -137,7 +173,12 @@ type public Fsc () as this = builder.AppendSwitchIfNotNull("--pdb:", pdbFile) // Platform builder.AppendSwitchIfNotNull("--platform:", - let ToUpperInvariant (s:string) = if s = null then null else s.ToUpperInvariant() +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let ToUpperInvariant (s:string) = +#else + let ToUpperInvariant (s:string?) = +#endif + match s with null -> null | NonNull s -> s.ToUpperInvariant() match ToUpperInvariant(platform), prefer32bit, ToUpperInvariant(targetType) with | "ANYCPU", true, "EXE" | "ANYCPU", true, "WINEXE" -> "anycpu32bitpreferred" @@ -145,29 +186,34 @@ type public Fsc () as this = | "X86", _, _ -> "x86" | "X64", _, _ -> "x64" | _ -> null) + // Resources - if resources <> null then - for item in resources do - match useStandardResourceNames with - | true -> builder.AppendSwitchIfNotNull("--resource:", item.ItemSpec, [|item.GetMetadata("LogicalName"); item.GetMetadata("Access")|]) - | false -> builder.AppendSwitchIfNotNull("--resource:", item.ItemSpec) + for item in resources do + match useStandardResourceNames with + | true -> builder.AppendSwitchIfNotNull("--resource:", item.ItemSpec, [|item.GetMetadata("LogicalName"); item.GetMetadata("Access")|]) + | false -> builder.AppendSwitchIfNotNull("--resource:", item.ItemSpec) // VersionFile builder.AppendSwitchIfNotNull("--versionfile:", versionFile) + // References - if references <> null then - for item in references do - builder.AppendSwitchIfNotNull("-r:", item.ItemSpec) + for item in references do + builder.AppendSwitchIfNotNull("-r:", item.ItemSpec) + // ReferencePath let referencePathArray = // create a array of strings match referencePath with | null -> null - | _ -> referencePath.Split([|';'; ','|], StringSplitOptions.RemoveEmptyEntries) + | NonNull referencePath -> + referencePath.Split([|';'; ','|], StringSplitOptions.RemoveEmptyEntries) + + builder.AppendSwitchesIfNotNull("--lib:", referencePathArray, ",") - builder.AppendSwitchIfNotNull("--lib:", referencePathArray, ",") // TargetType builder.AppendSwitchIfNotNull("--target:", - if targetType = null then null else + match targetType with + | null -> null + | NonNull targetType -> match targetType.ToUpperInvariant() with | "LIBRARY" -> "library" | "EXE" -> "exe" @@ -178,7 +224,8 @@ type public Fsc () as this = // NoWarn match disabledWarnings with | null -> () - | _ -> builder.AppendSwitchIfNotNull("--nowarn:", disabledWarnings.Split([|' '; ';'; ','; '\r'; '\n'|], StringSplitOptions.RemoveEmptyEntries), ",") + | NonNull disabledWarnings -> + builder.AppendSwitchesIfNotNull("--nowarn:", disabledWarnings.Split([|' '; ';'; ','; '\r'; '\n'|], StringSplitOptions.RemoveEmptyEntries), ",") // WarningLevel builder.AppendSwitchIfNotNull("--warn:", warningLevel) @@ -193,14 +240,15 @@ type public Fsc () as this = let warningsAsErrorsArray = match warningsAsErrors with | null -> [|"76"|] - | _ -> (warningsAsErrors + " 76 ").Split([|' '; ';'; ','|], StringSplitOptions.RemoveEmptyEntries) + | NonNull warningsAsErrors -> (warningsAsErrors + " 76 ").Split([|' '; ';'; ','|], StringSplitOptions.RemoveEmptyEntries) - builder.AppendSwitchIfNotNull("--warnaserror:", warningsAsErrorsArray, ",") + builder.AppendSwitchesIfNotNull("--warnaserror:", warningsAsErrorsArray, ",") // WarningsNotAsErrors match warningsNotAsErrors with | null -> () - | _ -> builder.AppendSwitchIfNotNull("--warnaserror-:", warningsNotAsErrors.Split([|' '; ';'; ','|], StringSplitOptions.RemoveEmptyEntries), ",") + | NonNull warningsNotAsErrors -> + builder.AppendSwitchesIfNotNull("--warnaserror-:", warningsNotAsErrors.Split([|' '; ';'; ','|], StringSplitOptions.RemoveEmptyEntries), ",") // Win32ResourceFile builder.AppendSwitchIfNotNull("--win32res:", win32res) @@ -236,9 +284,13 @@ type public Fsc () as this = builder.AppendSwitch("--nocopyfsharpcore") - match pathMap with - | null -> () - | _ -> builder.AppendSwitchIfNotNull("--pathmap:", pathMap.Split([|';'; ','|], StringSplitOptions.RemoveEmptyEntries), ",") + let pathMapArray = // create a array of strings + match pathMap with + | null -> null + | NonNull pathMap -> + pathMap.Split([|';'; ','|], StringSplitOptions.RemoveEmptyEntries) + + builder.AppendSwitchesIfNotNull("--pathmap:", pathMapArray, ",") if deterministic then builder.AppendSwitch("--deterministic+") @@ -555,7 +607,10 @@ type public Fsc () as this = override fsc.GenerateCommandLineCommands() = let builder = new FSharpCommandLineBuilder() - if not (String.IsNullOrEmpty(dotnetFscCompilerPath)) then builder.AppendSwitch(dotnetFscCompilerPath) + match dotnetFscCompilerPath with + | null | "" -> () + | NonNull dotnetFscCompilerPath -> + builder.AppendSwitch(dotnetFscCompilerPath) builder.ToString() override fsc.GenerateResponseFileCommands() = diff --git a/src/fsharp/FSharp.Build/Fsi.fs b/src/fsharp/FSharp.Build/Fsi.fs index 93d8fc66590..1be1a8ec9ee 100644 --- a/src/fsharp/FSharp.Build/Fsi.fs +++ b/src/fsharp/FSharp.Build/Fsi.fs @@ -11,6 +11,12 @@ open Microsoft.Build.Framework open Microsoft.Build.Utilities open Internal.Utilities +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE +[] +module UtilsFsi = + let inline (|NonNull|) x = match x with null -> raise (NullReferenceException()) | v -> v +#endif + //There are a lot of flags on fsi.exe. //For now, not all of them are represented in the "Fsi class" object model. //The goal is to have the most common/important flags available via the Fsi class, and the @@ -23,27 +29,19 @@ type public Fsi () as this = let mutable capturedArguments : string list = [] // list of individual args, to pass to HostObject Compile() let mutable capturedFilenames : string list = [] // list of individual source filenames, to pass to HostObject Compile() - let mutable codePage : string = null let mutable commandLineArgs : ITaskItem list = [] let mutable defineConstants : ITaskItem[] = [||] - let mutable disabledWarnings : string = null - let mutable dotnetFsiCompilerPath : string = null let mutable fsiExec = false let mutable noFramework = false let mutable optimize = true - let mutable otherFlags : string = null - let mutable preferredUILang = null let mutable provideCommandLineArgs = false let mutable references : ITaskItem[] = [||] - let mutable referencePath : string = null let mutable resources : ITaskItem[] = [||] let mutable skipCompilerExecution = false let mutable sources : ITaskItem[] = [||] let mutable loadSources : ITaskItem[] = [||] let mutable useSources : ITaskItem[] = [||] let mutable tailcalls : bool = true - let mutable targetProfile : string = null - let mutable targetType : string = null let mutable toolExe : string = "fsi.exe" let mutable toolPath : string = let locationOfThisDll = @@ -53,11 +51,35 @@ type public Fsi () as this = | Some s -> s | None -> "" let mutable treatWarningsAsErrors : bool = false + let mutable utf8output : bool = false + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let mutable codePage : string = null + let mutable disabledWarnings : string = null + let mutable dotnetFsiCompilerPath : string = null + let mutable otherFlags : string = null + let mutable preferredUILang : string = null + let mutable targetProfile : string = null + let mutable targetType : string = null + let mutable referencePath : string = null let mutable warningsAsErrors : string = null let mutable warningsNotAsErrors : string = null let mutable warningLevel : string = null let mutable vslcid : string = null - let mutable utf8output : bool = false +#else + let mutable codePage : string? = null + let mutable disabledWarnings : string? = null + let mutable dotnetFsiCompilerPath : string? = null + let mutable otherFlags : string? = null + let mutable preferredUILang : string? = null + let mutable targetProfile : string? = null + let mutable targetType : string? = null + let mutable referencePath : string? = null + let mutable warningsAsErrors : string? = null + let mutable warningsNotAsErrors : string? = null + let mutable warningLevel : string? = null + let mutable vslcid : string? = null +#endif // See bug 6483; this makes parallel build faster, and is fine to set unconditionally do this.YieldDuringToolExecution <- true @@ -69,9 +91,8 @@ type public Fsi () as this = if noFramework then builder.AppendSwitch("--noframework") - if defineConstants <> null then - for item in defineConstants do - builder.AppendSwitchIfNotNull("--define:", item.ItemSpec) + for item in defineConstants do + builder.AppendSwitchIfNotNull("--define:", item.ItemSpec) if optimize then builder.AppendSwitch("--optimize+") else builder.AppendSwitch("--optimize-") @@ -79,19 +100,18 @@ type public Fsi () as this = if not tailcalls then builder.AppendSwitch("--tailcalls-") - if references <> null then - for item in references do - builder.AppendSwitchIfNotNull("-r:", item.ItemSpec) + for item in references do + builder.AppendSwitchIfNotNull("-r:", item.ItemSpec) let referencePathArray = // create a array of strings match referencePath with | null -> null - | _ -> referencePath.Split([|';'; ','|], StringSplitOptions.RemoveEmptyEntries) + | NonNull referencePath -> referencePath.Split([|';'; ','|], StringSplitOptions.RemoveEmptyEntries) // NoWarn match disabledWarnings with | null -> () - | _ -> builder.AppendSwitchIfNotNull("--nowarn:", disabledWarnings.Split([|' '; ';'; ','; '\r'; '\n'|], StringSplitOptions.RemoveEmptyEntries), ",") + | NonNull disabledWarnings -> builder.AppendSwitchesIfNotNull("--nowarn:", disabledWarnings.Split([|' '; ';'; ','; '\r'; '\n'|], StringSplitOptions.RemoveEmptyEntries), ",") builder.AppendSwitchIfNotNull("--warn:", warningLevel) @@ -101,13 +121,13 @@ type public Fsi () as this = let warningsAsErrorsArray = match warningsAsErrors with | null -> [| "76" |] - | _ -> (warningsAsErrors + " 76 ").Split([|' '; ';'; ','|], StringSplitOptions.RemoveEmptyEntries) + | NonNull warningsAsErrors -> (warningsAsErrors + " 76 ").Split([|' '; ';'; ','|], StringSplitOptions.RemoveEmptyEntries) - builder.AppendSwitchIfNotNull("--warnaserror:", warningsAsErrorsArray, ",") + builder.AppendSwitchesIfNotNull("--warnaserror:", warningsAsErrorsArray, ",") match warningsNotAsErrors with | null -> () - | _ -> builder.AppendSwitchIfNotNull("--warnaserror-:", warningsNotAsErrors.Split([|' '; ';'; ','|], StringSplitOptions.RemoveEmptyEntries), ",") + | NonNull warningsNotAsErrors -> builder.AppendSwitchesIfNotNull("--warnaserror-:", warningsNotAsErrors.Split([|' '; ';'; ','|], StringSplitOptions.RemoveEmptyEntries), ",") builder.AppendSwitchIfNotNull("--LCID:", vslcid) @@ -120,13 +140,11 @@ type public Fsi () as this = builder.AppendSwitchIfNotNull("--targetprofile:", targetProfile) - if loadSources <> null then - for item in loadSources do - builder.AppendSwitchIfNotNull("--load:", item.ItemSpec) + for item in loadSources do + builder.AppendSwitchIfNotNull("--load:", item.ItemSpec) - if useSources <> null then - for item in useSources do - builder.AppendSwitchIfNotNull("--use:", item.ItemSpec) + for item in useSources do + builder.AppendSwitchIfNotNull("--use:", item.ItemSpec) // OtherFlags - must be second-to-last builder.AppendSwitchUnquotedIfNotNull("", otherFlags) @@ -260,15 +278,20 @@ type public Fsi () as this = // ToolTask methods override fsi.ToolName = "fsi.exe" + override fsi.StandardErrorEncoding = if utf8output then System.Text.Encoding.UTF8 else base.StandardErrorEncoding + override fsi.StandardOutputEncoding = if utf8output then System.Text.Encoding.UTF8 else base.StandardOutputEncoding + override fsi.GenerateFullPathToTool() = if toolPath = "" then raise (new System.InvalidOperationException(FSBuild.SR.toolpathUnknown())) System.IO.Path.Combine(toolPath, fsi.ToolExe) + override fsi.LogToolCommand (message:string) = fsi.Log.LogMessageFromText(message, MessageImportance.Normal) |>ignore member internal fsi.InternalGenerateFullPathToTool() = fsi.GenerateFullPathToTool() // expose for unit testing + member internal fsi.BaseExecuteTool(pathToTool, responseFileCommands, commandLineCommands) = // F# does not allow protected members to be captured by lambdas, this is the standard workaround base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands) @@ -311,7 +334,10 @@ type public Fsi () as this = override fsi.GenerateCommandLineCommands() = let builder = new FSharpCommandLineBuilder() - if not (String.IsNullOrEmpty(dotnetFsiCompilerPath)) then builder.AppendSwitch(dotnetFsiCompilerPath) + match dotnetFsiCompilerPath with + | null | "" -> () + | NonNull dotnetFsiCompilerPath -> + builder.AppendSwitch(dotnetFsiCompilerPath) builder.ToString() override fsi.GenerateResponseFileCommands() = diff --git a/src/fsharp/FSharp.Build/WriteCodeFragment.fs b/src/fsharp/FSharp.Build/WriteCodeFragment.fs index b878dadaba0..10fde48de20 100644 --- a/src/fsharp/FSharp.Build/WriteCodeFragment.fs +++ b/src/fsharp/FSharp.Build/WriteCodeFragment.fs @@ -12,13 +12,26 @@ open System.Text open Microsoft.Build.Framework open Microsoft.Build.Utilities +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE +[] +module UtilsWriteCodeFragment = + let inline (|NonNull|) x = match x with null -> raise (NullReferenceException()) | v -> v +#endif + type WriteCodeFragment() = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let mutable _buildEngine : IBuildEngine = null let mutable _hostObject : ITaskHost = null - let mutable _language : string = "" - let mutable _assemblyAttributes : ITaskItem[] = [||] let mutable _outputDirectory : ITaskItem = null let mutable _outputFile : ITaskItem = null +#else + let mutable _buildEngine : IBuildEngine? = null + let mutable _hostObject : ITaskHost? = null + let mutable _outputDirectory : ITaskItem? = null + let mutable _outputFile : ITaskItem? = null +#endif + let mutable _language : string = "" + let mutable _assemblyAttributes : ITaskItem[] = [||] static let escapeString (str:string) = let sb = str.ToCharArray() |> Seq.fold (fun (sb:StringBuilder) (c:char) -> @@ -109,7 +122,10 @@ type WriteCodeFragment() = member this.Execute() = try - if isNull _outputFile && isNull _outputDirectory then failwith "Output location must be specified" + match _outputFile with + | null -> failwith "Output location must be specified" + | NonNull outputFile -> + let boilerplate = match _language.ToLowerInvariant() with | "f#" -> "// \n// Generated by the FSharp WriteCodeFragment class.\n// \nnamespace FSharp\n\nopen System\nopen System.Reflection\n" @@ -121,16 +137,27 @@ type WriteCodeFragment() = let code = Array.fold (fun (sb:StringBuilder) (item:ITaskItem) -> sb.AppendLine(WriteCodeFragment.GenerateAttribute (item, _language.ToLowerInvariant()))) sb _assemblyAttributes if _language.ToLowerInvariant() = "f#" then code.AppendLine("do()") |> ignore + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let fileName = _outputFile.ItemSpec let outputFileItem = if not (isNull _outputFile) && not (isNull _outputDirectory) && not (Path.IsPathRooted(fileName)) then TaskItem(Path.Combine(_outputDirectory.ItemSpec, fileName)) :> ITaskItem - elif isNull _outputFile then - let tempFile = Path.Combine(Path.GetTempPath(), sprintf "tmp%s.fs" (Guid.NewGuid().ToString("N"))) - TaskItem(tempFile) :> ITaskItem else _outputFile +#else + let fileName = outputFile.ItemSpec + + let outputFileItem = + match _outputDirectory with + | null -> outputFile + | NonNull outputDirectory -> + if Path.IsPathRooted(fileName) then + outputFile + else + TaskItem(Path.Combine(outputDirectory.ItemSpec, fileName)) :> ITaskItem +#endif let codeText = code.ToString() File.WriteAllText(fileName, codeText) diff --git a/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj b/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj index 6307f17baf3..51c4017d67d 100644 --- a/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj +++ b/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj @@ -28,7 +28,9 @@ - + + + diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index b770a3cb615..133cfaab815 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -9,6 +9,7 @@ FSharp.Compiler.Private $(NoWarn);45;55;62;75;1204 true + $(OtherFlags) --checknulls $(DefineConstants);COMPILER $(DefineConstants);MSBUILD_AT_LEAST_15 $(OtherFlags) --warnon:1182 --maxerrors:20 --extraoptimizationloops:1 @@ -688,7 +689,9 @@ - + + + diff --git a/src/fsharp/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj b/src/fsharp/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj index 75a7353bb96..e2e28bd0945 100644 --- a/src/fsharp/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj +++ b/src/fsharp/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj @@ -7,6 +7,7 @@ net472 FSharp.Compiler.Server.Shared true + $(OtherFlags) --checknulls @@ -21,7 +22,9 @@ - + + + diff --git a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuget.csproj b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuget.csproj index fd2d5162c75..e304369556b 100644 --- a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuget.csproj +++ b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuget.csproj @@ -10,7 +10,7 @@ - + false diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index 440850ed55c..7743ea13b34 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -8,8 +8,10 @@ netstandard1.6 $(NoWarn);45;55;62;75;1204 true + $(OtherFlags) --warnon:3218 + $(OtherFlags) --compiling-fslib-40 + $(DefineConstants);FSHARP_CORE - BUILDING_WITH_LKG;$(DefineConstants) $(OtherFlags) --warnon:1182 --compiling-fslib --compiling-fslib-40 --maxerrors:20 --extraoptimizationloops:1 true true @@ -232,7 +234,7 @@ - + diff --git a/src/fsharp/FSharp.Core/array.fs b/src/fsharp/FSharp.Core/array.fs index 8d7ce38869d..03436762dfa 100644 --- a/src/fsharp/FSharp.Core/array.fs +++ b/src/fsharp/FSharp.Core/array.fs @@ -571,12 +571,16 @@ namespace Microsoft.FSharp.Collections maskArray.[maskIdx] <- mask count +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let private createMask<'a> (f: 'a->bool) (src: array<'a>) (maskArrayOut: byref>) (leftoverMaskOut: byref) = +#else + let private createMask<'a> (f: 'a->bool) (src: array<'a>) (maskArrayOut: byref?>) (leftoverMaskOut: byref) = +#endif let maskArrayLength = src.Length / 0x20 // null when there are less than 32 items in src array. let maskArray = - if maskArrayLength = 0 then Unchecked.defaultof<_> + if maskArrayLength = 0 then null else Microsoft.FSharp.Primitives.Basics.Array.zeroCreateUnchecked maskArrayLength let mutable count = @@ -657,7 +661,11 @@ namespace Microsoft.FSharp.Collections dstIdx +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let private filterViaMask (maskArray: array) (leftoverMask: uint32) (count: int) (src: array<_>) = +#else + let private filterViaMask (maskArray: array?) (leftoverMask: uint32) (count: int) (src: array<_>) = +#endif let dst = Microsoft.FSharp.Primitives.Basics.Array.zeroCreateUnchecked count let mutable dstIdx = 0 @@ -676,10 +684,10 @@ namespace Microsoft.FSharp.Collections dst let filter f (src: array<_>) = - let mutable maskArray = Unchecked.defaultof<_> - let mutable leftOverMask = Unchecked.defaultof<_> + let mutable maskArray = null + let mutable leftOverMask = 0u match createMask f src &maskArray &leftOverMask with - | 0 -> empty + | 0 -> empty | count -> filterViaMask maskArray leftOverMask count src [] diff --git a/src/fsharp/FSharp.Core/async.fs b/src/fsharp/FSharp.Core/async.fs index 1f20f7c8110..37649d18013 100644 --- a/src/fsharp/FSharp.Core/async.fs +++ b/src/fsharp/FSharp.Core/async.fs @@ -1759,7 +1759,7 @@ namespace Microsoft.FSharp.Control event.RemoveHandler handle if args.Cancelled then ccont (new OperationCanceledException()) - elif isNotNull args.Error then + elif isNonNull args.Error then econt args.Error else cont (result args) diff --git a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs index dd8d087345e..b538c8f9f90 100644 --- a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs +++ b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs @@ -369,7 +369,7 @@ namespace Microsoft.FSharp.Core.CompilerServices type ITypeProvider = inherit System.IDisposable abstract GetNamespaces : unit -> IProvidedNamespace[] - abstract GetStaticParameters : typeWithoutArguments:Type -> ParameterInfo[] + abstract GetStaticParameters : typeWithoutArguments:Type -> ParameterInfo[] abstract ApplyStaticArguments : typeWithoutArguments:Type * typePathWithArguments:string[] * staticArguments:obj[] -> Type abstract GetInvokerExpression : syntheticMethodBase:MethodBase * parameters:Microsoft.FSharp.Quotations.Expr[] -> Microsoft.FSharp.Quotations.Expr diff --git a/src/fsharp/FSharp.Core/local.fs b/src/fsharp/FSharp.Core/local.fs index 9fb452907f4..090537ca25e 100644 --- a/src/fsharp/FSharp.Core/local.fs +++ b/src/fsharp/FSharp.Core/local.fs @@ -1095,7 +1095,11 @@ module internal Array = if len < 2 then () else Array.Sort<_>(array, fastComparerForArraySort()) +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let stableSortWithKeysAndComparer (cFast:IComparer<'Key>) (c:IComparer<'Key>) (array:array<'T>) (keys:array<'Key>) = +#else + let stableSortWithKeysAndComparer (cFast:IComparer<'Key>?) (c:IComparer<'Key>) (array:array<'T>) (keys:array<'Key>) = +#endif // 'places' is an array or integers storing the permutation performed by the sort let places = zeroCreateUnchecked array.Length for i = 0 to array.Length - 1 do diff --git a/src/fsharp/FSharp.Core/mailbox.fs b/src/fsharp/FSharp.Core/mailbox.fs index b5c91fe49ee..1b54fefb3a1 100644 --- a/src/fsharp/FSharp.Core/mailbox.fs +++ b/src/fsharp/FSharp.Core/mailbox.fs @@ -353,7 +353,7 @@ namespace Microsoft.FSharp.Control interface System.IDisposable with member __.Dispose() = - if isNotNull pulse then (pulse :> IDisposable).Dispose() + if isNonNull pulse then (pulse :> IDisposable).Dispose() #if DEBUG member x.UnsafeContents = diff --git a/src/fsharp/FSharp.Core/option.fs b/src/fsharp/FSharp.Core/option.fs index 552d1c9231f..1c8907810b5 100644 --- a/src/fsharp/FSharp.Core/option.fs +++ b/src/fsharp/FSharp.Core/option.fs @@ -85,11 +85,21 @@ module Option = [] let ofNullable (value:System.Nullable<'T>) = if value.HasValue then Some value.Value else None +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE [] let ofObj value = match value with null -> None | _ -> Some value [] let toObj value = match value with None -> null | Some x -> x +#else + [] + let ofObj (value: 'T?) : 'T option when 'T: not struct and 'T : not null = + match value with null -> None | _ -> Some value + + [] + let toObj (value: 'T option) : 'T? when 'T: not struct (* and 'T : not null *) = + match value with None -> null | Some x -> x +#endif module ValueOption = @@ -171,8 +181,18 @@ module ValueOption = [] let ofNullable (value:System.Nullable<'T>) = if value.HasValue then ValueSome value.Value else ValueNone +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE [] let ofObj value = match value with null -> ValueNone | _ -> ValueSome value [] let toObj value = match value with ValueNone -> null | ValueSome x -> x +#else + [] + let ofObj (value: 'T?) : 'T voption when 'T: not struct and 'T : not null = + match value with null -> ValueNone | _ -> ValueSome value + + [] + let toObj (value : 'T voption) : 'T? when 'T: not struct (* and 'T : not null *) = + match value with ValueNone -> null | ValueSome x -> x +#endif \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/option.fsi b/src/fsharp/FSharp.Core/option.fsi index 739484ae8cf..2e5a4ed2e3f 100644 --- a/src/fsharp/FSharp.Core/option.fsi +++ b/src/fsharp/FSharp.Core/option.fsi @@ -190,13 +190,23 @@ module Option = /// The input value. /// The result option. [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE val ofObj: value: 'T -> 'T option when 'T : null +#else + // TODO NULLNESS: assess this change - is it a breaking change? + val ofObj: value: 'T? -> 'T option when 'T : not struct and 'T : not null +#endif /// Convert an option to a potentially null value. /// The input value. /// The result value, which is null if the input was None. [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE val toObj: value: 'T option -> 'T when 'T : null +#else + // TODO NULLNESS: assess this change - is it a breaking change? + val toObj: value: 'T option -> 'T? when 'T : not struct (* and 'T : not null *) +#endif /// Basic operations on value options. module ValueOption = @@ -379,10 +389,20 @@ module ValueOption = /// The input value. /// The result value option. [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE val ofObj: value: 'T -> 'T voption when 'T : null +#else + // TODO NULLNESS: assess this change - is it a breaking change? + val ofObj: value: 'T? -> 'T voption when 'T : not struct and 'T : not null +#endif /// Convert an option to a potentially null value. /// The input value. /// The result value, which is null if the input was ValueNone. [] +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE val toObj: value: 'T voption -> 'T when 'T : null +#else + // TODO NULLNESS: assess this change - is it a breaking change? + val toObj: value: 'T voption -> 'T? when 'T : not struct (* and 'T : not null *) +#endif diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 2e91dec124f..50770889cac 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -9,6 +9,8 @@ #nowarn "69" // Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration... #nowarn "77" // Member constraints with the name 'Exp' are given special status by the F# compiler... #nowarn "3218" // mismatch of parameter name for 'fst' and 'snd' +#nowarn "3244" // no nullness checking +#nowarn "3245" // no nullness checking namespace Microsoft.FSharp.Core @@ -821,7 +823,8 @@ namespace Microsoft.FSharp.Core /// Implements generic comparison between two objects. This corresponds to the pseudo-code in the F# /// specification. The treatment of NaNs is governed by "comp". - let rec GenericCompare (comp:GenericComparer) (xobj:obj,yobj:obj) = + let rec GenericCompare (comp:GenericComparer) (xobj:obj, yobj:obj) = + (*if objEq xobj yobj then 0 else *) match xobj,yobj with | null,null -> 0 | null,_ -> -1 @@ -2404,9 +2407,7 @@ namespace Microsoft.FSharp.Core parse p 0UL let inline removeUnderscores (s:string) = - match s with - | null -> null - | s -> s.Replace("_", "") + s.Replace("_", "") let ParseUInt32 (s:string) = if System.Object.ReferenceEquals(s,null) then @@ -3378,17 +3379,67 @@ namespace Microsoft.FSharp.Core | _ -> None [] - let inline isNull (value : 'T) = - match value with + let inline isNull (value : 'T when 'T : null) = + match box value with | null -> true | _ -> false - [] - let inline internal isNotNull (value : 'T) = + [] + let inline internal isNonNull (value : 'T) = match value with | null -> false | _ -> true +#if !BUILDING_WITH_LKG && !BUILD_FROM_SOURCE + + [] + let inline isNullV (value : Nullable<'T>) = not value.HasValue + + [] + let inline nonNull (value : 'T? when 'T : not struct and 'T : not null) = + match box value with + | null -> raise (System.NullReferenceException()) + | _ -> (# "" value : 'T #) + + [] + let inline nonNullV (value : Nullable<'T>) = + if value.HasValue then + value.Value + else + raise (System.NullReferenceException()) + + [] + let inline (|Null|NotNull|) (value : 'T? when 'T : not null) = + match value with + | null -> Null () + | _ -> NotNull (# "" value : 'T #) + + [] + let inline (|NullV|NotNullV|) (value : Nullable<'T>) = + if value.HasValue then NotNullV value.Value + else NullV () + + [] + let inline (|NonNull|) (value : 'T? when 'T : not null) = + match box value with + | null -> raise (System.NullReferenceException()) + | _ -> (# "" value : 'T #) + + [] + let inline (|NonNullV|) (value : Nullable<'T>) = + if value.HasValue then value.Value + else raise (System.NullReferenceException()) + + [] + let inline withNull (value : 'T when 'T : not struct) = (# "" value : 'T? #) + + [] + let inline withNullV (value : 'T) : Nullable<'T> = Nullable<'T>(value) + + [] + let inline nullV<'T when 'T : struct and 'T : (new : unit -> 'T) and 'T :> ValueType> = Nullable<'T>() +#endif + [] let inline raise (exn: exn) = (# "throw" exn : 'T #) @@ -3430,6 +3481,14 @@ namespace Microsoft.FSharp.Core let inline nullArg (argumentName:string) = raise (new System.ArgumentNullException(argumentName)) +#if !BUILDING_WITH_LKG && !BUILD_FROM_SOURCE + [] + let inline nullArgCheck (argumentName:string) (value: 'T? when 'T : not struct and 'T : not null) = + match value with + | null -> raise (new System.ArgumentNullException(argumentName)) + | _ -> (# "" value : 'T #) +#endif + [] [] let inline invalidOp message = raise (System.InvalidOperationException(message)) @@ -3480,10 +3539,26 @@ namespace Microsoft.FSharp.Core let (^) (s1: string) (s2: string) = System.String.Concat(s1, s2) [] - let defaultArg arg defaultValue = match arg with None -> defaultValue | Some v -> v + let inline defaultArg arg defaultValue = + match arg with None -> defaultValue | Some v -> v [] - let defaultValueArg arg defaultValue = match arg with ValueNone -> defaultValue | ValueSome v -> v + let inline defaultValueArg arg defaultValue = + match arg with ValueNone -> defaultValue | ValueSome v -> v + + [] + let inline defaultIfNone defaultValue arg = + match arg with None -> defaultValue | Some v -> v + +#if !BUILDING_WITH_LKG && !BUILD_FROM_SOURCE + [] + let inline defaultIfNull defaultValue (arg: 'T? when 'T : not struct and 'T : not null) = + match arg with null -> defaultValue | _ -> (# "" arg : 'T #) + + [] + let inline defaultIfNullV defaultValue (arg: Nullable<'T>) = + if arg.HasValue then arg.Value else defaultValue +#endif [] let inline (~-) (n: ^T) : ^T = @@ -3729,9 +3804,16 @@ namespace Microsoft.FSharp.Core let inline ParseUInt16 (s:string) = (# "conv.ovf.u2" (ParseUInt32 s) : uint16 #) let inline ParseIntPtr (s:string) = (# "conv.ovf.i" (ParseInt64 s) : nativeint #) let inline ParseUIntPtr (s:string) = (# "conv.ovf.u" (ParseInt64 s) : unativeint #) - let inline ParseDouble (s:string) = Double.Parse(removeUnderscores s,NumberStyles.Float, CultureInfo.InvariantCulture) - let inline ParseSingle (s:string) = Single.Parse(removeUnderscores s,NumberStyles.Float, CultureInfo.InvariantCulture) - + + let inline ParseDouble (s:string) = + if System.Object.ReferenceEquals(s,null) then + raise( new System.ArgumentNullException("s") ) + Double.Parse(removeUnderscores s,NumberStyles.Float, CultureInfo.InvariantCulture) + + let inline ParseSingle (s:string) = + if System.Object.ReferenceEquals(s,null) then + raise( new System.ArgumentNullException("s") ) + Single.Parse(removeUnderscores s,NumberStyles.Float, CultureInfo.InvariantCulture) [] [] diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index c977af45417..d1736607a65 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -952,7 +952,11 @@ namespace Microsoft.FSharp.Core val inline FastGenericComparer<'T> : System.Collections.Generic.IComparer<'T> when 'T : comparison /// Make an F# comparer object for the given type, where it can be null if System.Collections.Generic.Comparer<'T>.Default +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE val internal FastGenericComparerCanBeNull<'T> : System.Collections.Generic.IComparer<'T> when 'T : comparison +#else + val internal FastGenericComparerCanBeNull<'T> : System.Collections.Generic.IComparer<'T>? when 'T : comparison +#endif /// Make an F# hash/equality object for the given type val inline FastGenericEqualityComparer<'T> : System.Collections.Generic.IEqualityComparer<'T> when 'T : equality @@ -2145,19 +2149,42 @@ namespace Microsoft.FSharp.Core /// The function result. val inline (<|||): func:('T1 -> 'T2 -> 'T3 -> 'U) -> arg1:'T1 * arg2:'T2 * arg3:'T3 -> 'U + /// Used to specify a default value for an optional argument in the implementation of a function + /// The default value of the argument. + /// An option representing the argument. + /// The argument value. If it is None, the defaultValue is returned. + [] + val inline defaultIfNone : defaultValue:'T -> arg:'T option -> 'T + +#if !BUILDING_WITH_LKG && !BUILD_FROM_SOURCE + /// Used to specify a default value for a nullable reference argument in the implementation of a function + /// The default value of the argument. + /// A nullable value representing the argument. + /// The argument value. If it is null, the defaultValue is returned. + [] + val inline defaultIfNull : defaultValue:'T -> arg:'T? -> 'T when 'T : not struct and 'T : not null + + /// Used to specify a default value for an nullable value argument in the implementation of a function + /// The default value of the argument. + /// A nullable value representing the argument. + /// The argument value. If it is null, the defaultValue is returned. + [] + val inline defaultIfNullV : defaultValue:'T -> arg:Nullable<'T> -> 'T +#endif + /// Used to specify a default value for an optional argument in the implementation of a function /// An option representing the argument. /// The default value of the argument. /// The argument value. If it is None, the defaultValue is returned. [] - val defaultArg : arg:'T option -> defaultValue:'T -> 'T + val inline defaultArg : arg:'T option -> defaultValue:'T -> 'T /// Used to specify a default value for an optional argument in the implementation of a function /// A value option representing the argument. /// The default value of the argument. /// The argument value. If it is None, the defaultValue is returned. [] - val defaultValueArg : arg:'T voption -> defaultValue:'T -> 'T + val inline defaultValueArg : arg:'T voption -> defaultValue:'T -> 'T /// Concatenate two strings. The operator '+' may also be used. [] @@ -2253,17 +2280,80 @@ namespace Microsoft.FSharp.Core /// The value to check. /// True when value is null, false otherwise. [] - val inline isNull : value:'T -> bool when 'T : null + val inline isNull : value: 'T -> bool when 'T : null +#if !BUILDING_WITH_LKG && !BUILD_FROM_SOURCE + /// Determines whether the given value is null. + /// The value to check. + /// A choice indicating whether the value is null or not-null. + [] + val inline (|Null|NotNull|) : value: 'T? -> Choice when 'T : not null + + /// Determines whether the given value is null. + /// The value to check. + /// A choice indicating whether the value is null or not-null. + [] + val inline (|NullV|NotNullV|) : value: Nullable<'T> -> Choice + + /// When used in a pattern checks the given value is not null. + /// The value to check. + /// The non-null value. + [] + val inline (|NonNull|) : value: 'T? -> 'T when 'T : not null + + /// When used in a pattern checks the given value is not null. + /// The value to check. + /// The non-null value. + [] + val inline (|NonNullV|) : value: Nullable<'T> -> 'T + + /// Determines whether the given value is null. + /// The value to check. + /// True when value is null, false otherwise. + [] + val inline isNullV : value:Nullable<'T> -> bool +#endif + /// Determines whether the given value is not null. /// The value to check. /// True when value is not null, false otherwise. - [] - val inline internal isNotNull : value:'T -> bool when 'T : null + [] + val inline internal isNonNull : value:'T -> bool when 'T : null + +#if !BUILDING_WITH_LKG && !BUILD_FROM_SOURCE + /// Get the null value for a value type. + /// The null value for a value type. + [] + val inline nullV<'T when 'T : struct and 'T : (new : unit -> 'T) and 'T :> ValueType> : Nullable<'T> + + /// Asserts that the value is non-null. + /// The value to check. + /// True when value is null, false otherwise. + [] + val inline nonNull : value: 'T? -> 'T when 'T : not struct and 'T : not null + + /// Asserts that the value is non-null. + /// The value to check. + /// True when value is null, false otherwise. + [] + val inline nonNullV : value:Nullable<'T> -> 'T + + /// Asserts that the value is non-null. + /// The value to check. + /// True when value is null, false otherwise. + [] + val inline withNull : value:'T -> 'T? when 'T : not struct (* and 'T : not null *) + + /// Asserts that the value is non-null. + /// The value to check. + /// True when value is null, false otherwise. + [] + val inline withNullV : value:'T -> Nullable<'T> +#endif /// Throw a System.Exception exception. /// The exception message. - /// The result value. + /// Never returns. [] val inline failwith : message:string -> 'T @@ -2271,16 +2361,24 @@ namespace Microsoft.FSharp.Core /// the given argument name and message. /// The argument name. /// The exception message. - /// The result value. + /// Never returns. [] val inline invalidArg : argumentName:string -> message:string -> 'T /// Throw a System.ArgumentNullException exception /// The argument name. - /// The result value. + /// Never returns. [] val inline nullArg : argumentName:string -> 'T +#if !BUILDING_WITH_LKG && !BUILD_FROM_SOURCE + /// Throw a System.ArgumentNullException if the given value is null exception + /// The argument name. + /// The result value. + [] + val inline nullArgCheck : argumentName:string -> 'T? -> 'T when 'T : not struct and 'T : not null +#endif + /// Throw a System.InvalidOperationException exception /// The exception message. /// The result value. diff --git a/src/fsharp/FSharp.Core/reflect.fsi b/src/fsharp/FSharp.Core/reflect.fsi index 359f36af777..9930e6f7196 100644 --- a/src/fsharp/FSharp.Core/reflect.fsi +++ b/src/fsharp/FSharp.Core/reflect.fsi @@ -18,12 +18,14 @@ open Microsoft.FSharp.Collections type UnionCaseInfo = /// The name of the case. member Name : string + /// The type in which the case occurs. member DeclaringType: Type /// Returns the custom attributes associated with the case. /// An array of custom attributes. member GetCustomAttributes: unit -> obj[] + /// Returns the custom attributes associated with the case matching the given attribute type. /// The type of attributes to return. /// An array of custom attributes. @@ -54,7 +56,7 @@ type FSharpValue = /// Thrown when the input type is not a record type. /// The field from the record. static member GetRecordField: record:obj * info:PropertyInfo -> obj - + /// Precompute a function for reading a particular field from a record. /// Assumes the given type is a RecordType with a field of the given name. /// If not, ArgumentException is raised during pre-computation. @@ -101,6 +103,7 @@ type FSharpValue = /// Thrown when the input type is not a record type. /// An optimized reader for the given record type. static member PreComputeRecordReader : recordType:Type * ?bindingFlags:BindingFlags -> (obj -> obj[]) + /// Precompute a function for constructing a record value. /// /// Assumes the given type is a RecordType. @@ -137,7 +140,7 @@ type FSharpValue = /// Thrown when the input type is not a union case value. /// The description of the union case and its fields. static member GetUnionFields: value:obj * unionType:Type * ?bindingFlags:BindingFlags -> UnionCaseInfo * obj [] - + /// Assumes the given type is a union type. /// If not, ArgumentException is raised during pre-computation. /// @@ -207,8 +210,8 @@ type FSharpValue = /// The input tuple. /// Thrown when the input is not a tuple value. /// An array of the fields from the given tuple. - static member GetTupleFields: tuple:obj -> obj [] - + static member GetTupleFields: tuple:obj -> obj[] + /// Precompute a function for reading the values of a particular tuple type /// /// Assumes the given type is a TupleType. @@ -217,7 +220,7 @@ type FSharpValue = /// Thrown when the given type is not a tuple type. /// A function to read values of the given tuple type. static member PreComputeTupleReader : tupleType:Type -> (obj -> obj[]) - + /// Gets information that indicates how to read a field of a tuple /// The input tuple type. /// The index of the tuple element to describe. @@ -360,7 +363,8 @@ module FSharpReflectionExtensions = /// Optional flags that denotes accessibility of the private representation. /// Thrown when the input type is not a record type. /// The created record. - static member MakeRecord: recordType:Type * values:obj [] * ?allowAccessToPrivateRepresentation : bool -> obj + static member MakeRecord: recordType:Type * values:obj[] * ?allowAccessToPrivateRepresentation : bool -> obj + /// Reads all the fields from a record value. /// /// Assumes the given input is a record value. If not, ArgumentException is raised. @@ -385,6 +389,7 @@ module FSharpReflectionExtensions = /// Thrown when the input type is not a record type. /// An optimized reader for the given record type. static member PreComputeRecordReader : recordType:Type * ?allowAccessToPrivateRepresentation : bool -> (obj -> obj[]) + /// Precompute a function for constructing a record value. /// /// Assumes the given type is a RecordType. @@ -400,13 +405,13 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// A ConstructorInfo for the given record type. static member PreComputeRecordConstructorInfo: recordType:Type * ?allowAccessToPrivateRepresentation : bool-> ConstructorInfo - + /// Create a union case value. /// The description of the union case to create. /// The array of arguments to construct the given case. /// Optional flag that denotes accessibility of the private representation. /// The constructed union case. - static member MakeUnion: unionCase:UnionCaseInfo * args:obj [] * ?allowAccessToPrivateRepresentation : bool-> obj + static member MakeUnion: unionCase:UnionCaseInfo * args:obj[] * ?allowAccessToPrivateRepresentation : bool-> obj /// Identify the union case and its fields for an object /// @@ -420,8 +425,8 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// Thrown when the input type is not a union case value. /// The description of the union case and its fields. - static member GetUnionFields: value:obj * unionType:Type * ?allowAccessToPrivateRepresentation : bool -> UnionCaseInfo * obj [] - + static member GetUnionFields: value:obj * unionType:Type * ?allowAccessToPrivateRepresentation : bool -> UnionCaseInfo * obj[] + /// Assumes the given type is a union type. /// If not, ArgumentException is raised during pre-computation. /// diff --git a/src/fsharp/FindUnsolved.fs b/src/fsharp/FindUnsolved.fs index ac64aa6c1df..8d1aeaba761 100644 --- a/src/fsharp/FindUnsolved.fs +++ b/src/fsharp/FindUnsolved.fs @@ -75,8 +75,8 @@ let rec accExpr (cenv:cenv) (env:env) expr = accExprs cenv env argsl | Expr.Lambda (_, _ctorThisValOpt, _baseValOpt, argvs, _body, m, rty) -> - let topValInfo = ValReprInfo ([], [argvs |> List.map (fun _ -> ValReprInfo.unnamedTopArg1)], ValReprInfo.unnamedRetVal) - let ty = mkMultiLambdaTy m argvs rty + let topValInfo = ValReprInfo ([],[argvs |> List.map (fun _ -> ValReprInfo.unnamedTopArg1)],ValReprInfo.unnamedRetVal) + let ty = mkMultiLambdaTy cenv.g m argvs rty accLambdas cenv env topValInfo expr ty | Expr.TyLambda (_, tps, _body, _m, rty) -> diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index 09750c4f32d..62677b12966 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -116,7 +116,7 @@ type AttributeDecoder(namedArgs) = let nameMap = namedArgs |> List.map (fun (AttribNamedArg(s, _, _, c)) -> s, c) |> NameMap.ofList let findConst x = match NameMap.tryFind x nameMap with | Some(AttribExpr(_, Expr.Const (c, _, _))) -> Some c | _ -> None - let findAppTr x = match NameMap.tryFind x nameMap with | Some(AttribExpr(_, Expr.App (_, _, [TType_app(tr, _)], _, _))) -> Some tr | _ -> None + let findAppTr x = match NameMap.tryFind x nameMap with | Some(AttribExpr(_, Expr.App (_, _, [TType_app(tr, _, _)], _, _))) -> Some tr | _ -> None member __.FindInt16 x dflt = match findConst x with | Some(Const.Int16 x) -> x | _ -> dflt @@ -516,12 +516,14 @@ and GenTypeAux amap m (tyenv: TypeReprEnv) voidOK ptrsOK ty = ignore voidOK #endif match stripTyEqnsAndMeasureEqns g ty with - | TType_app (tcref, tinst) -> GenNamedTyAppAux amap m tyenv ptrsOK tcref tinst + | TType_app (tcref, tinst, _nullness) -> + GenNamedTyAppAux amap m tyenv ptrsOK tcref tinst + | TType_tuple (tupInfo, args) -> + GenTypeAux amap m tyenv VoidNotOK ptrsOK (mkCompiledTupleTy g (evalTupInfoIsStruct tupInfo) args) - | TType_tuple (tupInfo, args) -> GenTypeAux amap m tyenv VoidNotOK ptrsOK (mkCompiledTupleTy g (evalTupInfoIsStruct tupInfo) args) - - | TType_fun (dty, returnTy) -> EraseClosures.mkILFuncTy g.ilxPubCloEnv (GenTypeArgAux amap m tyenv dty) (GenTypeArgAux amap m tyenv returnTy) + | TType_fun (dty, returnTy, _nullness) -> + EraseClosures.mkILFuncTy g.ilxPubCloEnv (GenTypeArgAux amap m tyenv dty) (GenTypeArgAux amap m tyenv returnTy) | TType_anon (anonInfo, tinst) -> let tref = anonInfo.ILTypeRef @@ -537,7 +539,7 @@ and GenTypeAux amap m (tyenv: TypeReprEnv) voidOK ptrsOK ty = if tps.IsEmpty then GenTypeAux amap m tyenv VoidNotOK ptrsOK tau else EraseClosures.mkILTyFuncTy g.ilxPubCloEnv - | TType_var tp -> mkILTyvarTy tyenv.[tp, m] + | TType_var (tp, _nullness) -> mkILTyvarTy tyenv.[tp, m] | TType_measure _ -> g.ilg.typ_Int32 @@ -1437,7 +1439,7 @@ type AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbu NewRecdField false None (mkSynId m propName) false (mkTyparTy tp) true false [] [] XmlDoc.Empty taccessPublic false ]) let tcref = mkLocalTyconRef tycon - let _, typ = generalizeTyconRef tcref + let _, typ = generalizeTyconRef cenv.g tcref let tcaug = tcref.TypeContents tcaug.tcaug_interfaces <- @@ -2865,8 +2867,7 @@ and GenUntupledArgExpr cenv cgbuf eenv m argInfos expr sequel = GenBinding cenv cgbuf eenvinner bind let tys = destRefTupleTy g ty assert (tys.Length = numRequiredExprs) - // TODO - tupInfoRef - argInfos |> List.iteri (fun i _ -> GenGetTupleField cenv cgbuf eenvinner (tupInfoRef (* TODO *), loce, tys, i, m) Continue) + argInfos |> List.iteri (fun i _ -> GenGetTupleField cenv cgbuf eenvinner (tupInfoRef, loce, tys, i, m) Continue) GenSequel cenv eenv.cloc cgbuf sequel ) @@ -5926,10 +5927,10 @@ and GenBindingRhs cenv cgbuf eenv sp (vspec: Val) e = | Expr.TyLambda (_, tyargs, body, _, ttype) when ( tyargs |> List.forall (fun tp -> tp.IsErased) && - (match StorageForVal vspec.Range vspec eenv with Local _ -> true | _ -> false) && - (isLocalTypeFunc || - (match ttype with - TType_var typar -> match typar.Solution with Some(TType_app(t, _))-> t.IsStructOrEnumTycon | _ -> false + (match StorageForVal vspec.Range vspec eenv with Local _ -> true | _ -> false) && + (isLocalTypeFunc || + (match ttype with + TType_var(typar, _) -> match typar.Solution with Some(TType_app(t, _, _))-> t.IsStructOrEnumTycon | _ -> false | _ -> false)) ) -> // type lambda with erased type arguments that is stored as local variable (not method or property)- inline body @@ -6655,10 +6656,10 @@ and GenAbstractBinding cenv eenv tref (vref: ValRef) = [], [], [] /// Generate a ToString method that calls 'sprintf "%A"' -and GenToStringMethod cenv eenv ilThisTy m = +and GenToStringMethod cenv eenv ilThisTy m = let g = cenv.g - [ match (eenv.valsInScope.TryFind g.sprintf_vref.Deref, - eenv.valsInScope.TryFind g.new_format_vref.Deref) with + [ match (eenv.valsInScope.TryFind cenv.g.sprintf_vref.Deref, + eenv.valsInScope.TryFind cenv.g.new_format_vref.Deref) with | Some(Lazy(Method(_, _, sprintfMethSpec, _, _, _, _))), Some(Lazy(Method(_, _, newFormatMethSpec, _, _, _, _))) -> // The type returned by the 'sprintf' call let funcTy = EraseClosures.mkILFuncTy g.ilxPubCloEnv ilThisTy g.ilg.typ_String @@ -6667,18 +6668,18 @@ and GenToStringMethod cenv eenv ilThisTy m = [// 'T -> string' funcTy // rest follow from 'StringFormat' - GenUnitTy cenv eenv m - g.ilg.typ_String - g.ilg.typ_String + GenUnitTy cenv eenv m + g.ilg.typ_String + g.ilg.typ_String ilThisTy], []) // Instantiate with our own type let sprintfMethSpec = mkILMethSpec(sprintfMethSpec.MethodRef, AsObject, [], [funcTy]) // Here's the body of the method. Call printf, then invoke the function it returns let callInstrs = EraseClosures.mkCallFunc g.ilxPubCloEnv (fun _ -> 0us) eenv.tyenv.Count Normalcall (Apps_app(ilThisTy, Apps_done g.ilg.typ_String)) - let mdef = + let mdef = mkILNonGenericVirtualMethod ("ToString", ILMemberAccess.Public, [], mkILReturn g.ilg.typ_String, - mkMethodBody (true, [], 2, nonBranchingInstrsToCode + mkMethodBody (true, [], 2, nonBranchingInstrsToCode ([ // load the hardwired format string yield I_ldstr "%+A" // make the printf format object @@ -6708,7 +6709,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = | TAsmRepr _ | TILObjectRepr _ | TMeasureableRepr _ -> () | TFSharpObjectRepr _ | TRecdRepr _ | TUnionRepr _ -> let eenvinner = ReplaceTyenv (TypeReprEnv.ForTycon tycon) eenv - let thisTy = generalizedTyconRef tcref + let thisTy = generalizedTyOfTyconRef g tcref let ilThisTy = GenType cenv.amap m eenvinner.tyenv thisTy let tref = ilThisTy.TypeRef @@ -6792,10 +6793,10 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = let name = vref.DisplayName match vref.MemberInfo with | None -> None - | Some memberInfo -> - match name, memberInfo.MemberFlags.MemberKind with - | ("Item" | "op_IndexedLookup"), (MemberKind.PropertyGet | MemberKind.PropertySet) when not (isNil (ArgInfosOfPropertyVal g vref.Deref)) -> - Some( mkILCustomAttribute g.ilg (g.FindSysILTypeRef "System.Reflection.DefaultMemberAttribute", [g.ilg.typ_String], [ILAttribElem.String(Some name)], []) ) + | Some memberInfo -> + match name, memberInfo.MemberFlags.MemberKind with + | ("Item" | "op_IndexedLookup"), (MemberKind.PropertyGet | MemberKind.PropertySet) when not (isNil (ArgInfosOfPropertyVal g vref.Deref)) -> + Some( mkILCustomAttribute g.ilg (g.FindSysILTypeRef "System.Reflection.DefaultMemberAttribute", [g.ilg.typ_String], [ILAttribElem.String(Some(name))], []) ) | _ -> None) |> Option.toList @@ -6805,8 +6806,9 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = let debugDisplayAttrs, normalAttrs = tycon.Attribs |> List.partition (IsMatchingFSharpAttribute g g.attrib_DebuggerDisplayAttribute) let securityAttrs, normalAttrs = normalAttrs |> List.partition (fun a -> IsSecurityAttribute g cenv.amap cenv.casApplied a m) let generateDebugDisplayAttribute = not g.compilingFslib && tycon.IsUnionTycon && isNil debugDisplayAttrs - let generateDebugProxies = (not (tyconRefEq g tcref g.unit_tcr_canon) && - not (HasFSharpAttribute g g.attrib_DebuggerTypeProxyAttribute tycon.Attribs)) + let generateDebugProxies = + (not (tyconRefEq g tcref g.unit_tcr_canon) && + not (HasFSharpAttribute g g.attrib_DebuggerTypeProxyAttribute tycon.Attribs)) let permissionSets = CreatePermissionSets cenv eenv securityAttrs let secDecls = if List.isEmpty securityAttrs then emptyILSecurityDecls else mkILSecurityDecls permissionSets @@ -6814,8 +6816,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = let ilDebugDisplayAttributes = [ yield! GenAttrs cenv eenv debugDisplayAttrs if generateDebugDisplayAttribute then - yield g.mkDebuggerDisplayAttribute ("{" + debugDisplayMethodName + "(),nq}") ] - + yield g.mkDebuggerDisplayAttribute ("{" + debugDisplayMethodName + "(),nq}") ] let ilCustomAttrs = [ yield! defaultMemberAttrs @@ -6847,9 +6848,9 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = tycon.AllFieldsArray |> Array.forall (fun f -> f.IsStatic) isEmptyStruct && cenv.opts.workAroundReflectionEmitBugs && not tycon.TyparsNoRange.IsEmpty - + // Compute a bunch of useful things for each field - let isCLIMutable = (TryFindFSharpBoolAttribute g g.attrib_CLIMutableAttribute tycon.Attribs = Some true) + let isCLIMutable = (TryFindFSharpBoolAttribute g g.attrib_CLIMutableAttribute tycon.Attribs = Some true) let fieldSummaries = [ for fspec in tycon.AllFieldsArray do @@ -6877,7 +6878,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = let ilFieldOffset = match TryFindFSharpAttribute g g.attrib_FieldOffsetAttribute fspec.FieldAttribs with - | Some (Attrib(_, _, [ AttribInt32Arg fieldOffset ], _, _, _, _)) -> + | Some (Attrib(_, _, [ AttribInt32Arg fieldOffset ], _, _, _, _)) -> Some fieldOffset | Some (Attrib(_, _, _, _, _, _, m)) -> errorR(Error(FSComp.SR.ilFieldOffsetAttributeCouldNotBeDecoded(), m)) @@ -6892,24 +6893,24 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = if useGenuineField then yield! fspec.PropertyAttribs yield! fspec.FieldAttribs ] - + let ilNotSerialized = HasFSharpAttributeOpt g g.attrib_NonSerializedAttribute attribs - - let fattribs = + + let fattribs = attribs - // Do not generate FieldOffset as a true CLI custom attribute, since it is implied by other corresponding CLI metadata - |> List.filter (IsMatchingFSharpAttribute g g.attrib_FieldOffsetAttribute >> not) - // Do not generate NonSerialized as a true CLI custom attribute, since it is implied by other corresponding CLI metadata - |> List.filter (IsMatchingFSharpAttributeOpt g g.attrib_NonSerializedAttribute >> not) + // Do not generate FieldOffset as a true CLI custom attribute, since it is implied by other corresponding CLI metadata + |> List.filter (IsMatchingFSharpAttribute g g.attrib_FieldOffsetAttribute >> not) + // Do not generate NonSerialized as a true CLI custom attribute, since it is implied by other corresponding CLI metadata + |> List.filter (IsMatchingFSharpAttributeOpt g g.attrib_NonSerializedAttribute >> not) let ilFieldMarshal, fattribs = GenMarshal cenv fattribs // The IL field is hidden if the property/field is hidden OR we're using a property AND the field is not mutable (because we can take the address of a mutable field). // Otherwise fields are always accessed via their property getters/setters let isFieldHidden = isPropHidden || (not useGenuineField && not isFSharpMutable) - - let extraAttribs = - match tyconRepr with + + let extraAttribs = + match tyconRepr with | TRecdRepr _ when not useGenuineField -> [ g.DebuggerBrowsableNeverAttribute ] // hide fields in records in debug display | _ -> [] // don't hide fields in classes in debug display @@ -6933,13 +6934,13 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = .WithFieldMarshal(ilFieldMarshal) yield fdef - if requiresExtraField then - yield mkILInstanceField("__dummy", g.ilg.typ_Int32, None, ILMemberAccess.Assembly) ] - - // Generate property definitions for the fields compiled as properties - let ilPropertyDefsForFields = + if requiresExtraField then + yield mkILInstanceField ("__dummy", g.ilg.typ_Int32, None, ILMemberAccess.Assembly) ] + + // Generate property definitions for the fields compiled as properties + let ilPropertyDefsForFields = [ for (i, (useGenuineField, _, isFSharpMutable, isStatic, propAttribs, ilPropType, _, fspec)) in Seq.indexed fieldSummaries do - if not useGenuineField then + if not useGenuineField then let ilCallingConv = if isStatic then ILCallingConv.Static else ILCallingConv.Instance let ilPropName = fspec.Name let ilHasSetter = isCLIMutable || isFSharpMutable @@ -6997,19 +6998,19 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = [// 'T -> string' funcTy // rest follow from 'StringFormat' - GenUnitTy cenv eenv m - g.ilg.typ_String - g.ilg.typ_String + GenUnitTy cenv eenv m + g.ilg.typ_String + g.ilg.typ_String g.ilg.typ_String], []) // Instantiate with our own type let sprintfMethSpec = mkILMethSpec(sprintfMethSpec.MethodRef, AsObject, [], [funcTy]) // Here's the body of the method. Call printf, then invoke the function it returns let callInstrs = EraseClosures.mkCallFunc g.ilxPubCloEnv (fun _ -> 0us) eenv.tyenv.Count Normalcall (Apps_app(ilThisTy, Apps_done g.ilg.typ_String)) - let ilMethodDef = mkILNonGenericInstanceMethod (debugDisplayMethodName, ILMemberAccess.Assembly, [], + let ilMethodDef = mkILNonGenericInstanceMethod (debugDisplayMethodName,ILMemberAccess.Assembly, [], mkILReturn g.ilg.typ_Object, - mkMethodBody + mkMethodBody (true, [], 2, - nonBranchingInstrsToCode + nonBranchingInstrsToCode ([ // load the hardwired format string yield I_ldstr "%+0.8A" // make the printf format object @@ -7058,10 +7059,11 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = // FSharp 3.0 feature: adding CLIMutable to a record type causes emit of default constructor, and all fields get property setters // Records that are value types do not create a default constructor with CLIMutable or ComVisible if not isStructRecord && (isCLIMutable || (TryFindFSharpBoolAttribute g g.attrib_ComVisibleAttribute tycon.Attribs = Some true)) then - yield mkILSimpleStorageCtor(None, Some g.ilg.typ_Object.TypeSpec, ilThisTy, [], [], reprAccess) - + yield mkILSimpleStorageCtor(None, Some g.ilg.typ_Object.TypeSpec, ilThisTy, [], [], reprAccess) + if not (tycon.HasMember g "ToString" []) then yield! GenToStringMethod cenv eenv ilThisTy m + | TFSharpObjectRepr r when tycon.IsFSharpDelegateTycon -> // Build all the methods that go with a delegate type @@ -7077,9 +7079,9 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = | paraml -> paraml GenActualSlotsig m cenv eenvinner (TSlotSig(nm, ty, ctps, mtps, paraml, returnTy)) [] [] yield! mkILDelegateMethods reprAccess g.ilg (g.iltyp_AsyncCallback, g.iltyp_IAsyncResult) (p, r) - | _ -> + | _ -> () - | TUnionRepr _ when not (tycon.HasMember g "ToString" []) -> + | TUnionRepr _ when not (tycon.HasMember g "ToString" []) -> yield! GenToStringMethod cenv eenv ilThisTy m | _ -> () ] @@ -7087,7 +7089,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = let ilProperties = mkILProperties (ilPropertyDefsForFields @ abstractPropDefs) let ilEvents = mkILEvents abstractEventDefs let ilFields = mkILFields ilFieldDefs - + let tdef, tdefDiscards = let isSerializable = (TryFindFSharpBoolAttribute g g.attrib_AutoSerializableAttribute tycon.Attribs <> Some false) @@ -7097,14 +7099,14 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = let tdef = tdef.With(customAttrs = mkILCustomAttrs ilCustomAttrs, genericParams = ilGenParams) tdef, None - | TRecdRepr _ | TFSharpObjectRepr _ as tyconRepr -> + | TRecdRepr _ | TFSharpObjectRepr _ as tyconRepr -> let super = superOfTycon g tycon let ilBaseTy = GenType cenv.amap m eenvinner.tyenv super // Build a basic type definition let isObjectType = (match tyconRepr with TFSharpObjectRepr _ -> true | _ -> false) - let ilAttrs = - ilCustomAttrs @ + let ilAttrs = + ilCustomAttrs @ [mkCompilationMappingAttr g (int (if isObjectType then SourceConstructFlags.ObjectType @@ -7132,15 +7134,15 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = mkILMethods ilMethods, ilFields, emptyILTypeDefs, ilProperties, ilEvents, mkILCustomAttrs ilAttrs, typeDefTrigger) - // Set some the extra entries in the definition + // Set some the extra entries in the definition let isTheSealedAttribute = tyconRefEq g tcref g.attrib_SealedAttribute.TyconRef let tdef = tdef.WithSealed(isSealedTy g thisTy || isTheSealedAttribute).WithSerializable(isSerializable).WithAbstract(isAbstract).WithImport(isComInteropTy g thisTy) let tdef = tdef.With(methodImpls=mkILMethodImpls methodImpls) - let tdLayout, tdEncoding = + let tdLayout,tdEncoding = match TryFindFSharpAttribute g g.attrib_StructLayoutAttribute tycon.Attribs with - | Some (Attrib(_, _, [ AttribInt32Arg layoutKind ], namedArgs, _, _, _)) -> + | Some (Attrib(_, _, [ AttribInt32Arg(layoutKind) ], namedArgs, _, _, _)) -> let decoder = AttributeDecoder namedArgs let ilPack = decoder.FindInt32 "Pack" 0x0 let ilSize = decoder.FindInt32 "Size" 0x0 @@ -7218,8 +7220,8 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = cudAlternatives= alternatives cudWhere = None} - let layout = - if isStructTy g thisTy then + let layout = + if isStructTy g thisTy then if (match ilTypeDefKind with ILTypeDefKind.ValueType -> true | _ -> false) then // Structs with no instance fields get size 1, pack 0 ILTypeDefLayout.Sequential { Size=Some 1; Pack=Some 0us } @@ -7228,8 +7230,8 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = else ILTypeDefLayout.Auto - let cattrs = - mkILCustomAttrs (ilCustomAttrs @ + let cattrs = + mkILCustomAttrs (ilCustomAttrs @ [mkCompilationMappingAttr g (int (if hiddenRepr then SourceConstructFlags.SumType ||| SourceConstructFlags.NonPublicRepresentation @@ -7257,9 +7259,9 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = .WithInitSemantics(ILTypeInit.BeforeField) let tdef2 = g.eraseClassUnionDef tref tdef cuinfo - - // Discard the user-supplied (i.e. prim-type.fs) implementations of the get_Empty, get_IsEmpty, get_Value and get_None and Some methods. - // This is because we will replace their implementations by ones that load the unique + + // Discard the user-supplied (i.e. prim-type.fs) implementations of the get_Empty, get_IsEmpty, get_Value and get_None and Some methods. + // This is because we will replace their implementations by ones that load the unique // private static field for lists etc. // // Also discard the F#-compiler supplied implementation of the Empty, IsEmpty, Value and None properties. @@ -7294,7 +7296,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = /// Generate the type for an F# exception declaration. and GenExnDef cenv mgbuf eenv m (exnc: Tycon) = let g = cenv.g - let exncref = mkLocalEntityRef exnc + let exncref = mkLocalEntityRef exnc match exnc.ExceptionInfo with | TExnAbbrevRepr _ | TExnAsmRepr _ | TExnNone -> () | TExnFresh _ -> @@ -7323,27 +7325,27 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) = init = None, args = [], customAttrs=mkILCustomAttrs (GenAttrs cenv eenv fld.PropertyAttribs @ [mkCompilationMappingAttrWithSeqNum g (int SourceConstructFlags.Field) i])) - yield (ilMethodDef, ilFieldDef, ilPropDef, (ilPropName, ilFieldName, ilPropType)) ] + yield (ilMethodDef, ilFieldDef, ilPropDef, (ilPropName, ilFieldName, ilPropType)) ] |> List.unzip4 - let ilCtorDef = - mkILSimpleStorageCtorWithParamNames(None, Some g.iltyp_Exception.TypeSpec, ilThisTy, [], ChooseParamNames fieldNamesAndTypes, reprAccess) + let ilCtorDef = + mkILSimpleStorageCtorWithParamNames(None, Some g.iltyp_Exception.TypeSpec, ilThisTy, [], ChooseParamNames fieldNamesAndTypes, reprAccess) // In compiled code, all exception types get a parameterless constructor for use with XML serialization // This does default-initialization of all fields - let ilCtorDefNoArgs = - if not (isNil fieldNamesAndTypes) then + let ilCtorDefNoArgs = + if not (isNil fieldNamesAndTypes) then [ mkILSimpleStorageCtor(None, Some g.iltyp_Exception.TypeSpec, ilThisTy, [], [], reprAccess) ] else [] let serializationRelatedMembers = // do not emit serialization related members if target framework lacks SerializationInfo or StreamingContext - match g.iltyp_SerializationInfo, g.iltyp_StreamingContext with - | Some serializationInfoType, Some streamingContextType -> - let ilCtorDefForSerialziation = + match g.iltyp_SerializationInfo, g.iltyp_StreamingContext with + | Some serializationInfoType, Some streamingContextType -> + let ilCtorDefForSerialziation = mkILCtor(ILMemberAccess.Family, - [mkILParamNamed("info", serializationInfoType);mkILParamNamed("context", streamingContextType)], + [mkILParamNamed("info", serializationInfoType); mkILParamNamed("context", streamingContextType)], mkMethodBody (false, [], 8, nonBranchingInstrsToCode @@ -7352,7 +7354,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) = mkLdarg 2us mkNormalCall (mkILCtorMethSpecForTy (g.iltyp_Exception, [serializationInfoType; streamingContextType])) ], None)) - + //#if BE_SECURITY_TRANSPARENT [ilCtorDefForSerialziation] //#else diff --git a/src/fsharp/InfoReader.fs b/src/fsharp/InfoReader.fs index 7e9dffdd52b..f0b403b62c0 100644 --- a/src/fsharp/InfoReader.fs +++ b/src/fsharp/InfoReader.fs @@ -19,6 +19,10 @@ open FSharp.Compiler.Tast open FSharp.Compiler.Tastops open FSharp.Compiler.TcGlobals +#if !NO_EXTENSIONTYPING +open FSharp.Compiler.ExtensionTyping +#endif + /// Use the given function to select some of the member values from the members of an F# type let private SelectImmediateMemberVals g optFilter f (tcref: TyconRef) = let chooser (vref: ValRef) = @@ -145,8 +149,8 @@ let rec GetImmediateIntrinsicPropInfosOfTypeAux (optFilter, ad) g amap m origTy match optFilter with | Some name -> match st.PApply((fun st -> st.GetProperty name), m) with - | Tainted.Null -> [||] - | pi -> [|pi|] + | Tainted.Null -> [||] + | Tainted.NonNull pi -> [|pi|] | None -> st.PApplyArray((fun st -> st.GetProperties()), "GetProperties", m) matchingProps @@ -188,7 +192,7 @@ let IsIndexerType g amap ty = isListTy g ty || match tryDestAppTy g ty with | ValueSome tcref -> - let _, entityTy = generalizeTyconRef tcref + let entityTy = generalizedTyOfTyconRef g tcref let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) g amap range0 entityTy props |> List.exists (fun x -> x.PropertyName = "Item") | ValueNone -> false @@ -220,8 +224,8 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) = [ for fi in st.PApplyArray((fun st -> st.GetFields()), "GetFields", m) -> ProvidedField(amap, fi, m) ] | Some name -> match st.PApply ((fun st -> st.GetField name), m) with - | Tainted.Null -> [] - | fi -> [ ProvidedField(amap, fi, m) ] + | Tainted.Null -> [] + | Tainted.NonNull fi -> [ ProvidedField(amap, fi, m) ] #endif | ILTypeMetadata _ -> let tinfo = ILTypeInfo.FromType g ty @@ -245,8 +249,8 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) = [ for ei in st.PApplyArray((fun st -> st.GetEvents()), "GetEvents", m) -> ProvidedEvent(amap, ei, m) ] | Some name -> match st.PApply ((fun st -> st.GetEvent name), m) with - | Tainted.Null -> [] - | ei -> [ ProvidedEvent(amap, ei, m) ] + | Tainted.Null -> [] + | Tainted.NonNull ei -> [ ProvidedEvent(amap, ei, m) ] #endif | ILTypeMetadata _ -> let tinfo = ILTypeInfo.FromType g ty @@ -343,7 +347,7 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) = // a decent hash function for these. canMemoize=(fun (_flags, (_: range), ty) -> match stripTyEqns g ty with - | TType_app(tcref, []) -> tcref.TypeContents.tcaug_closed + | TType_app(tcref, [], _nullness) -> tcref.TypeContents.tcaug_closed // TODO NULLNESS: consider whether ignoring _nullness is valid here | _ -> false), keyComparer= @@ -352,13 +356,13 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) = // Ignoring the ranges - that's OK. flagsEq.Equals(flags1, flags2) && match stripTyEqns g typ1, stripTyEqns g typ2 with - | TType_app(tcref1, []), TType_app(tcref2, []) -> tyconRefEq g tcref1 tcref2 + | TType_app(tcref1, [], _nullness1),TType_app(tcref2, [], _nullness2) -> tyconRefEq g tcref1 tcref2 // TODO NULLNESS: consider whether ignoring _nullness is valid here | _ -> false member x.GetHashCode((flags, _, ty)) = // Ignoring the ranges - that's OK. flagsEq.GetHashCode flags + (match stripTyEqns g ty with - | TType_app(tcref, []) -> hash tcref.LogicalName + | TType_app(tcref, [], _nullness1) -> hash tcref.LogicalName // TODO NULLNESS: consider whether ignoring _nullness is valid here | _ -> 0) }) @@ -733,8 +737,8 @@ let GetSigOfFunctionForDelegate (infoReader: InfoReader) delty m ad = | _ -> compiledViewOfDelArgTys let delRetTy = invokeMethInfo.GetFSharpReturnTy(amap, m, minst) CheckMethInfoAttributes g m None invokeMethInfo |> CommitOperationResult - let fty = mkIteratedFunTy fsharpViewOfDelArgTys delRetTy - SigOfFunctionForDelegate(invokeMethInfo, compiledViewOfDelArgTys, delRetTy, fty) + let fty = mkIteratedFunTy g fsharpViewOfDelArgTys delRetTy + SigOfFunctionForDelegate(invokeMethInfo,compiledViewOfDelArgTys, delRetTy, fty) /// Try and interpret a delegate type as a "standard" .NET delegate type associated with an event, with a "sender" parameter. let TryDestStandardDelegateType (infoReader: InfoReader) m ad delTy = diff --git a/src/fsharp/InnerLambdasToTopLevelFuncs.fs b/src/fsharp/InnerLambdasToTopLevelFuncs.fs index 1ff7ed3c7c1..d2f2e03df88 100644 --- a/src/fsharp/InnerLambdasToTopLevelFuncs.fs +++ b/src/fsharp/InnerLambdasToTopLevelFuncs.fs @@ -843,7 +843,7 @@ let CreateNewValuesForTLR g tlrS arityM fclassM envPackM = let newTps = envp.ep_etps @ tps let fHatTy = let newArgtys = List.map typeOfVal envp.ep_aenvs @ argtys - mkLambdaTy newTps newArgtys res + mkLambdaTy g newTps newArgtys res let fHatArity = MakeSimpleArityInfo newTps (envp.ep_aenvs.Length + wf) let fHatName = globalNng.FreshCompilerGeneratedName(name, m) @@ -987,8 +987,8 @@ module Pass4_RewriteAssembly = (* REVIEW: is this mutation really, really necessary? *) (* Why are we applying TLR if the thing already has an arity? *) let fOrig = setValHasNoArity fOrig - let fBind = - mkMultiLambdaBind fOrig letSeqPtOpt m tps vss + let fBind = + mkMultiLambdaBind penv.g fOrig letSeqPtOpt m tps vss (mkApps penv.g ((exprForVal m fHat, fHat.Type), [List.map mkTyparTy (envp.ep_etps @ tps)], @@ -1003,17 +1003,17 @@ module Pass4_RewriteAssembly = // Don't take all the variables - only up to length wf let vssTake, vssDrop = List.splitAt wf vss // put the variables back on - let b, rty = mkMultiLambdasCore b.Range vssDrop (b, rty) - // fHat, args + let b, rty = mkMultiLambdasCore penv.g b.Range vssDrop (b, rty) + // fHat, args let m = fHat.Range // Add the type variables to the front let fHat_tps = envp.ep_etps @ tps // Add the 'aenv' and original taken variables to the front let fHat_args = List.map List.singleton envp.ep_aenvs @ vssTake - let fHat_body = mkLetsFromBindings m envp.ep_unpack b - let fHat_body = mkLetsFromBindings m shortRecBinds fHat_body // bind "f" if have short recursive calls (somewhere) - // fHat binding, f rebinding - let fHatBind = mkMultiLambdaBind fHat letSeqPtOpt m fHat_tps fHat_args (fHat_body, rty) + let fHat_body = mkLetsFromBindings m envp.ep_unpack b + let fHat_body = mkLetsFromBindings m shortRecBinds fHat_body // bind "f" if have short recursive calls (somewhere) + // fHat binding, f rebinding + let fHatBind = mkMultiLambdaBind penv.g fHat letSeqPtOpt m fHat_tps fHat_args (fHat_body,rty) fHatBind let rebinds = binds |> List.map fRebinding let shortRecBinds = rebinds |> List.filter (fun b -> penv.recShortCallS.Contains(b.Var)) diff --git a/src/fsharp/LegacyHostedCompilerForTesting.fs b/src/fsharp/LegacyHostedCompilerForTesting.fs index b793915b5c8..ccc4cb9c406 100644 --- a/src/fsharp/LegacyHostedCompilerForTesting.fs +++ b/src/fsharp/LegacyHostedCompilerForTesting.fs @@ -136,12 +136,15 @@ type internal FscCompiler(legacyReferenceResolver) = fun arg -> regex.IsMatch(arg) /// do compilation as if args was argv to fsc.exe - member this.Compile(args : string array) = + member this.Compile(args : string[]) = // args.[0] is later discarded, assuming it is just the path to fsc. // compensate for this in case caller didn't know let args = + match box args with + | null -> [|"fsc"|] + | _ -> match args with - | [||] | null -> [|"fsc"|] + | [||] -> [|"fsc"|] | a when not <| fscExeArg a.[0] -> Array.append [|"fsc"|] a | _ -> args diff --git a/src/fsharp/LexFilter.fs b/src/fsharp/LexFilter.fs index 7cfdbcf494a..0bf2e8a13ef 100755 --- a/src/fsharp/LexFilter.fs +++ b/src/fsharp/LexFilter.fs @@ -864,6 +864,7 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer, if isAdjacent tokenTup lookaheadTokenTup then let stack = ref [] let rec scanAhead nParen = + assert (nParen >= 0) let lookaheadTokenTup = popNextTokenTup() let lookaheadToken = lookaheadTokenTup.Token stack := (lookaheadTokenTup, true) :: !stack @@ -877,6 +878,26 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer, scanAhead nParen else false + | INFIX_COMPARE_OP "?>" -> + // just smash the token immediately + stack := (!stack).Tail + delayToken (lookaheadTokenTup.UseShiftedLocation(GREATER false, 1, 0)) + delayToken (lookaheadTokenTup.UseShiftedLocation(QMARK, 0, -1)) + scanAhead nParen + | INFIX_COMPARE_OP ">?>" -> + // just smash the token immediately + stack := (!stack).Tail + delayToken (lookaheadTokenTup.UseShiftedLocation(GREATER false, 2, 0)) + delayToken (lookaheadTokenTup.UseShiftedLocation(QMARK, 1, -1)) + delayToken (lookaheadTokenTup.UseShiftedLocation(GREATER false, 0, -2)) + scanAhead nParen + | INFIX_COMPARE_OP "?>>" -> + // just smash the token immediately + stack := (!stack).Tail + delayToken (lookaheadTokenTup.UseShiftedLocation(GREATER false, 2, 0)) + delayToken (lookaheadTokenTup.UseShiftedLocation(GREATER false, 1, -1)) + delayToken (lookaheadTokenTup.UseShiftedLocation(QMARK, 0, -2)) + scanAhead nParen | GREATER _ | GREATER_RBRACK | GREATER_BAR_RBRACK -> let nParen = nParen - 1 let hasAfterOp = (match lookaheadToken with GREATER _ -> false | _ -> true) @@ -922,7 +943,9 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer, // f<{| C : int |}>x // fx // fx + // fx | DEFAULT | COLON | COLON_GREATER | STRUCT | NULL | DELEGATE | AND | WHEN + | QMARK | HACKNULL | AMBIVALENT | DOT_DOT | NEW | LBRACE_BAR diff --git a/src/fsharp/MSBuildReferenceResolver.fs b/src/fsharp/MSBuildReferenceResolver.fs index 1a49c6a0fca..584b67a98c4 100644 --- a/src/fsharp/MSBuildReferenceResolver.fs +++ b/src/fsharp/MSBuildReferenceResolver.fs @@ -76,7 +76,7 @@ module internal FSharp.Compiler.MSBuildReferenceResolver /// Get the path to the .NET Framework implementation assemblies by using ToolLocationHelper.GetPathToDotNetFramework /// This is only used to specify the "last resort" path for assembly resolution. - let GetPathToDotNetFrameworkImlpementationAssemblies(v) = + let GetPathToDotNetFrameworkImlpementationAssemblies(v) : string list = let v = match v with | Net45 -> Some TargetDotNetFrameworkVersion.Version45 @@ -95,7 +95,7 @@ module internal FSharp.Compiler.MSBuildReferenceResolver | Some v -> match ToolLocationHelper.GetPathToDotNetFramework v with | null -> [] - | x -> [x] + | NonNull x -> [x] | _ -> [] let GetPathToDotNetFrameworkReferenceAssemblies(version) = diff --git a/src/fsharp/MethodCalls.fs b/src/fsharp/MethodCalls.fs index 912a4035280..9e700ad0659 100644 --- a/src/fsharp/MethodCalls.fs +++ b/src/fsharp/MethodCalls.fs @@ -332,13 +332,16 @@ type CalledMeth<'T> match epinfos with | [pinfo] when pinfo.HasSetter && not pinfo.IsIndexer -> let pminfo = pinfo.SetterMethod - let pminst = match minfo with - | MethInfo.FSMeth(_, TType.TType_app(_, types), _, _) -> types - | _ -> freshenMethInfo m pminfo + let pminst = + match minfo with + | MethInfo.FSMeth(_, TType_app(_, types, _), _, _) -> types + | _ -> freshenMethInfo m pminfo + + let pminst = + match tyargsOpt with + | Some (TType_app(_, types, _)) -> types + | _ -> pminst - let pminst = match tyargsOpt with - | Some(TType.TType_app(_, types)) -> types - | _ -> pminst Choice1Of2(AssignedItemSetter(id, AssignedPropSetter(pinfo, pminfo, pminst), e)) | _ -> match infoReader.GetILFieldInfosOfType(Some(nm), ad, m, returnedObjTy) with @@ -705,7 +708,7 @@ let MakeMethInfoCall amap m minfo minst args = let isProp = false // not necessarily correct, but this is only used post-creflect where this flag is irrelevant let ilMethodRef = Import.ImportProvidedMethodBaseAsILMethodRef amap m mi let isConstructor = mi.PUntaint((fun c -> c.IsConstructor), m) - let valu = mi.PUntaint((fun c -> c.DeclaringType.IsValueType), m) + let valu = mi.PUntaint((fun c -> (nonNull c.DeclaringType).IsValueType), m) let actualTypeInst = [] // GENERIC TYPE PROVIDERS: for generics, we would have something here let actualMethInst = [] // GENERIC TYPE PROVIDERS: for generics, we would have something here let ilReturnTys = Option.toList (minfo.GetCompiledReturnTy(amap, m, [])) // GENERIC TYPE PROVIDERS: for generics, we would have more here @@ -718,7 +721,7 @@ let MakeMethInfoCall amap m minfo minst args = // This imports a provided method, and checks if it is a known compiler intrinsic like "1 + 2" let TryImportProvidedMethodBaseAsLibraryIntrinsic (amap: Import.ImportMap, m: range, mbase: Tainted) = let methodName = mbase.PUntaint((fun x -> x.Name), m) - let declaringType = Import.ImportProvidedType amap m (mbase.PApply((fun x -> x.DeclaringType), m)) + let declaringType = Import.ImportProvidedType amap m (mbase.PApply((fun x -> nonNull x.DeclaringType), m)) if isAppTy amap.g declaringType then let declaringEntity = tcrefOfAppTy amap.g declaringType if not declaringEntity.IsLocalRef && ccuEq declaringEntity.nlr.Ccu amap.g.fslibCcu then @@ -820,8 +823,14 @@ let BuildMethodCall tcVal g amap isMutable m isProp minfo valUseFlags minst objA // Build a 'call' to a struct default constructor | DefaultStructCtor (g, ty) -> - if not (TypeHasDefaultValue g m ty) then - errorR(Error(FSComp.SR.tcDefaultStructConstructorCall(), m)) + if g.langFeatureNullness then + if not (TypeHasDefaultValueNew g m ty) && not (TypeHasDefaultValueOld g m ty) then + errorR(Error(FSComp.SR.tcDefaultStructConstructorCall(), m)) + if g.checkNullness && not (TypeHasDefaultValueNew g m ty) then + warning(Error(FSComp.SR.tcDefaultStructConstructorCallNulls(), m)) + else + if not (TypeHasDefaultValueOld g m ty) then + errorR(Error(FSComp.SR.tcDefaultStructConstructorCall(), m)) mkDefault (m, ty), ty) //------------------------------------------------------------------------- @@ -948,7 +957,7 @@ module ProvidedMethodCalls = st.PApply((fun st -> match st.BaseType with | null -> ProvidedType.CreateNoContext(typeof) // it might be an interface - | st -> st), m) + | NonNull st -> st), m) loop baseType else if isGeneric then @@ -987,7 +996,7 @@ module ProvidedMethodCalls = let fail() = error(Error(FSComp.SR.etUnsupportedProvidedExpression(ea.PUntaint((fun etree -> etree.UnderlyingExpressionString), m)), m)) match ea with | Tainted.Null -> error(Error(FSComp.SR.etNullProvidedExpression(ea.TypeProviderDesignation), m)) - | _ -> + | Tainted.NonNull ea -> match ea.PApplyOption((function ProvidedTypeAsExpr x -> Some x | _ -> None), m) with | Some info -> let (expr, targetTy) = info.PApply2(id, m) @@ -1110,7 +1119,7 @@ module ProvidedMethodCalls = let vsT = List.map addVar vs let delegateBodyExprT = exprToExpr delegateBodyExpr List.iter removeVar vs - let lambdaExpr = mkLambdas m [] vsT (delegateBodyExprT, tyOfExpr g delegateBodyExprT) + let lambdaExpr = mkLambdas g m [] vsT (delegateBodyExprT, tyOfExpr g delegateBodyExprT) let lambdaExprTy = tyOfExpr g lambdaExpr let infoReader = InfoReader(g, amap) let exprT = CoerceFromFSharpFuncToDelegate g amap infoReader AccessorDomain.AccessibleFromSomewhere lambdaExprTy m lambdaExpr delegateTyT @@ -1251,7 +1260,7 @@ module ProvidedMethodCalls = let thisArg, paramVars = match objArgs with | [objArg] -> - let erasedThisTy = eraseSystemType (amap, m, mi.PApply((fun mi -> mi.DeclaringType), m)) + let erasedThisTy = eraseSystemType (amap, m, mi.PApply((fun mi -> nonNull mi.DeclaringType), m)) let thisVar = erasedThisTy.PApply((fun ty -> ProvidedVar.Fresh("this", ty)), m) Some objArg, Array.append [| thisVar |] paramVars | [] -> None, paramVars @@ -1271,7 +1280,7 @@ module ProvidedMethodCalls = methInfoOpt, expr, exprty with | :? TypeProviderError as tpe -> - let typeName = mi.PUntaint((fun mb -> mb.DeclaringType.FullName), m) + let typeName = mi.PUntaint((fun mb -> (nonNull mb.DeclaringType).FullName), m) let methName = mi.PUntaint((fun mb -> mb.Name), m) raise( tpe.WithContext(typeName, methName) ) // loses original stack trace #endif @@ -1302,7 +1311,7 @@ let MethInfoChecks g amap isInstance tyargsOpt objArgs ad m (minfo: MethInfo) = match objArgs, ad with | [objArg], AccessibleFrom(paths, Some tcref) -> let objArgTy = tyOfExpr g objArg - let ty = generalizedTyconRef tcref + let ty = generalizedTyOfTyconRef g tcref // We get to keep our rights if the type we're in subsumes the object argument type if TypeFeasiblySubsumesType 0 g amap m ty CanCoerce objArgTy then ad diff --git a/src/fsharp/MethodOverrides.fs b/src/fsharp/MethodOverrides.fs index c621706b9b8..c689ecd7270 100644 --- a/src/fsharp/MethodOverrides.fs +++ b/src/fsharp/MethodOverrides.fs @@ -235,7 +235,7 @@ module DispatchSlotChecking = let OverrideImplementsDispatchSlot g amap m dispatchSlot availPriorOverride = IsExactMatch g amap m dispatchSlot availPriorOverride && // The override has to actually be in some subtype of the dispatch slot - ExistsHeadTypeInEntireHierarchy g amap m (generalizedTyconRef availPriorOverride.BoundingTyconRef) dispatchSlot.DeclaringTyconRef + ExistsHeadTypeInEntireHierarchy g amap m (generalizedTyOfTyconRef g availPriorOverride.BoundingTyconRef) dispatchSlot.DeclaringTyconRef /// Check if a dispatch slot is already implemented let DispatchSlotIsAlreadyImplemented g amap m availPriorOverridesKeyed (dispatchSlot: MethInfo) = @@ -417,7 +417,7 @@ module DispatchSlotChecking = // dispatch slots are ordered from the derived classes to base // so we can check the topmost dispatch slot if it is final match dispatchSlots with - | meth :: _ when meth.IsFinal -> errorR(Error(FSComp.SR.tcCannotOverrideSealedMethod((sprintf "%s::%s" (meth.ApparentEnclosingType.ToString()) (meth.LogicalName))), m)) + | meth::_ when meth.IsFinal -> errorR(Error(FSComp.SR.tcCannotOverrideSealedMethod((sprintf "%s::%s" (NicePrint.stringOfTy denv meth.ApparentEnclosingType) meth.LogicalName)), m)) | _ -> () @@ -568,7 +568,7 @@ module DispatchSlotChecking = let tcaug = tycon.TypeContents let interfaces = tycon.ImmediateInterfacesOfFSharpTycon |> List.map (fun (ity, _compgen, m) -> (ity, m)) - let overallTy = generalizedTyconRef (mkLocalTyconRef tycon) + let overallTy = generalizedTyOfTyconRef g (mkLocalTyconRef tycon) let allReqdTys = (overallTy, tycon.Range) :: interfaces diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index 8a9b46298d4..d59aa32d124 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -115,9 +115,9 @@ let ActivePatternElemsOfModuleOrNamespace (modref: ModuleOrNamespaceRef) : NameM /// Detect a use of a nominal type, including type abbreviations. /// /// When reporting symbols, we care about abbreviations, e.g. 'int' and 'int32' count as two separate symbols -let (|AbbrevOrAppTy|_|) (ty: TType) = - match stripTyparEqns ty with - | TType_app (tcref, _) -> Some tcref +let (|AbbrevOrAppTy|_|) (ty: TType) = + match stripTyparEqns ty with + | TType_app (tcref, _, _) -> Some tcref | _ -> None [] @@ -427,8 +427,8 @@ let private GetCSharpStyleIndexedExtensionMembersForTyconRef (amap: Import.Impor // Type must be non-generic and have 'Extension' attribute if isNil(tcrefOfStaticClass.Typars m) && TyconRefHasAttribute g m g.attrib_ExtensionAttribute tcrefOfStaticClass then let pri = NextExtensionMethodPriority() - let ty = generalizedTyconRef tcrefOfStaticClass - + let ty = generalizedTyOfTyconRef g tcrefOfStaticClass + // Get the 'plain' methods, not interpreted as extension methods let minfos = GetImmediateIntrinsicMethInfosOfType (None, AccessorDomain.AccessibleFromSomeFSharpCode) g amap m ty [ for minfo in minfos do @@ -580,10 +580,9 @@ let AddActivePatternResultTagsToNameEnv (apinfo: PrettyNaming.ActivePatternInfo) ||> List.foldBack (fun (j, nm) acc -> acc.Add(nm, Item.ActivePatternResult(apinfo, ty, j, m))) } /// Generalize a union case, from Cons --> List.Cons -let GeneralizeUnionCaseRef (ucref: UnionCaseRef) = - UnionCaseInfo (fst (generalizeTyconRef ucref.TyconRef), ucref) - - +let GeneralizeUnionCaseRef (ucref: UnionCaseRef) = + UnionCaseInfo (generalTyconRefInst ucref.TyconRef, ucref) + /// Add type definitions to the sub-table of the environment indexed by name and arity let AddTyconsByDemangledNameAndArity (bulkAddMode: BulkAdd) (tcrefs: TyconRef[]) (tab: LayeredMap) = if tcrefs.Length = 0 then tab else @@ -665,11 +664,11 @@ let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition (g: TcGlobals) // This may explore into an unreferenced assembly if the name // is a type abbreviation. If it does, assume the name does not // have a constructor. - let mayHaveConstruction = - protectAssemblyExploration - false - (fun () -> - let ty = generalizedTyconRef tcref + let mayHaveConstruction = + protectAssemblyExploration + false + (fun () -> + let ty = generalizedTyOfTyconRef g tcref isClassTy g ty || isStructTy g ty) if mayHaveConstruction then @@ -854,7 +853,7 @@ let AddDeclaredTyparsToNameEnv check nenv typars = /// a fresh set of inference type variables for the type parameters of the union type. let FreshenTycon (ncenv: NameResolver) m (tcref: TyconRef) = let tinst = ncenv.InstantiationGenerator m (tcref.Typars m) - let improvedTy = ncenv.g.decompileType tcref tinst + let improvedTy = ncenv.g.decompileType tcref tinst ncenv.g.knownWithoutNull improvedTy /// Convert a reference to a union case into a UnionCaseInfo that includes @@ -1132,7 +1131,7 @@ let ResolveProvidedTypeNameInEntity (amap, m, typeName, modref: ModuleOrNamespac //if staticResInfo.NumStaticArgs > 0 then // error(Error(FSComp.SR.etNestedProvidedTypesDoNotTakeStaticArgumentsOrGenericParameters(), m)) [] - | nestedSty -> + | Tainted.NonNull nestedSty -> [AddEntityForProvidedType (amap, modref, resolutionEnvironment, nestedSty, m) ] | _ -> [] #endif @@ -1386,7 +1385,7 @@ let ItemsAreEffectivelyEqual g orig other = nm1 = nm2 && (typeEquiv g (mkTyparTy tp1) (mkTyparTy tp2) || match stripTyparEqns (mkTyparTy tp1), stripTyparEqns (mkTyparTy tp2) with - | TType_var tp1, TType_var tp2 -> + | TType_var (tp1, _), TType_var (tp2, _) -> not tp1.IsCompilerGenerated && not tp1.IsFromError && not tp2.IsCompilerGenerated && not tp2.IsFromError && Range.equals tp1.Range tp2.Range @@ -3731,10 +3730,13 @@ let rec ResolvePartialLongIdentInType (ncenv: NameResolver) nenv isApplicableMet // e.g. .. (rfinfos |> List.collect (fun x -> x.FieldType |> ResolvePartialLongIdentInType ncenv nenv isApplicableMeth m ad false rest)) @ - // e.g. .. - let FullTypeOfPinfo(pinfo: PropInfo) = - let rty = pinfo.GetPropertyType(amap, m) - let rty = if pinfo.IsIndexer then mkRefTupledTy g (pinfo.GetParamTypes(amap, m)) --> rty else rty + // e.g. .. + let FullTypeOfPinfo (pinfo: PropInfo) = + let rty = pinfo.GetPropertyType(amap, m) + let rty = + if pinfo.IsIndexer then + mkFunTy g (mkRefTupledTy g (pinfo.GetParamTypes(amap, m))) rty + else rty rty (ty @@ -3921,10 +3923,11 @@ let rec ResolvePartialLongIdentInModuleOrNamespace (ncenv: NameResolver) nenv is @ (LookupTypeNameInEntityNoArity m id modref.ModuleOrNamespaceType |> List.collect (fun tycon -> - let tcref = modref.NestedTyconRef tycon - if not (IsTyconUnseenObsoleteSpec ad g ncenv.amap m tcref allowObsolete) then - tcref |> generalizedTyconRef |> ResolvePartialLongIdentInType ncenv nenv isApplicableMeth m ad true rest - else + let tcref = modref.NestedTyconRef tycon + if not (IsTyconUnseenObsoleteSpec ad g ncenv.amap m tcref allowObsolete) then + let ty = generalizedTyOfTyconRef g tcref + ResolvePartialLongIdentInType ncenv nenv isApplicableMeth m ad true rest ty + else [])) /// Try to resolve a long identifier as type. @@ -4176,8 +4179,8 @@ and ResolvePartialLongIdentToClassOrRecdFieldsImpl (ncenv: NameResolver) (nenv: let recdFields = nenv.eFieldLabels |> Seq.collect (fun (KeyValue(_, v)) -> v) - |> Seq.map (fun fref -> - let typeInsts = fref.TyconRef.TyparsNoRange |> List.map (fun tyar -> tyar.AsType) + |> Seq.map (fun fref -> + let typeInsts = fref.TyconRef.TyparsNoRange |> List.map mkTyparTy Item.RecdField(RecdFieldInfo(typeInsts, fref))) |> List.ofSeq @@ -4412,13 +4415,17 @@ let rec ResolvePartialLongIdentInTypeForItem (ncenv: NameResolver) nenv m ad sta // e.g. .. for rfinfo in rfinfos do yield! ResolvePartialLongIdentInTypeForItem ncenv nenv m ad false rest item rfinfo.FieldType - - // e.g. .. - let fullTypeOfPinfo (pinfo: PropInfo) = - let rty = pinfo.GetPropertyType(amap, m) - let rty = if pinfo.IsIndexer then mkRefTupledTy g (pinfo.GetParamTypes(amap, m)) --> rty else rty - rty - + + // e.g. .. + let fullTypeOfPinfo (pinfo: PropInfo) = + let rty = pinfo.GetPropertyType(amap, m) + let rty = + if pinfo.IsIndexer then + mkFunTy g (mkRefTupledTy g (pinfo.GetParamTypes(amap, m))) rty + else + rty + rty + let pinfos = ty |> AllPropInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv (Some id) ad IgnoreOverrides m @@ -4528,9 +4535,10 @@ let rec ResolvePartialLongIdentInModuleOrNamespaceForItem (ncenv: NameResolver) | _ -> () for tycon in LookupTypeNameInEntityNoArity m id modref.ModuleOrNamespaceType do - let tcref = modref.NestedTyconRef tycon - if not (IsTyconUnseenObsoleteSpec ad g ncenv.amap m tcref true) then - yield! tcref |> generalizedTyconRef |> ResolvePartialLongIdentInTypeForItem ncenv nenv m ad true rest item + let tcref = modref.NestedTyconRef tycon + if not (IsTyconUnseenObsoleteSpec ad g ncenv.amap m tcref true) then + let ty = tcref |> generalizedTyOfTyconRef g + yield! ResolvePartialLongIdentInTypeForItem ncenv nenv m ad true rest item ty } let rec PartialResolveLookupInModuleOrNamespaceAsModuleOrNamespaceThenLazy f plid (modref: ModuleOrNamespaceRef) = diff --git a/src/fsharp/NicePrint.fs b/src/fsharp/NicePrint.fs index ab45f12c137..fcc98ab0e6c 100644 --- a/src/fsharp/NicePrint.fs +++ b/src/fsharp/NicePrint.fs @@ -836,6 +836,8 @@ module private PrintTypes = [layoutTypeAppWithInfoAndPrec denv env (WordL.keywordDelegate) 2 true [aty;bty] |> longConstraintPrefix] | TyparConstraint.SupportsNull _ -> [wordL (tagKeyword "null") |> longConstraintPrefix] + | TyparConstraint.NotSupportsNull _ -> + [(wordL (tagKeyword "not") ^^ wordL(tagKeyword "null")) |> longConstraintPrefix] | TyparConstraint.IsNonNullableStruct _ -> if denv.shortConstraints then [wordL (tagText "value type")] @@ -912,30 +914,40 @@ module private PrintTypes = | [arg] -> layoutTypeWithInfoAndPrec denv env 2 arg ^^ tcL | args -> bracketIfL (prec <= 1) (bracketL (layoutTypesWithInfoAndPrec denv env 2 (sepL (tagPunctuation ",")) args) --- tcL) + and layoutNullness part2 (nullness: Nullness) = + match nullness.Evaluate() with + | NullnessInfo.WithNull -> part2 ^^ rightL (tagText "?") + | NullnessInfo.WithoutNull -> part2 + | NullnessInfo.AmbivalentToNull -> part2 // TODO NULLNESS: emit this optionally ^^ wordL (tagText "%") + /// Layout a type, taking precedence into account to insert brackets where needed and layoutTypeWithInfoAndPrec denv env prec ty = match stripTyparEqns ty with - // Always prefer to format 'byref' as 'inref' - | ty when isInByrefTy denv.g ty && (match ty with TType_app (tc, _) when denv.g.inref_tcr.CanDeref && tyconRefEq denv.g tc denv.g.byref2_tcr -> true | _ -> false) -> + // Always prefer to format 'byref' as 'inref' + | ty when isInByrefTy denv.g ty && (match ty with TType_app (tc, _, _) when denv.g.inref_tcr.CanDeref && tyconRefEq denv.g tc denv.g.byref2_tcr -> true | _ -> false) -> layoutTypeWithInfoAndPrec denv env prec (mkInByrefTy denv.g (destByrefTy denv.g ty)) - // Always prefer to format 'byref' as 'outref' - | ty when isOutByrefTy denv.g ty && (match ty with TType_app (tc, _) when denv.g.outref_tcr.CanDeref && tyconRefEq denv.g tc denv.g.byref2_tcr -> true | _ -> false) -> + // Always prefer to format 'byref' as 'outref' + | ty when isOutByrefTy denv.g ty && (match ty with TType_app (tc, _, _) when denv.g.outref_tcr.CanDeref && tyconRefEq denv.g tc denv.g.byref2_tcr -> true | _ -> false) -> layoutTypeWithInfoAndPrec denv env prec (mkOutByrefTy denv.g (destByrefTy denv.g ty)) - // Always prefer to format 'byref' as 'byref' - | ty when isByrefTy denv.g ty && (match ty with TType_app (tc, _) when denv.g.byref_tcr.CanDeref && tyconRefEq denv.g tc denv.g.byref2_tcr -> true | _ -> false) -> + // Always prefer to format 'byref' as 'byref' + | ty when isByrefTy denv.g ty && (match ty with TType_app (tc, _, _) when denv.g.byref_tcr.CanDeref && tyconRefEq denv.g tc denv.g.byref2_tcr -> true | _ -> false) -> layoutTypeWithInfoAndPrec denv env prec (mkByrefTy denv.g (destByrefTy denv.g ty)) // Always prefer 'float' to 'float<1>' - | TType_app (tc, args) when tc.IsMeasureableReprTycon && List.forall (isDimensionless denv.g) args -> - layoutTypeWithInfoAndPrec denv env prec (reduceTyconRefMeasureableOrProvided denv.g tc args) + | TType_app (tc,args,nullness) when tc.IsMeasureableReprTycon && List.forall (isDimensionless denv.g) args -> + let part1 = layoutTypeWithInfoAndPrec denv env prec (reduceTyconRefMeasureableOrProvided denv.g tc args) + let part2 = layoutNullness part1 nullness + part2 // Layout a type application - | TType_app (tc, args) -> - layoutTypeAppWithInfoAndPrec denv env (layoutTyconRef denv tc) prec tc.IsPrefixDisplay args + | TType_app (tc,args, nullness) -> + let part1 = layoutTypeAppWithInfoAndPrec denv env (layoutTyconRef denv tc) prec tc.IsPrefixDisplay args + let part2 = layoutNullness part1 nullness + part2 | TType_ucase (UCRef(tc, _), args) -> layoutTypeAppWithInfoAndPrec denv env (layoutTyconRef denv tc) prec tc.IsPrefixDisplay args @@ -967,13 +979,19 @@ module private PrintTypes = | TType_fun _ -> let rec loop soFarL ty = match stripTyparEqns ty with - | TType_fun (dty, rty) -> loop (soFarL --- (layoutTypeWithInfoAndPrec denv env 4 dty ^^ wordL (tagPunctuation "->"))) rty + | TType_fun (dty, rty, nullness) -> + let part1 = soFarL --- (layoutTypeWithInfoAndPrec denv env 4 dty ^^ wordL (tagPunctuation "->")) + let part2 = loop part1 rty + let part3 = layoutNullness part2 nullness + part3 | rty -> soFarL --- layoutTypeWithInfoAndPrec denv env 5 rty bracketIfL (prec <= 4) (loop emptyL ty) // Layout a type variable . - | TType_var r -> - layoutTyparRefWithInfo denv env r + | TType_var (r, nullness) -> + let part1 = layoutTyparRefWithInfo denv env r + let part2 = layoutNullness part1 nullness + part2 | TType_measure unt -> layoutMeasure denv unt @@ -1398,7 +1416,7 @@ module InfoMemberPrinting = let prettyLayoutOfPropInfoFreeStyle g amap m denv (pinfo: PropInfo) = let rty = pinfo.GetPropertyType(amap, m) - let rty = if pinfo.IsIndexer then mkRefTupledTy g (pinfo.GetParamTypes(amap, m)) --> rty else rty + let rty = if pinfo.IsIndexer then mkFunTy g (mkRefTupledTy g (pinfo.GetParamTypes(amap, m))) rty else rty let rty, _ = PrettyTypes.PrettifyType g rty let tagProp = match pinfo.ArbitraryValRef with @@ -1647,7 +1665,7 @@ module private TastDefinitionPrinting = let layoutTycon (denv: DisplayEnv) (infoReader: InfoReader) ad m simplified typewordL (tycon: Tycon) = let g = denv.g - let _, ty = generalizeTyconRef (mkLocalTyconRef tycon) + let ty = generalizedTyOfTyconRef g (mkLocalTyconRef tycon) let start, name = let n = tycon.DisplayName if isStructTy g ty then Some "struct", tagStruct n @@ -2088,8 +2106,8 @@ let minimalStringsOfTwoTypes denv t1 t2= let denv = denv.SetOpenPaths [] let denv = { denv with includeStaticParametersInTypeNames=true } let makeName t = - let assemblyName = PrintTypes.layoutAssemblyName denv t |> function | null | "" -> "" | name -> sprintf " (%s)" name - sprintf "%s%s" (stringOfTy denv t1) assemblyName + let assemblyName = PrintTypes.layoutAssemblyName denv t |> function "" -> "" | name -> sprintf " (%s)" name + sprintf "%s%s" (stringOfTy denv t) assemblyName (makeName t1, makeName t2, stringOfTyparConstraints denv tpcs) diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs index 2eea2ef8db4..8a9762662fa 100644 --- a/src/fsharp/Optimizer.fs +++ b/src/fsharp/Optimizer.fs @@ -1811,8 +1811,8 @@ let TryDetectQueryQuoteAndRun cenv (expr: Expr) = let resultExprAfterConvertToResultTy = match reqdResultInfo, exprIsEnumerableInfo with | Some _, Some _ | None, None -> resultExpr // the expression is a QuerySource, the result is a QuerySource, nothing to do - | Some resultElemTy, None -> mkCallGetQuerySourceAsEnumerable cenv.g expr.Range resultElemTy (TType_app(cenv.g.tcref_System_Collections_IEnumerable, [])) resultExpr - | None, Some (resultElemTy, qTy) -> mkCallNewQuerySource cenv.g expr.Range resultElemTy qTy resultExpr + | Some resultElemTy, None -> mkCallGetQuerySourceAsEnumerable cenv.g expr.Range resultElemTy (TType_app(cenv.g.tcref_System_Collections_IEnumerable, [], g.knownWithoutNull)) resultExpr + | None, Some (resultElemTy, qTy) -> mkCallNewQuerySource cenv.g expr.Range resultElemTy qTy resultExpr Some resultExprAfterConvertToResultTy | None -> None @@ -1844,10 +1844,11 @@ let IsILMethodRefSystemStringConcatArray (ilg: ILGlobals) (mref: ILMethodRef) = /// Optimize/analyze an expression let rec OptimizeExpr cenv (env: IncrementalOptimizationEnv) expr = + let g = cenv.g // Eliminate subsumption coercions for functions. This must be done post-typechecking because we need // complete inference types. - let expr = NormalizeAndAdjustPossibleSubsumptionExprs cenv.g expr + let expr = NormalizeAndAdjustPossibleSubsumptionExprs g expr let expr = stripExpr expr @@ -1888,7 +1889,7 @@ let rec OptimizeExpr cenv (env: IncrementalOptimizationEnv) expr = | Expr.Lambda (_lambdaId, _, _, argvs, _body, m, rty) -> let topValInfo = ValReprInfo ([], [argvs |> List.map (fun _ -> ValReprInfo.unnamedTopArg1)], ValReprInfo.unnamedRetVal) - let ty = mkMultiLambdaTy m argvs rty + let ty = mkMultiLambdaTy cenv.g m argvs rty OptimizeLambdas None cenv env topValInfo expr ty | Expr.TyLambda (_lambdaId, tps, _body, _m, rty) -> @@ -1896,8 +1897,8 @@ let rec OptimizeExpr cenv (env: IncrementalOptimizationEnv) expr = let ty = mkForallTyIfNeeded tps rty OptimizeLambdas None cenv env topValInfo expr ty - | Expr.TyChoose _ -> - OptimizeExpr cenv env (TypeRelations.ChooseTyparSolutionsForFreeChoiceTypars cenv.g cenv.amap expr) + | Expr.TyChoose _ -> + OptimizeExpr cenv env (TypeRelations.ChooseTyparSolutionsForFreeChoiceTypars g cenv.amap expr) | Expr.Match (spMatch, exprm, dtree, targets, m, ty) -> OptimizeMatch cenv env (spMatch, exprm, dtree, targets, m, ty) @@ -2898,7 +2899,7 @@ and OptimizeLambdas (vspec: Val option) cenv env topValInfo e ety = let env = List.foldBack (BindInternalValsToUnknown cenv) vsl env let env = BindInternalValsToUnknown cenv (Option.toList baseValOpt) env let bodyR, bodyinfo = OptimizeExpr cenv env body - let exprR = mkMemberLambdas m tps ctorThisValOpt baseValOpt vsl (bodyR, bodyty) + let exprR = mkMemberLambdas cenv.g m tps ctorThisValOpt baseValOpt vsl (bodyR, bodyty) let arities = vsl.Length let arities = if isNil tps then arities else 1+arities let bsize = bodyinfo.TotalSize @@ -2939,7 +2940,7 @@ and OptimizeLambdas (vspec: Val option) cenv env topValInfo e ety = if fvs.UsesMethodLocalConstructs || fvs.FreeLocals.Contains baseVal then UnknownValue else - let expr2 = mkMemberLambdas m tps ctorThisValOpt None vsl (bodyR, bodyty) + let expr2 = mkMemberLambdas cenv.g m tps ctorThisValOpt None vsl (bodyR, bodyty) CurriedLambdaValue (lambdaId, arities, bsize, expr2, ety) @@ -3026,9 +3027,9 @@ and ConsiderSplitToMethod flag threshold cenv env (e, einfo) = match env.latestBoundId with | Some id -> id.idText+suffixForVariablesThatMayNotBeEliminated | None -> suffixForVariablesThatMayNotBeEliminated - let fv, fe = mkCompGenLocal m nm (cenv.g.unit_ty --> ty) + let fv, fe = mkCompGenLocal m nm (mkFunTy cenv.g cenv.g.unit_ty ty) mkInvisibleLet m fv (mkLambda m uv (e, ty)) - (primMkApp (fe, (cenv.g.unit_ty --> ty)) [] [mkUnit cenv.g m] m), + (primMkApp (fe, (mkFunTy cenv.g cenv.g.unit_ty ty)) [] [mkUnit cenv.g m] m), {einfo with FunctionSize=callSize } else e, einfo @@ -3152,6 +3153,7 @@ and OptimizeSwitchFallback cenv env (eR, einfo, cases, dflt, m) = and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) = try + let g = cenv.g // The aim here is to stop method splitting for direct-self-tailcalls. We do more than that: if an expression // occurs in the body of recursively defined values RVS, then we refuse to split @@ -3213,7 +3215,7 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) = if mbrTyconRef.TryDeref.IsSome then // Check if this is a subtype of MarshalByRefObject assert (cenv.g.system_MarshalByRefObject_ty.IsSome) - ExistsSameHeadTypeInHierarchy cenv.g cenv.amap vref.Range (generalizedTyconRef tcref) cenv.g.system_MarshalByRefObject_ty.Value + ExistsSameHeadTypeInHierarchy cenv.g cenv.amap vref.Range (generalizedTyOfTyconRef g tcref) cenv.g.system_MarshalByRefObject_ty.Value else false | ParentNone -> false) || diff --git a/src/fsharp/PatternMatchCompilation.fs b/src/fsharp/PatternMatchCompilation.fs index 41135afed53..5e07ebf5640 100644 --- a/src/fsharp/PatternMatchCompilation.fs +++ b/src/fsharp/PatternMatchCompilation.fs @@ -557,8 +557,7 @@ let (|ConstNeedsDefaultCase|_|) c = /// switches, string switches and floating point switches are treated in the /// same way as DecisionTreeTest.IsInst. let rec BuildSwitch inpExprOpt g expr edges dflt m = - if verbose then dprintf "--> BuildSwitch@%a, #edges = %A, dflt.IsSome = %A\n" outputRange m (List.length edges) (Option.isSome dflt) - match edges, dflt with + match edges, dflt with | [], None -> failwith "internal error: no edges and no default" | [], Some dflt -> dflt (* NOTE: first time around, edges<>[] *) @@ -783,16 +782,16 @@ let CompilePatternBasic // We throw instead of rethrow on unmatched try-catch in a computation expression. But why? // Because this isn't a real .NET exception filter/handler but just a function we're passing // to a computation expression builder to simulate one. - mkThrow matchm resultTy (exprForVal matchm origInputVal) - - | ThrowIncompleteMatchException -> - mkThrow matchm resultTy - (mkExnExpr(mk_MFCore_tcref g.fslibCcu "MatchFailureException", - [ mkString g matchm matchm.FileName - mkInt g matchm matchm.StartLine + mkThrow matchm resultTy (exprForVal matchm origInputVal) + + | ThrowIncompleteMatchException -> + mkThrow matchm resultTy + (mkExnExpr(g.MatchFailureException_tcr, + [ mkString g matchm matchm.FileName + mkInt g matchm matchm.StartLine mkInt g matchm matchm.StartColumn], matchm)) - | IgnoreWithWarning -> + | IgnoreWithWarning -> mkUnit g matchm // We don't emit a sequence point at any of the above cases because they don't correspond to diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs index ddbad8f09eb..49c64062fb4 100644 --- a/src/fsharp/PostInferenceChecks.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -302,7 +302,7 @@ let rec CheckTypeDeep (cenv: cenv) ((visitTy, visitTyconRefOpt, visitAppTyOpt, v // In an ideal world we would, instead, record the solutions to these constraints as "witness variables" in expressions, // rather than solely in types. match ty with - | TType_var tp when tp.Solution.IsSome -> + | TType_var (tp, _nullness) when tp.Solution.IsSome -> tp.Constraints |> List.iter (fun cx -> match cx with | TyparConstraint.MayResolveMember((TTrait(_, _, _, _, _, soln)), _) -> @@ -322,7 +322,7 @@ let rec CheckTypeDeep (cenv: cenv) ((visitTy, visitTyconRefOpt, visitAppTyOpt, v tps |> List.iter (fun tp -> tp.Constraints |> List.iter (CheckTypeConstraintDeep cenv f g env)) | TType_measure _ -> () - | TType_app (tcref, tinst) -> + | TType_app (tcref, tinst, _nullness) -> match visitTyconRefOpt with | Some visitTyconRef -> visitTyconRef isInner tcref | None -> () @@ -337,14 +337,15 @@ let rec CheckTypeDeep (cenv: cenv) ((visitTy, visitTyconRefOpt, visitAppTyOpt, v match visitAppTyOpt with | Some visitAppTy -> visitAppTy (tcref, tinst) | None -> () + | TType_anon (anonInfo, tys) -> RecordAnonRecdInfo cenv anonInfo CheckTypesDeep cenv f g env tys | TType_ucase (_, tinst) -> CheckTypesDeep cenv f g env tinst | TType_tuple (_, tys) -> CheckTypesDeep cenv f g env tys - | TType_fun (s, t) -> CheckTypeDeep cenv f g env true s; CheckTypeDeep cenv f g env true t - | TType_var tp -> + | TType_fun (s, t, _nullness) -> CheckTypeDeep cenv f g env true s; CheckTypeDeep cenv f g env true t + | TType_var (tp, _nullness) -> if not tp.IsSolved then match visitTyparOpt with | None -> () @@ -368,6 +369,7 @@ and CheckTypeConstraintDeep cenv f g env x = | TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _ | TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsUnmanaged _ | TyparConstraint.IsReferenceType _ @@ -1056,8 +1058,8 @@ and CheckExpr (cenv: cenv) (env: env) origExpr (context: PermitByRefExpr) : Limi CheckCall cenv env m returnTy argsl contexts context | Expr.Lambda (_, _ctorThisValOpt, _baseValOpt, argvs, _, m, rty) -> - let topValInfo = ValReprInfo ([], [argvs |> List.map (fun _ -> ValReprInfo.unnamedTopArg1)], ValReprInfo.unnamedRetVal) - let ty = mkMultiLambdaTy m argvs rty in + let topValInfo = ValReprInfo ([],[argvs |> List.map (fun _ -> ValReprInfo.unnamedTopArg1)],ValReprInfo.unnamedRetVal) + let ty = mkMultiLambdaTy cenv.g m argvs rty CheckLambdas false None cenv env false topValInfo false expr m ty PermitByRefExpr.Yes | Expr.TyLambda (_, tps, _, m, rty) -> @@ -1861,8 +1863,8 @@ let CheckModuleBinding cenv env (TBind(v, e, _) as bind) = if v.IsExtensionMember then tcref.ModuleOrNamespaceType.AllValsAndMembersByLogicalNameUncached.[v.LogicalName] |> List.iter (fun v2 -> if v2.IsExtensionMember && not (valEq v v2) && v.CompiledName = v2.CompiledName then - let minfo1 = FSMeth(g, generalizedTyconRef tcref, mkLocalValRef v, Some 0UL) - let minfo2 = FSMeth(g, generalizedTyconRef tcref, mkLocalValRef v2, Some 0UL) + let minfo1 = FSMeth(g, generalizedTyOfTyconRef g tcref, mkLocalValRef v, Some 0UL) + let minfo2 = FSMeth(g, generalizedTyOfTyconRef g tcref, mkLocalValRef v2, Some 0UL) if tyconRefEq g v.MemberApparentEntity v2.MemberApparentEntity && MethInfosEquivByNameAndSig EraseAll true g cenv.amap v.Range minfo1 minfo2 then errorR(Duplicate(kind, v.DisplayName, v.Range))) @@ -1922,7 +1924,7 @@ let CheckEntityDefn cenv env (tycon: Entity) = let g = cenv.g let m = tycon.Range let tcref = mkLocalTyconRef tycon - let ty = generalizedTyconRef tcref + let ty = generalizedTyOfTyconRef g tcref let env = { env with reflect = env.reflect || HasFSharpAttribute g g.attrib_ReflectedDefinitionAttribute tycon.Attribs } let env = BindTypars g env (tycon.Typars m) @@ -2199,15 +2201,37 @@ let CheckEntityDefn cenv env (tycon: Entity) = yield! AllSuperTypesOfType g cenv.amap m AllowMultiIntfInstantiations.Yes ty ] CheckMultipleInterfaceInstantiations cenv interfaces m - // Check struct fields. We check these late because we have to have first checked that the structs are + // Check fields. We check these late because we have to have first checked that the structs are // free of cycles - if tycon.IsStructOrEnumTycon then + if g.langFeatureNullness then for f in tycon.AllInstanceFieldsAsList do + let m = f.Range // Check if it's marked unsafe let zeroInitUnsafe = TryFindFSharpBoolAttribute g g.attrib_DefaultValueAttribute f.FieldAttribs if zeroInitUnsafe = Some true then - if not (TypeHasDefaultValue g m ty) then - errorR(Error(FSComp.SR.chkValueWithDefaultValueMustHaveDefaultValue(), m)) + let ty = f.FormalType + if not (TypeHasDefaultValueNew g m ty) && not (TypeHasDefaultValueOld g m ty) then + if tycon.IsStructOrEnumTycon then + // Under F# 4.5 we gave a hard error for this case so we can give it now + errorR(Error(FSComp.SR.chkValueWithDefaultValueMustHaveDefaultValue(), m)) + else + if g.checkNullness then + // Under F# 5.0 rules with checkNullness we can now give a warning for this case + warning(Error(FSComp.SR.chkValueWithDefaultValueMustHaveDefaultValue(), m)) + + elif g.checkNullness && not (TypeHasDefaultValueNew g m ty) then + // Under F# 5.0 rules with checkNullness we can now give a warning for this case + warning(Error(FSComp.SR.chkValueWithDefaultValueMustHaveDefaultValueNulls(), m)) + else + // These are the F# 4.5 rules, mistakenly only applied to structs + if tycon.IsStructOrEnumTycon then + for f in tycon.AllInstanceFieldsAsList do + let m = f.Range + // Check if it's marked unsafe + let zeroInitUnsafe = TryFindFSharpBoolAttribute g g.attrib_DefaultValueAttribute f.FieldAttribs + if zeroInitUnsafe = Some true then + if not (TypeHasDefaultValueOld g m ty) then + errorR(Error(FSComp.SR.chkValueWithDefaultValueMustHaveDefaultValue(), m)) // Check type abbreviations match tycon.TypeAbbrev with diff --git a/src/fsharp/QuotationTranslator.fs b/src/fsharp/QuotationTranslator.fs index ecbe10d5ad2..1e766addc27 100644 --- a/src/fsharp/QuotationTranslator.fs +++ b/src/fsharp/QuotationTranslator.fs @@ -206,7 +206,8 @@ let rec EmitDebugInfoIfNecessary cenv env m astExpr : QP.ExprData = and ConvExpr cenv env (expr : Expr) = EmitDebugInfoIfNecessary cenv env expr.Range (ConvExprCore cenv env expr) -and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP.ExprData = +and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP.ExprData = + let g = cenv.g let expr = DetectAndOptimizeForExpression cenv.g OptimizeIntRangesOnly expr @@ -221,12 +222,12 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. // Recognize applications of module functions. match expr with // Detect expression tree exprSplices - | Expr.App (InnerExprPat(Expr.Val (vf, _, _)), _, _, x0 :: rest, m) - when isSplice cenv.g vf -> + | Expr.App (InnerExprPat (Expr.Val (vf, _, _)), _, _, x0 :: rest, m) + when isSplice g vf -> let idx = cenv.exprSplices.Count - let ty = tyOfExpr cenv.g expr - - match (freeInExpr CollectTyparsAndLocalsNoCaching x0).FreeLocals |> Seq.tryPick (fun v -> if env.vs.ContainsVal v then Some v else None) with + let ty = tyOfExpr g expr + + match (freeInExpr CollectTyparsAndLocalsNoCaching x0).FreeLocals |> Seq.tryPick (fun v -> if env.vs.ContainsVal v then Some v else None) with | Some v -> errorR(Error(FSComp.SR.crefBoundVarUsedInSplice(v.DisplayName), v.Range)) | None -> () @@ -234,24 +235,24 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. let hole = QP.mkHole(ConvType cenv env m ty, idx) (hole, rest) ||> List.fold (fun fR arg -> QP.mkApp (fR, ConvExpr cenv env arg)) - | ModuleValueOrMemberUse cenv.g (vref, vFlags, _f, _fty, tyargs, curriedArgs) - when not (isSplice cenv.g vref) -> - let m = expr.Range + | ModuleValueOrMemberUse g (vref, vFlags, _f, _fty, tyargs, curriedArgs) + when not (isSplice g vref) -> + let m = expr.Range - let (numEnclTypeArgs, _, isNewObj, valUseFlags, isSelfInit, takesInstanceArg, isPropGet, isPropSet) = - GetMemberCallInfo cenv.g (vref, vFlags) + let (numEnclTypeArgs,_,isNewObj,valUseFlags,isSelfInit,takesInstanceArg,isPropGet,isPropSet) = + GetMemberCallInfo g (vref,vFlags) let isMember, tps, curriedArgInfos, retTy = match vref.MemberInfo with | Some _ when not vref.IsExtensionMember -> // This is an application of a member method // We only count one argument block for these. - let tps, curriedArgInfos, retTy, _ = GetTypeOfIntrinsicMemberInCompiledForm cenv.g vref + let tps, curriedArgInfos, retTy, _ = GetTypeOfIntrinsicMemberInCompiledForm g vref true, tps, curriedArgInfos, retTy - | _ -> + | _ -> // This is an application of a module value or extension member - let arities = arityOfVal vref.Deref - let tps, curriedArgInfos, retTy, _ = GetTopValTypeInCompiledForm cenv.g arities vref.Type m + let arities = arityOfVal vref.Deref + let tps, curriedArgInfos, retTy, _ = GetTopValTypeInCompiledForm g arities vref.Type m false, tps, curriedArgInfos, retTy // Compute the object arguments as they appear in a compiled call @@ -272,17 +273,17 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. ((List.truncate nCurriedArgInfos curriedArgs, curriedArgInfos) ||> List.exists2 (fun arg argInfo -> (argInfo.Length > (tryDestRefTupleExpr arg).Length))) then - if verboseCReflect then - dprintfn "vref.DisplayName = %A was under applied" vref.DisplayName - // Too few arguments or incorrect tupling? Convert to a lambda and beta-reduce the - // partially applied arguments to 'let' bindings - let topValInfo = - match vref.ValReprInfo with - | None -> error(InternalError("no arity information found for F# value " + vref.LogicalName, vref.Range)) - | Some a -> a - - let expr, exprty = AdjustValForExpectedArity cenv.g m vref vFlags topValInfo - ConvExpr cenv env (MakeApplicationAndBetaReduce cenv.g (expr, exprty, [tyargs], curriedArgs, m)) + if verboseCReflect then + dprintfn "vref.DisplayName = %A was under applied" vref.DisplayName + // Too few arguments or incorrect tupling? Convert to a lambda and beta-reduce the + // partially applied arguments to 'let' bindings + let topValInfo = + match vref.ValReprInfo with + | None -> error(InternalError("no arity information found for F# value " + vref.LogicalName,vref.Range)) + | Some a -> a + + let expr,exprty = AdjustValForExpectedArity g m vref vFlags topValInfo + ConvExpr cenv env (MakeApplicationAndBetaReduce g (expr,exprty,[tyargs],curriedArgs,m)) else // Too many arguments? Chop let (curriedArgs: Expr list ), laterArgs = List.splitAt nCurriedArgInfos curriedArgs @@ -339,10 +340,10 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. List.fold (fun fR arg -> QP.mkApp (fR, ConvExpr cenv env arg)) callR laterArgs - // Blast type application nodes and expression application nodes apart so values are left with just their type arguments - | Expr.App (f, fty, (_ :: _ as tyargs), (_ :: _ as args), m) -> - let rfty = applyForallTy cenv.g fty tyargs - ConvExpr cenv env (primMkApp (primMkApp (f, fty) tyargs [] m, rfty) [] args m) + // Blast type application nodes and expression application nodes apart so values are left with just their type arguments + | Expr.App (f, fty, (_ :: _ as tyargs),(_ :: _ as args), m) -> + let rfty = applyForallTy g fty tyargs + ConvExpr cenv env (primMkApp (primMkApp (f,fty) tyargs [] m, rfty) [] args m) // Uses of possibly-polymorphic values | Expr.App (InnerExprPat(Expr.Val (vref, _vFlags, m)), _fty, tyargs, [], _) -> @@ -374,17 +375,17 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. let bindsR = List.zip vsR (binds |> List.map (fun b -> ConvExpr cenv env b.Expr)) QP.mkLetRec(bindsR, bodyR) - | Expr.Lambda (_, _, _, vs, b, _, _) -> - let v, b = MultiLambdaToTupledLambda cenv.g vs b - let vR = ConvVal cenv env v - let bR = ConvExpr cenv (BindVal env v) b + | Expr.Lambda (_, _, _, vs, b, _, _) -> + let v,b = MultiLambdaToTupledLambda g vs b + let vR = ConvVal cenv env v + let bR = ConvExpr cenv (BindVal env v) b QP.mkLambda(vR, bR) | Expr.Quote (ast, _, _, _, ety) -> // F# 2.0-3.1 had a bug with nested 'raw' quotations. F# 4.0 + FSharp.Core 4.4.0.0+ allows us to do the right thing. if cenv.quotationFormat = QuotationSerializationFormat.FSharp_40_Plus && // Look for a 'raw' quotation - tyconRefEq cenv.g (tcrefOfAppTy cenv.g ety) cenv.g.raw_expr_tcr + tyconRefEq g (tcrefOfAppTy g ety) g.raw_expr_tcr then QP.mkQuoteRaw40(ConvExpr cenv env ast) else @@ -398,18 +399,25 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. ConvDecisionTree cenv env tgs typR dtree // initialization check - | Expr.Sequential (ObjectInitializationCheck cenv.g, x1, NormalSeq, _, _) -> ConvExpr cenv env x1 - | Expr.Sequential (x0, x1, NormalSeq, _, _) -> QP.mkSequential(ConvExpr cenv env x0, ConvExpr cenv env x1) - | Expr.Obj (_, ty, _, _, [TObjExprMethod(TSlotSig(_, ctyp, _, _, _, _), _, tps, [tmvs], e, _) as tmethod], _, m) when isDelegateTy cenv.g ty -> - let f = mkLambdas m tps tmvs (e, GetFSharpViewOfReturnType cenv.g (returnTyOfMethod cenv.g tmethod)) - let fR = ConvExpr cenv env f - let tyargR = ConvType cenv env m ctyp + | Expr.Sequential (ObjectInitializationCheck g, x1, NormalSeq, _, _) -> ConvExpr cenv env x1 + | Expr.Sequential (x0,x1,NormalSeq,_,_) -> QP.mkSequential(ConvExpr cenv env x0, ConvExpr cenv env x1) + | Expr.Obj (_, ty, _, _, [TObjExprMethod(TSlotSig(_, ctyp, _, _, _, _), _, tps, [tmvs], e, _) as tmethod],_,m) when isDelegateTy g ty -> + let f = mkLambdas g m tps tmvs (e,GetFSharpViewOfReturnType g (returnTyOfMethod g tmethod)) + let fR = ConvExpr cenv env f + let tyargR = ConvType cenv env m ctyp QP.mkDelegate(tyargR, fR) - | Expr.StaticOptimization (_, _, x, _) -> ConvExpr cenv env x - | Expr.TyChoose _ -> ConvExpr cenv env (TypeRelations.ChooseTyparSolutionsForFreeChoiceTypars cenv.g cenv.amap expr) - | Expr.Sequential (x0, x1, ThenDoSeq, _, _) -> QP.mkSequential(ConvExpr cenv env x0, ConvExpr cenv env x1) - | Expr.Obj (_lambdaId, _typ, _basev, _basecall, _overrides, _iimpls, m) -> wfail(Error(FSComp.SR.crefQuotationsCantContainObjExprs(), m)) + | Expr.StaticOptimization (_, _, x, _) -> + ConvExpr cenv env x + + | Expr.TyChoose _ -> + ConvExpr cenv env (TypeRelations.ChooseTyparSolutionsForFreeChoiceTypars g cenv.amap expr) + + | Expr.Sequential (x0, x1, ThenDoSeq, _, _) + -> QP.mkSequential(ConvExpr cenv env x0, ConvExpr cenv env x1) + + | Expr.Obj (_lambdaId, _typ, _basev, _basecall, _overrides, _iimpls, m) -> + wfail(Error(FSComp.SR.crefQuotationsCantContainObjExprs(),m)) | Expr.Op (op, tyargs, args, m) -> match op, tyargs, args with @@ -419,11 +427,10 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. let argsR = ConvExprs cenv env args QP.mkUnion(mkR, tyargsR, argsR) - - | TOp.Tuple tupInfo, tyargs, _ -> - let tyR = ConvType cenv env m (mkAnyTupledTy cenv.g tupInfo tyargs) + | TOp.Tuple tupInfo, tyargs, _ -> + let tyR = ConvType cenv env m (mkAnyTupledTy g tupInfo tyargs) let argsR = ConvExprs cenv env args - QP.mkTuple(tyR, argsR) // TODO: propagate to quotations + QP.mkTuple(tyR, argsR) | TOp.Recd (_, tcref), _, _ -> let rgtypR = ConvTyconRef cenv tcref m @@ -462,7 +469,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. | TOp.TupleFieldGet (tupInfo, n), tyargs, [e] -> let eR = ConvLValueExpr cenv env e - let tyR = ConvType cenv env m (mkAnyTupledTy cenv.g tupInfo tyargs) + let tyR = ConvType cenv env m (mkAnyTupledTy g tupInfo tyargs) QP.mkTupleGet(tyR, n, eR) | TOp.ILAsm (([ I_ldfld (_, _, fspec) ] @@ -477,14 +484,14 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. let argsR = ConvLValueArgs cenv env args QP.mkFieldSet( (parentTyconR, fspec.Name), tyargsR, argsR) - | TOp.ILAsm ([ AI_ceq ], _), _, [arg1;arg2] -> - let ty = tyOfExpr cenv.g arg1 - let eq = mkCallEqualsOperator cenv.g m ty arg1 arg2 + | TOp.ILAsm ([ AI_ceq ], _), _,[arg1; arg2] -> + let ty = tyOfExpr g arg1 + let eq = mkCallEqualsOperator g m ty arg1 arg2 ConvExpr cenv env eq - | TOp.ILAsm ([ I_throw ], _), _, [arg1] -> - let raiseExpr = mkCallRaise cenv.g m (tyOfExpr cenv.g expr) arg1 - ConvExpr cenv env raiseExpr + | TOp.ILAsm ([ I_throw ], _), _, [arg1] -> + let raiseExpr = mkCallRaise g m (tyOfExpr g expr) arg1 + ConvExpr cenv env raiseExpr | TOp.ILAsm (_il, _), _, _ -> wfail(Error(FSComp.SR.crefQuotationsCantContainInlineIL(), m)) @@ -500,7 +507,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. QP.mkCtorCall( { ctorParent = parentTyconR ctorArgTypes = methArgTypesR }, [], argsR) - let exnTypeR = ConvType cenv env m cenv.g.exn_ty + let exnTypeR = ConvType cenv env m g.exn_ty QP.mkCoerce(exnTypeR, objR) | TOp.ValFieldSet rfref, _tinst, args -> @@ -526,19 +533,19 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. let parentTyconR = ConvTyconRef cenv tcref m let propRetTypeR = ConvType cenv env m fspec.FormalType let callArgR = ConvExpr cenv env obj - let exnTypeR = ConvType cenv env m (generalizedTyconRef tcref) - QP.mkPropGet( (parentTyconR, fspec.Name, propRetTypeR, []), [], [QP.mkCoerce (exnTypeR, callArgR)]) + let exnTypeR = ConvType cenv env m (generalizedTyOfTyconRef g tcref) + QP.mkPropGet( (parentTyconR, fspec.Name,propRetTypeR, []), [], [QP.mkCoerce (exnTypeR, callArgR)]) | TOp.Coerce, [tgtTy;srcTy], [x] -> let xR = ConvExpr cenv env x - if typeEquiv cenv.g tgtTy srcTy then + if typeEquiv g tgtTy srcTy then xR else QP.mkCoerce(ConvType cenv env m tgtTy, xR) - | TOp.Reraise, [toTy], [] -> - // rebuild reraise() and Convert - mkReraiseLibCall cenv.g toTy m |> ConvExpr cenv env + | TOp.Reraise, [toTy], [] -> + // rebuild reraise() and Convert + mkReraiseLibCall g toTy m |> ConvExpr cenv env | TOp.LValueOp (LAddrOf _, vref), [], [] -> QP.mkAddressOf(ConvValRef false cenv env m vref []) @@ -548,9 +555,9 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. | TOp.LValueOp (LSet, vref), [], [e] -> // Sets of module values become property sets - match vref.DeclaringEntity with - | Parent tcref when IsCompiledAsStaticProperty cenv.g vref.Deref -> - let parentTyconR = ConvTyconRef cenv tcref m + match vref.DeclaringEntity with + | Parent tcref when IsCompiledAsStaticProperty g vref.Deref -> + let parentTyconR = ConvTyconRef cenv tcref m let propName = vref.CompiledName let propTy = ConvType cenv env m vref.Type QP.mkPropSet( (parentTyconR, propName, propTy, []), [], [ConvExpr cenv env e]) @@ -565,11 +572,11 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. | TOp.While _, [], [Expr.Lambda (_, _, _, [_], test, _, _);Expr.Lambda (_, _, _, [_], body, _, _)] -> QP.mkWhileLoop(ConvExpr cenv env test, ConvExpr cenv env body) - - | TOp.For (_, FSharpForLoopUp), [], [Expr.Lambda (_, _, _, [_], lim0, _, _); Expr.Lambda (_, _, _, [_], SimpleArrayLoopUpperBound, lm, _); SimpleArrayLoopBody cenv.g (arr, elemTy, body)] -> - let lim1 = - let len = mkCallArrayLength cenv.g lm elemTy arr // Array.length arr - mkCallSubtractionOperator cenv.g lm cenv.g.int32_ty len (Expr.Const (Const.Int32 1, m, cenv.g.int32_ty)) // len - 1 + + | TOp.For (_, FSharpForLoopUp), [], [Expr.Lambda (_, _, _, [_], lim0, _, _); Expr.Lambda (_, _, _, [_], SimpleArrayLoopUpperBound, lm, _); SimpleArrayLoopBody g (arr, elemTy, body)] -> + let lim1 = + let len = mkCallArrayLength g lm elemTy arr // Array.length arr + mkCallSubtractionOperator g lm g.int32_ty len (Expr.Const(Const.Int32 1, m, g.int32_ty)) // len - 1 QP.mkForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body) | TOp.For (_, dir), [], [Expr.Lambda (_, _, _, [_], lim0, _, _);Expr.Lambda (_, _, _, [_], lim1, _, _);body] -> @@ -598,23 +605,35 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. let envh = BindVal env vh QP.mkTryWith(ConvExpr cenv env e1, vfR, ConvExpr cenv envf ef, vhR, ConvExpr cenv envh eh) - | TOp.Bytes bytes, [], [] -> - ConvExpr cenv env (Expr.Op (TOp.Array, [cenv.g.byte_ty], List.ofArray (Array.map (mkByte cenv.g m) bytes), m)) + | TOp.Bytes bytes, [], [] -> + ConvExpr cenv env (Expr.Op(TOp.Array, [g.byte_ty], List.ofArray (Array.map (mkByte g m) bytes), m)) - | TOp.UInt16s arr, [], [] -> - ConvExpr cenv env (Expr.Op (TOp.Array, [cenv.g.uint16_ty], List.ofArray (Array.map (mkUInt16 cenv.g m) arr), m)) + | TOp.UInt16s arr, [], [] -> + ConvExpr cenv env (Expr.Op(TOp.Array, [g.uint16_ty], List.ofArray (Array.map (mkUInt16 g m) arr), m)) + + | TOp.UnionCaseProof _, _, [e] -> + ConvExpr cenv env e // Note: we erase the union case proof conversions when converting to quotations - | TOp.UnionCaseProof _, _, [e] -> ConvExpr cenv env e // Note: we erase the union case proof conversions when converting to quotations - | TOp.UnionCaseTagGet _tycr, _tinst, [_cx] -> wfail(Error(FSComp.SR.crefQuotationsCantFetchUnionIndexes(), m)) - | TOp.UnionCaseFieldSet (_c, _i), _tinst, [_cx;_x] -> wfail(Error(FSComp.SR.crefQuotationsCantSetUnionFields(), m)) - | TOp.ExnFieldSet (_tcref, _i), [], [_ex;_x] -> wfail(Error(FSComp.SR.crefQuotationsCantSetExceptionFields(), m)) - | TOp.RefAddrGet _, _, _ -> wfail(Error(FSComp.SR.crefQuotationsCantRequireByref(), m)) - | TOp.TraitCall (_ss), _, _ -> wfail(Error(FSComp.SR.crefQuotationsCantCallTraitMembers(), m)) - | _ -> - wfail(InternalError( "Unexpected expression shape", m)) + | TOp.UnionCaseTagGet _tycr, _tinst, [_cx] -> + wfail(Error(FSComp.SR.crefQuotationsCantFetchUnionIndexes(), m)) - | _ -> - wfail(InternalError(sprintf "unhandled construct in AST: %A" expr, expr.Range)) + | TOp.UnionCaseFieldSet (_c, _i), _tinst, [_cx; _x] -> + wfail(Error(FSComp.SR.crefQuotationsCantSetUnionFields(), m)) + + | TOp.ExnFieldSet(_tcref, _i), [], [_ex; _x] -> + wfail(Error(FSComp.SR.crefQuotationsCantSetExceptionFields(), m)) + + | TOp.RefAddrGet _, _, _ -> + wfail(Error(FSComp.SR.crefQuotationsCantRequireByref(), m)) + + | TOp.TraitCall (_ss), _, _ -> + wfail(Error(FSComp.SR.crefQuotationsCantCallTraitMembers(), m)) + + | _ -> + wfail(InternalError( "Unexpected expression shape",m)) + + | _ -> + wfail(InternalError(sprintf "unhandled construct in AST: %A" expr,expr.Range)) and ConvLdfld cenv env m (fspec: ILFieldSpec) enclTypeArgs args = let tyargsR = ConvTypes cenv env m enclTypeArgs @@ -682,22 +701,23 @@ and ConvLValueArgs cenv env args = and ConvLValueExpr cenv env expr = EmitDebugInfoIfNecessary cenv env expr.Range (ConvLValueExprCore cenv env expr) -// This function has to undo the work of mkExprAddrOfExpr -and ConvLValueExprCore cenv env expr = - match expr with - | Expr.Op (op, tyargs, args, m) -> +// This function has to undo the work of mkExprAddrOfExpr +and ConvLValueExprCore cenv env expr = + let g = cenv.g + match expr with + | Expr.Op(op, tyargs, args, m) -> match op, args, tyargs with - | TOp.LValueOp (LAddrOf _, vref), _, _ -> ConvValRef false cenv env m vref [] - | TOp.ValFieldGetAddr (rfref, _), _, _ -> ConvClassOrRecdFieldGet cenv env m rfref tyargs args - | TOp.UnionCaseFieldGetAddr (ucref, n, _), [e], _ -> ConvUnionFieldGet cenv env m ucref n tyargs e - | TOp.ILAsm ([ I_ldflda(fspec) ], _rtys), _, _ -> ConvLdfld cenv env m fspec tyargs args - | TOp.ILAsm ([ I_ldsflda(fspec) ], _rtys), _, _ -> ConvLdfld cenv env m fspec tyargs args - | TOp.ILAsm (([ I_ldelema(_ro, _isNativePtr, shape, _tyarg) ] ), _), (arr :: idxs), [elemty] -> - match shape.Rank, idxs with - | 1, [idx1] -> ConvExpr cenv env (mkCallArrayGet cenv.g m elemty arr idx1) - | 2, [idx1; idx2] -> ConvExpr cenv env (mkCallArray2DGet cenv.g m elemty arr idx1 idx2) - | 3, [idx1; idx2; idx3] -> ConvExpr cenv env (mkCallArray3DGet cenv.g m elemty arr idx1 idx2 idx3) - | 4, [idx1; idx2; idx3; idx4] -> ConvExpr cenv env (mkCallArray4DGet cenv.g m elemty arr idx1 idx2 idx3 idx4) + | TOp.LValueOp(LAddrOf _,vref),_,_ -> ConvValRef false cenv env m vref [] + | TOp.ValFieldGetAddr(rfref, _),_,_ -> ConvClassOrRecdFieldGet cenv env m rfref tyargs args + | TOp.UnionCaseFieldGetAddr(ucref, n, _), [e], _ -> ConvUnionFieldGet cenv env m ucref n tyargs e + | TOp.ILAsm([ I_ldflda(fspec) ], _rtys), _, _ -> ConvLdfld cenv env m fspec tyargs args + | TOp.ILAsm([ I_ldsflda(fspec) ], _rtys), _, _ -> ConvLdfld cenv env m fspec tyargs args + | TOp.ILAsm(([ I_ldelema(_ro, _isNativePtr, shape, _tyarg) ] ), _), (arr::idxs), [elemty] -> + match shape.Rank, idxs with + | 1, [idx1] -> ConvExpr cenv env (mkCallArrayGet g m elemty arr idx1) + | 2, [idx1; idx2] -> ConvExpr cenv env (mkCallArray2DGet g m elemty arr idx1 idx2) + | 3, [idx1; idx2; idx3] -> ConvExpr cenv env (mkCallArray3DGet g m elemty arr idx1 idx2 idx3) + | 4, [idx1; idx2; idx3; idx4] -> ConvExpr cenv env (mkCallArray4DGet g m elemty arr idx1 idx2 idx3 idx4) | _ -> ConvExpr cenv env expr | _ -> ConvExpr cenv env expr | _ -> ConvExpr cenv env expr @@ -736,12 +756,13 @@ and ConvModuleValueApp cenv env m (vref: ValRef) tyargs (args: Expr list list) = EmitDebugInfoIfNecessary cenv env m (ConvModuleValueAppCore cenv env m vref tyargs args) and ConvModuleValueAppCore cenv env m (vref: ValRef) tyargs (args: Expr list list) = - match vref.DeclaringEntity with + let g = cenv.g + match vref.DeclaringEntity with | ParentNone -> failwith "ConvModuleValueApp" - | Parent(tcref) -> - let isProperty = IsCompiledAsStaticProperty cenv.g vref.Deref - let tcrefR = ConvTyconRef cenv tcref m - let tyargsR = ConvTypes cenv env m tyargs + | Parent tcref -> + let isProperty = IsCompiledAsStaticProperty g vref.Deref + let tcrefR = ConvTyconRef cenv tcref m + let tyargsR = ConvTypes cenv env m tyargs let nm = vref.CompiledName let argsR = List.map (ConvExprs cenv env) args QP.mkModuleValueApp(tcrefR, nm, isProperty, tyargsR, argsR) @@ -753,11 +774,12 @@ and ConvValRef holeOk cenv env m (vref: ValRef) tyargs = EmitDebugInfoIfNecessary cenv env m (ConvValRefCore holeOk cenv env m vref tyargs) and private ConvValRefCore holeOk cenv env m (vref: ValRef) tyargs = + let g = cenv.g let v = vref.Deref - if env.isinstVals.ContainsVal v then + if env.isinstVals.ContainsVal v then let (ty, e) = env.isinstVals.[v] - ConvExpr cenv env (mkCallUnbox cenv.g m ty e) - elif env.substVals.ContainsVal v then + ConvExpr cenv env (mkCallUnbox g m ty e) + elif env.substVals.ContainsVal v then let e = env.substVals.[v] ConvExpr cenv env e elif env.vs.ContainsVal v then @@ -771,19 +793,20 @@ and private ConvValRefCore holeOk cenv env m (vref: ValRef) tyargs = | ParentNone -> // References to local values are embedded by value if not holeOk then wfail(Error(FSComp.SR.crefNoSetOfHole(), m)) - let idx = cenv.exprSplices.Count - cenv.exprSplices.Add((mkCallLiftValueWithName cenv.g m vty v.LogicalName (exprForValRef m vref), m)) + let idx = cenv.exprSplices.Count + cenv.exprSplices.Add((mkCallLiftValueWithName g m vty v.LogicalName (exprForValRef m vref), m)) QP.mkHole(ConvType cenv env m vty, idx) - | Parent _ -> + | Parent _ -> ConvModuleValueApp cenv env m vref tyargs [] and ConvUnionCaseRef cenv (ucref: UnionCaseRef) m = + let g = cenv.g let ucgtypR = ConvTyconRef cenv ucref.TyconRef m - let nm = - if cenv.g.unionCaseRefEq ucref cenv.g.cons_ucref then "Cons" - elif cenv.g.unionCaseRefEq ucref cenv.g.nil_ucref then "Empty" - else ucref.CaseName - (ucgtypR, nm) + let nm = + if g.unionCaseRefEq ucref g.cons_ucref then "Cons" + elif g.unionCaseRefEq ucref g.nil_ucref then "Empty" + else ucref.CaseName + (ucgtypR, nm) and ConvRecdFieldRef cenv (rfref: RecdFieldRef) m = let typR = ConvTyconRef cenv rfref.TyconRef m @@ -813,12 +836,13 @@ and FilterMeasureTyargs tys = tys |> List.filter (fun ty -> match ty with TType_measure _ -> false | _ -> true) and ConvType cenv env m ty = - match stripTyEqnsAndMeasureEqns cenv.g ty with - | TType_app(tcref, [tyarg]) when isArrayTyconRef cenv.g tcref -> - QP.mkArrayTy(rankOfArrayTyconRef cenv.g tcref, ConvType cenv env m tyarg) + let g = cenv.g + match stripTyEqnsAndMeasureEqns g ty with + | TType_app(tcref, [tyarg],_) when isArrayTyconRef g tcref -> + QP.mkArrayTy(rankOfArrayTyconRef g tcref, ConvType cenv env m tyarg) | TType_ucase(UCRef(tcref, _), tyargs) // Note: we erase union case 'types' when converting to quotations - | TType_app(tcref, tyargs) -> + | TType_app(tcref, tyargs, _) -> #if !NO_EXTENSIONTYPING match TryElimErasableTyconRef cenv m tcref with | Some baseTy -> ConvType cenv env m baseTy @@ -826,13 +850,15 @@ and ConvType cenv env m ty = #endif QP.mkILNamedTy(ConvTyconRef cenv tcref m, ConvTypes cenv env m tyargs) - | TType_fun(a, b) -> QP.mkFunTy(ConvType cenv env m a, ConvType cenv env m b) - | TType_tuple(tupInfo, l) -> ConvType cenv env m (mkCompiledTupleTy cenv.g (evalTupInfoIsStruct tupInfo) l) - | TType_anon(anonInfo, tinst) -> + | TType_fun(a, b, _nullness) -> + QP.mkFunTy(ConvType cenv env m a, ConvType cenv env m b) + | TType_tuple(tupInfo, l) -> + ConvType cenv env m (mkCompiledTupleTy cenv.g (evalTupInfoIsStruct tupInfo) l) + | TType_anon(anonInfo, tinst) -> let tref = anonInfo.ILTypeRef let tinstR = ConvTypes cenv env m tinst QP.mkILNamedTy(ConvILTypeRefUnadjusted cenv m tref, tinstR) - | TType_var(tp) -> QP.mkVarTy(ConvTyparRef cenv env m tp) + | TType_var(tp, _nullness) -> QP.mkVarTy(ConvTyparRef cenv env m tp) | TType_forall(_spec, _ty) -> wfail(Error(FSComp.SR.crefNoInnerGenericsInQuotations(), m)) | _ -> wfail(Error (FSComp.SR.crefQuotationsCantContainThisType(), m)) @@ -840,7 +866,8 @@ and ConvTypes cenv env m tys = List.map (ConvType cenv env m) (FilterMeasureTyargs tys) and ConvConst cenv env m c ty = - match TryEliminateDesugaredConstants cenv.g m c with + let g = cenv.g + match TryEliminateDesugaredConstants g m c with | Some e -> ConvExpr cenv env e | None -> let tyR = ConvType cenv env m ty @@ -859,20 +886,21 @@ and ConvConst cenv env m c ty = | Const.String s -> QP.mkString (s, tyR) | Const.Char c -> QP.mkChar (c, tyR) | Const.Unit -> QP.mkUnit() - | Const.Zero -> - if isRefTy cenv.g ty then + | Const.Zero -> + if isRefTy g ty then QP.mkNull tyR else QP.mkDefaultValue tyR | _ -> wfail(Error (FSComp.SR.crefQuotationsCantContainThisConstant(), m)) -and ConvDecisionTree cenv env tgs typR x = - match x with - | TDSwitch(e1, csl, dfltOpt, m) -> - let acc = - match dfltOpt with - | Some d -> ConvDecisionTree cenv env tgs typR d +and ConvDecisionTree cenv env tgs typR x = + let g = cenv.g + match x with + | TDSwitch(e1, csl, dfltOpt, m) -> + let acc = + match dfltOpt with + | Some d -> ConvDecisionTree cenv env tgs typR d | None -> wfail(Error(FSComp.SR.crefQuotationsCantContainThisPatternMatch(), m)) let converted = @@ -894,10 +922,10 @@ and ConvDecisionTree cenv env tgs typR x = // Note, reverse the branches QP.mkCond (e1R, acc, ConvDecisionTree cenv env tgs typR dtree) - | DecisionTreeTest.Const c -> - let ty = tyOfExpr cenv.g e1 - let eq = mkCallEqualsOperator cenv.g m ty e1 (Expr.Const (c, m, ty)) - let eqR = ConvExpr cenv env eq + | DecisionTreeTest.Const c -> + let ty = tyOfExpr g e1 + let eq = mkCallEqualsOperator g m ty e1 (Expr.Const (c, m, ty)) + let eqR = ConvExpr cenv env eq QP.mkCond (eqR, ConvDecisionTree cenv env tgs typR dtree, acc) | DecisionTreeTest.IsNull -> @@ -909,10 +937,10 @@ and ConvDecisionTree cenv env tgs typR x = let eR = ConvExpr cenv env e // note: reverse the branches - a null test is a failure of an isinst test QP.mkCond (QP.mkTypeTest (tyR, eR), acc, ConvDecisionTree cenv env tgs typR dtree) - | _ -> - let ty = tyOfExpr cenv.g e1 - let eq = mkCallEqualsOperator cenv.g m ty e1 (Expr.Const (Const.Zero, m, ty)) - let eqR = ConvExpr cenv env eq + | _ -> + let ty = tyOfExpr g e1 + let eq = mkCallEqualsOperator g m ty e1 (Expr.Const (Const.Zero, m, ty)) + let eqR = ConvExpr cenv env eq QP.mkCond (eqR, ConvDecisionTree cenv env tgs typR dtree, acc) | DecisionTreeTest.IsInst (_srcty, tgty) -> @@ -945,12 +973,15 @@ and ConvDecisionTree cenv env tgs typR x = // Check if this is an provider-generated assembly that will be statically linked and IsILTypeRefStaticLinkLocal cenv m (tr: ILTypeRef) = - ignore cenv; ignore m - match tr.Scope with -#if !NO_EXTENSIONTYPING - | ILScopeRef.Assembly aref - when not cenv.g.isInteractive && - aref.Name <> cenv.g.ilg.primaryAssemblyName && // optimization to avoid this check in the common case +#if NO_EXTENSIONTYPING + ignore m; ignore cenv; ignore tr + false +#else + let g = cenv.g + match tr.Scope with + | ILScopeRef.Assembly aref + when not g.isInteractive && + aref.Name <> g.ilg.primaryAssemblyName && // optimization to avoid this check in the common case // Explanation: This represents an unchecked invariant in the hosted compiler: that any operations // which import types (and resolve assemblies from the tcImports tables) happen on the compilation thread. @@ -960,8 +991,8 @@ and IsILTypeRefStaticLinkLocal cenv m (tr: ILTypeRef) = | ResolvedCcu ccu -> ccu.IsProviderGenerated | UnresolvedCcu _ -> false) -> true -#endif | _ -> false +#endif // Adjust for static linking information, then convert and ConvILTypeRefUnadjusted cenv m (tr: ILTypeRef) = @@ -991,8 +1022,10 @@ and ConvILTypeRef cenv (tr: ILTypeRef) = | _ -> tr.Scope.QualifiedName QP.Named(tr.BasicQualifiedName, assemblyRef) - -and ConvVoidType cenv m = QP.mkILNamedTy(ConvTyconRef cenv cenv.g.system_Void_tcref m, []) + +and ConvVoidType cenv m = + let g = cenv.g + QP.mkILNamedTy(ConvTyconRef cenv g.system_Void_tcref m, []) and ConvILType cenv env m ty = match ty with diff --git a/src/fsharp/SignatureConformance.fs b/src/fsharp/SignatureConformance.fs index 6ba6dad410c..b469f657ca8 100644 --- a/src/fsharp/SignatureConformance.fs +++ b/src/fsharp/SignatureConformance.fs @@ -213,8 +213,8 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = false else - let aNull2 = TypeNullIsExtraValue g m (generalizedTyconRef (mkLocalTyconRef implTycon)) - let fNull2 = TypeNullIsExtraValue g m (generalizedTyconRef (mkLocalTyconRef implTycon)) + let aNull2 = TypeNullIsExtraValueOld g m (generalizedTyOfTyconRef g (mkLocalTyconRef implTycon)) + let fNull2 = TypeNullIsExtraValueOld g m (generalizedTyOfTyconRef g (mkLocalTyconRef sigTycon)) if aNull2 && not fNull2 then errorR(Error(FSComp.SR.DefinitionsInSigAndImplNotCompatibleImplementationSaysNull2(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName), m)) false @@ -223,8 +223,8 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = false else - let aSealed = isSealedTy g (generalizedTyconRef (mkLocalTyconRef implTycon)) - let fSealed = isSealedTy g (generalizedTyconRef (mkLocalTyconRef sigTycon)) + let aSealed = isSealedTy g (generalizedTyOfTyconRef g (mkLocalTyconRef implTycon)) + let fSealed = isSealedTy g (generalizedTyOfTyconRef g (mkLocalTyconRef sigTycon)) if aSealed && not fSealed then errorR(Error(FSComp.SR.DefinitionsInSigAndImplNotCompatibleImplementationSealed(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName), m)) false diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 4743ff03dfc..19c4f9fd9e0 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -163,10 +163,13 @@ let generalizeTypars tps = List.map generalizeTypar tps let rec remapTypeAux (tyenv: Remap) (ty: TType) = let ty = stripTyparEqns ty match ty with - | TType_var tp as ty -> instTyparRef tyenv.tpinst ty tp - | TType_app (tcref, tinst) as ty -> + | TType_var (tp, nullness) as ty -> + let res = instTyparRef tyenv.tpinst ty tp + addNullnessToTy nullness res + + | TType_app (tcref, tinst, nullness) as ty -> match tyenv.tyconRefRemap.TryFind tcref with - | Some tcref' -> TType_app (tcref', remapTypesAux tyenv tinst) + | Some tcref' -> TType_app (tcref', remapTypesAux tyenv tinst, nullness) | None -> match tinst with | [] -> ty // optimization to avoid re-allocation of TType_app node in the common case @@ -174,7 +177,7 @@ let rec remapTypeAux (tyenv: Remap) (ty: TType) = // avoid reallocation on idempotent let tinst' = remapTypesAux tyenv tinst if tinst === tinst' then ty else - TType_app (tcref, tinst') + TType_app (tcref, tinst', nullness) | TType_ucase (UCRef(tcref, n), tinst) -> match tyenv.tyconRefRemap.TryFind tcref with @@ -193,11 +196,11 @@ let rec remapTypeAux (tyenv: Remap) (ty: TType) = if tupInfo === tupInfo' && l === l' then ty else TType_tuple (tupInfo', l') - | TType_fun (d, r) as ty -> + | TType_fun (d, r, nullness) as ty -> let d' = remapTypeAux tyenv d let r' = remapTypeAux tyenv r if d === d' && r === r' then ty else - TType_fun (d', r') + TType_fun (d', r', nullness) | TType_forall (tps, ty) -> let tps', tyenv = copyAndRemapAndBindTypars tyenv tps @@ -250,6 +253,7 @@ and remapTyparConstraintsAux tyenv cs = | TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _ | TyparConstraint.IsUnmanaged _ | TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsReferenceType _ @@ -570,21 +574,21 @@ let tryNormalizeMeasureInType g ty = let mkNativePtrTy (g: TcGlobals) ty = assert g.nativeptr_tcr.CanDeref // this should always be available, but check anyway - TType_app (g.nativeptr_tcr, [ty]) + TType_app (g.nativeptr_tcr, [ty], g.knownWithoutNull) let mkByrefTy (g: TcGlobals) ty = assert g.byref_tcr.CanDeref // this should always be available, but check anyway - TType_app (g.byref_tcr, [ty]) + TType_app (g.byref_tcr, [ty], g.knownWithoutNull) let mkInByrefTy (g: TcGlobals) ty = if g.inref_tcr.CanDeref then // If not using sufficient FSharp.Core, then inref = byref, see RFC FS-1053.md - TType_app (g.inref_tcr, [ty]) + TType_app (g.inref_tcr, [ty], g.knownWithoutNull) else mkByrefTy g ty let mkOutByrefTy (g: TcGlobals) ty = if g.outref_tcr.CanDeref then // If not using sufficient FSharp.Core, then outref = byref, see RFC FS-1053.md - TType_app (g.outref_tcr, [ty]) + TType_app (g.outref_tcr, [ty], g.knownWithoutNull) else mkByrefTy g ty @@ -596,24 +600,24 @@ let mkByrefTyWithFlag g readonly ty = let mkByref2Ty (g: TcGlobals) ty1 ty2 = assert g.byref2_tcr.CanDeref // check we are using sufficient FSharp.Core, caller should check this - TType_app (g.byref2_tcr, [ty1; ty2]) + TType_app (g.byref2_tcr, [ty1; ty2], g.knownWithoutNull) let mkVoidPtrTy (g: TcGlobals) = - assert g.voidptr_tcr.CanDeref // check we are using sufficient FSharp.Core, caller should check this - TType_app (g.voidptr_tcr, []) + assert g.voidptr_tcr.CanDeref // check we are using sufficient FSharp.Core , caller should check this + TType_app (g.voidptr_tcr, [], g.knownWithoutNull) let mkByrefTyWithInference (g: TcGlobals) ty1 ty2 = if g.byref2_tcr.CanDeref then // If not using sufficient FSharp.Core, then inref = byref, see RFC FS-1053.md - TType_app (g.byref2_tcr, [ty1; ty2]) + TType_app (g.byref2_tcr, [ty1; ty2], g.knownWithoutNull) else - TType_app (g.byref_tcr, [ty1]) + TType_app (g.byref_tcr, [ty1], g.knownWithoutNull) -let mkArrayTy (g: TcGlobals) rank ty m = +let mkArrayTy (g: TcGlobals) rank nullness ty m = if rank < 1 || rank > 32 then errorR(Error(FSComp.SR.tastopsMaxArrayThirtyTwo rank, m)) - TType_app (g.il_arr_tcr_map.[3], [ty]) + TType_app (g.il_arr_tcr_map.[3], [ty], nullness) else - TType_app (g.il_arr_tcr_map.[rank - 1], [ty]) + TType_app (g.il_arr_tcr_map.[rank - 1], [ty], nullness) //-------------------------------------------------------------------------- // Tuple compilation (types) @@ -655,16 +659,16 @@ let mkCompiledTupleTyconRef (g: TcGlobals) isStruct n = let rec mkCompiledTupleTy g isStruct tupElemTys = let n = List.length tupElemTys if n < maxTuple then - TType_app (mkCompiledTupleTyconRef g isStruct n, tupElemTys) + TType_app (mkCompiledTupleTyconRef g isStruct n, tupElemTys, g.knownWithoutNull) else let tysA, tysB = List.splitAfter goodTupleFields tupElemTys - TType_app ((if isStruct then g.struct_tuple8_tcr else g.ref_tuple8_tcr), tysA@[mkCompiledTupleTy g isStruct tysB]) + TType_app ((if isStruct then g.struct_tuple8_tcr else g.ref_tuple8_tcr), tysA@[mkCompiledTupleTy g isStruct tysB], g.knownWithoutNull) /// Convert from F# tuple types to .NET tuple types, but only the outermost level let mkOuterCompiledTupleTy g isStruct tupElemTys = let n = List.length tupElemTys if n < maxTuple then - TType_app (mkCompiledTupleTyconRef g isStruct n, tupElemTys) + TType_app (mkCompiledTupleTyconRef g isStruct n, tupElemTys, g.knownWithoutNull) else let tysA, tysB = List.splitAfter goodTupleFields tupElemTys let tcref = (if isStruct then g.struct_tuple8_tcr else g.ref_tuple8_tcr) @@ -672,10 +676,10 @@ let mkOuterCompiledTupleTy g isStruct tupElemTys = // as a regular F# tuple type. match tysB with | [ tyB ] -> - let marker = TType_app (mkCompiledTupleTyconRef g isStruct 1, [tyB]) - TType_app (tcref, tysA@[marker]) + let marker = TType_app (mkCompiledTupleTyconRef g isStruct 1, [tyB], g.knownWithoutNull) + TType_app (tcref, tysA@[marker], g.knownWithoutNull) | _ -> - TType_app (tcref, tysA@[TType_tuple (mkTupInfo isStruct, tysB)]) + TType_app (tcref, tysA@[TType_tuple (mkTupInfo isStruct, tysB)], g.knownWithoutNull) //--------------------------------------------------------------------------- // Remove inference equations and abbreviations from types @@ -712,25 +716,29 @@ let reduceTyconRefMeasureableOrProvided (g: TcGlobals) (tcref: TyconRef) tyargs reduceTyconMeasureableOrProvided g tcref.Deref tyargs let rec stripTyEqnsA g canShortcut ty = - let ty = stripTyparEqnsAux canShortcut ty + let ty = stripTyparEqnsAux KnownWithoutNull canShortcut ty match ty with - | TType_app (tcref, tinst) -> + | TType_app (tcref, tinst, nullness) -> let tycon = tcref.Deref match tycon.TypeAbbrev with | Some abbrevTy -> - stripTyEqnsA g canShortcut (applyTyconAbbrev abbrevTy tycon tinst) + let reducedTy = applyTyconAbbrev abbrevTy tycon tinst + let reducedTy2 = addNullnessToTy nullness reducedTy + stripTyEqnsA g canShortcut reducedTy2 | None -> // This is the point where we get to add additional coditional normalizing equations // into the type system. Such power! // // Add the equation byref<'T> = byref<'T, ByRefKinds.InOut> for when using sufficient FSharp.Core // See RFC FS-1053.md - if tyconRefEq g tcref g.byref_tcr && g.byref2_tcr.CanDeref && g.byrefkind_InOut_tcr.CanDeref then - mkByref2Ty g tinst.[0] (TType_app(g.byrefkind_InOut_tcr, [])) + if tyconRefEq g tcref g.byref_tcr && g.byref2_tcr.CanDeref && g.byrefkind_InOut_tcr.CanDeref then + mkByref2Ty g tinst.[0] (TType_app(g.byrefkind_InOut_tcr, [], g.knownWithoutNull)) // Add the equation double<1> = double for units of measure. elif tycon.IsMeasureableReprTycon && List.forall (isDimensionless g) tinst then - stripTyEqnsA g canShortcut (reduceTyconMeasureableOrProvided g tycon tinst) + let reducedTy = reduceTyconMeasureableOrProvided g tycon tinst + let reducedTy2 = addNullnessToTy nullness reducedTy + stripTyEqnsA g canShortcut reducedTy2 else ty | ty -> ty @@ -751,15 +759,17 @@ let evalAnonInfoIsStruct (anonInfo: AnonRecdTypeInfo) = let rec stripTyEqnsAndErase eraseFuncAndTuple (g: TcGlobals) ty = let ty = stripTyEqns g ty match ty with - | TType_app (tcref, args) -> + | TType_app (tcref, args, nullness) -> let tycon = tcref.Deref - if tycon.IsErased then - stripTyEqnsAndErase eraseFuncAndTuple g (reduceTyconMeasureableOrProvided g tycon args) + if tycon.IsErased then + let reducedTy = reduceTyconMeasureableOrProvided g tycon args + let reducedTy2 = addNullnessToTy nullness reducedTy + stripTyEqnsAndErase eraseFuncAndTuple g reducedTy2 elif tyconRefEq g tcref g.nativeptr_tcr && eraseFuncAndTuple then stripTyEqnsAndErase eraseFuncAndTuple g g.nativeint_ty else ty - | TType_fun(a, b) when eraseFuncAndTuple -> TType_app(g.fastFunc_tcr, [ a; b]) + | TType_fun(a, b, nullness) when eraseFuncAndTuple -> TType_app(g.fastFunc_tcr, [ a; b], nullness) | TType_tuple(tupInfo, l) when eraseFuncAndTuple -> mkCompiledTupleTy g (evalTupInfoIsStruct tupInfo) l | ty -> ty @@ -781,12 +791,12 @@ let rec stripExnEqns (eref: TyconRef) = | _ -> exnc let primDestForallTy g ty = ty |> stripTyEqns g |> (function TType_forall (tyvs, tau) -> (tyvs, tau) | _ -> failwith "primDestForallTy: not a forall type") -let destFunTy g ty = ty |> stripTyEqns g |> (function TType_fun (tyv, tau) -> (tyv, tau) | _ -> failwith "destFunTy: not a function type") +let destFunTy g ty = ty |> stripTyEqns g |> (function TType_fun (tyv, tau, _nullness) -> (tyv, tau) | _ -> failwith "destFunTy: not a function type") let destAnyTupleTy g ty = ty |> stripTyEqns g |> (function TType_tuple (tupInfo, l) -> tupInfo, l | _ -> failwith "destAnyTupleTy: not a tuple type") let destRefTupleTy g ty = ty |> stripTyEqns g |> (function TType_tuple (tupInfo, l) when not (evalTupInfoIsStruct tupInfo) -> l | _ -> failwith "destRefTupleTy: not a reference tuple type") let destStructTupleTy g ty = ty |> stripTyEqns g |> (function TType_tuple (tupInfo, l) when evalTupInfoIsStruct tupInfo -> l | _ -> failwith "destStructTupleTy: not a struct tuple type") -let destTyparTy g ty = ty |> stripTyEqns g |> (function TType_var v -> v | _ -> failwith "destTyparTy: not a typar type") -let destAnyParTy g ty = ty |> stripTyEqns g |> (function TType_var v -> v | TType_measure unt -> destUnitParMeasure g unt | _ -> failwith "destAnyParTy: not a typar or unpar type") +let destTyparTy g ty = ty |> stripTyEqns g |> (function TType_var (v, _nullness) -> v | _ -> failwith "destTyparTy: not a typar type") +let destAnyParTy g ty = ty |> stripTyEqns g |> (function TType_var (v, _nullness) -> v | TType_measure unt -> destUnitParMeasure g unt | _ -> failwith "destAnyParTy: not a typar or unpar type") let destMeasureTy g ty = ty |> stripTyEqns g |> (function TType_measure m -> m | _ -> failwith "destMeasureTy: not a unit-of-measure type") let isFunTy g ty = ty |> stripTyEqns g |> (function TType_fun _ -> true | _ -> false) let isForallTy g ty = ty |> stripTyEqns g |> (function TType_forall _ -> true | _ -> false) @@ -795,48 +805,48 @@ let isRefTupleTy g ty = ty |> stripTyEqns g |> (function TType_tuple (tupInfo, _ let isStructTupleTy g ty = ty |> stripTyEqns g |> (function TType_tuple (tupInfo, _) -> evalTupInfoIsStruct tupInfo | _ -> false) let isAnonRecdTy g ty = ty |> stripTyEqns g |> (function TType_anon _ -> true | _ -> false) let isStructAnonRecdTy g ty = ty |> stripTyEqns g |> (function TType_anon (anonInfo, _) -> evalAnonInfoIsStruct anonInfo | _ -> false) -let isUnionTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tcref.IsUnionTycon | _ -> false) -let isReprHiddenTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tcref.IsHiddenReprTycon | _ -> false) -let isFSharpObjModelTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tcref.IsFSharpObjectModelTycon | _ -> false) -let isRecdTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tcref.IsRecordTycon | _ -> false) -let isFSharpStructOrEnumTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tcref.IsFSharpStructOrEnumTycon | _ -> false) -let isFSharpEnumTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tcref.IsFSharpEnumTycon | _ -> false) +let isUnionTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tcref.IsUnionTycon | _ -> false) +let isReprHiddenTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tcref.IsHiddenReprTycon | _ -> false) +let isFSharpObjModelTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tcref.IsFSharpObjectModelTycon | _ -> false) +let isRecdTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tcref.IsRecordTycon | _ -> false) +let isFSharpStructOrEnumTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tcref.IsFSharpStructOrEnumTycon | _ -> false) +let isFSharpEnumTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tcref.IsFSharpEnumTycon | _ -> false) let isTyparTy g ty = ty |> stripTyEqns g |> (function TType_var _ -> true | _ -> false) let isAnyParTy g ty = ty |> stripTyEqns g |> (function TType_var _ -> true | TType_measure unt -> isUnitParMeasure g unt | _ -> false) let isMeasureTy g ty = ty |> stripTyEqns g |> (function TType_measure _ -> true | _ -> false) - let isProvenUnionCaseTy ty = match ty with TType_ucase _ -> true | _ -> false -let mkAppTy tcref tyargs = TType_app(tcref, tyargs) +let mkAppTy tcref tyargs = TType_app(tcref, tyargs, KnownWithoutNull) // TODO NULLNESS - check various callers let mkProvenUnionCaseTy ucref tyargs = TType_ucase(ucref, tyargs) let isAppTy g ty = ty |> stripTyEqns g |> (function TType_app _ -> true | _ -> false) -let tryAppTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, tinst) -> ValueSome (tcref, tinst) | _ -> ValueNone) -let destAppTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, tinst) -> tcref, tinst | _ -> failwith "destAppTy") -let tcrefOfAppTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tcref | _ -> failwith "tcrefOfAppTy") -let argsOfAppTy g ty = ty |> stripTyEqns g |> (function TType_app(_, tinst) -> tinst | _ -> []) -let tryDestTyparTy g ty = ty |> stripTyEqns g |> (function TType_var v -> ValueSome v | _ -> ValueNone) -let tryDestFunTy g ty = ty |> stripTyEqns g |> (function TType_fun (tyv, tau) -> ValueSome(tyv, tau) | _ -> ValueNone) -let tryDestAppTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> ValueSome tcref | _ -> ValueNone) +let tryAppTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, tinst, _) -> ValueSome (tcref, tinst) | _ -> ValueNone) +let destAppTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, tinst, _) -> tcref, tinst | _ -> failwith "destAppTy") +let tcrefOfAppTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tcref | _ -> failwith "tcrefOfAppTy") +let nullnessOfTy g ty = ty |> stripTyEqns g |> (function TType_app(_, _, nullness) | TType_fun (_, _, nullness) | TType_var (_, nullness) -> nullness | _ -> g.knownWithoutNull) +let argsOfAppTy g ty = ty |> stripTyEqns g |> (function TType_app(_, tinst, _) -> tinst | _ -> []) +let tryDestTyparTy g ty = ty |> stripTyEqns g |> (function TType_var (v, _nullness) -> ValueSome v | _ -> ValueNone) +let tryDestFunTy g ty = ty |> stripTyEqns g |> (function TType_fun (tyv, tau, _nullness) -> ValueSome(tyv, tau) | _ -> ValueNone) +let tryDestAppTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> ValueSome tcref | _ -> ValueNone) let tryDestAnonRecdTy g ty = ty |> stripTyEqns g |> (function TType_anon (anonInfo, tys) -> ValueSome (anonInfo, tys) | _ -> ValueNone) -let tryAnyParTy g ty = ty |> stripTyEqns g |> (function TType_var v -> ValueSome v | TType_measure unt when isUnitParMeasure g unt -> ValueSome(destUnitParMeasure g unt) | _ -> ValueNone) -let tryAnyParTyOption g ty = ty |> stripTyEqns g |> (function TType_var v -> Some v | TType_measure unt when isUnitParMeasure g unt -> Some(destUnitParMeasure g unt) | _ -> None) -let (|AppTy|_|) g ty = ty |> stripTyEqns g |> (function TType_app(tcref, tinst) -> Some (tcref, tinst) | _ -> None) +let tryAnyParTy g ty = ty |> stripTyEqns g |> (function TType_var (v, _nullness) -> ValueSome v | TType_measure unt when isUnitParMeasure g unt -> ValueSome(destUnitParMeasure g unt) | _ -> ValueNone) +let tryAnyParTyOption g ty = ty |> stripTyEqns g |> (function TType_var (v, _nullness) -> Some v | TType_measure unt when isUnitParMeasure g unt -> Some(destUnitParMeasure g unt) | _ -> None) +let (|AppTy|_|) g ty = ty |> stripTyEqns g |> (function TType_app(tcref, tinst, _) -> Some (tcref, tinst) | _ -> None) let (|RefTupleTy|_|) g ty = ty |> stripTyEqns g |> (function TType_tuple(tupInfo, tys) when not (evalTupInfoIsStruct tupInfo) -> Some tys | _ -> None) -let (|FunTy|_|) g ty = ty |> stripTyEqns g |> (function TType_fun(dty, rty) -> Some (dty, rty) | _ -> None) +let (|FunTy|_|) g ty = ty |> stripTyEqns g |> (function TType_fun(dty, rty, _nullness) -> Some (dty, rty) | _ -> None) let tryNiceEntityRefOfTy ty = - let ty = stripTyparEqnsAux false ty + let ty = stripTyparEqnsAux KnownWithoutNull false ty match ty with - | TType_app (tcref, _) -> ValueSome tcref + | TType_app (tcref, _, _) -> ValueSome tcref | TType_measure (Measure.Con tcref) -> ValueSome tcref | _ -> ValueNone let tryNiceEntityRefOfTyOption ty = - let ty = stripTyparEqnsAux false ty + let ty = stripTyparEqnsAux KnownWithoutNull false ty match ty with - | TType_app (tcref, _) -> Some tcref + | TType_app (tcref, _, _) -> Some tcref | TType_measure (Measure.Con tcref) -> Some tcref | _ -> None @@ -863,7 +873,7 @@ let convertToTypeWithMetadataIfPossible g ty = let (tupInfo, tupElemTys) = destAnyTupleTy g ty mkOuterCompiledTupleTy g (evalTupInfoIsStruct tupInfo) tupElemTys elif isFunTy g ty then - let (a,b) = destFunTy g ty + let (a, b (*, nullness *) ) = destFunTy g ty mkAppTy g.fastFunc_tcr [a; b] else ty @@ -939,6 +949,7 @@ and typarConstraintsAEquivAux erasureFlag g aenv tpc1 tpc2 = | TyparConstraint.SupportsComparison _, TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _, TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _, TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _, TyparConstraint.NotSupportsNull _ | TyparConstraint.IsNonNullableStruct _, TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsReferenceType _, TyparConstraint.IsReferenceType _ | TyparConstraint.IsUnmanaged _, TyparConstraint.IsUnmanaged _ @@ -964,13 +975,13 @@ and typeAEquivAux erasureFlag g aenv ty1 ty2 = match ty1, ty2 with | TType_forall(tps1, rty1), TType_forall(tps2, rty2) -> typarsAEquivAux erasureFlag g aenv tps1 tps2 && typeAEquivAux erasureFlag g (aenv.BindEquivTypars tps1 tps2) rty1 rty2 - | TType_var tp1, TType_var tp2 when typarEq tp1 tp2 -> + | TType_var (tp1, _nullness1), TType_var (tp2, _nullness2) when typarEq tp1 tp2 -> // NOTE: nullness annotations are ignored for type equivalence true - | TType_var tp1, _ -> + | TType_var (tp1, _nullness1), _ -> match aenv.EquivTypars.TryFind tp1 with | Some v -> typeEquivAux erasureFlag g v ty2 | None -> false - | TType_app (tc1, b1), TType_app (tc2, b2) -> + | TType_app (tc1, b1, _nullness1), TType_app (tc2, b2, _nullness2) -> // NOTE: nullness annotations are ignored for type equivalence tcrefAEquiv g aenv tc1 tc2 && typesAEquivAux erasureFlag g aenv b1 b2 | TType_ucase (UCRef(tc1, n1), b1), TType_ucase (UCRef(tc2, n2), b2) -> @@ -979,11 +990,11 @@ and typeAEquivAux erasureFlag g aenv ty1 ty2 = typesAEquivAux erasureFlag g aenv b1 b2 | TType_tuple (s1, l1), TType_tuple (s2, l2) -> structnessAEquiv s1 s2 && typesAEquivAux erasureFlag g aenv l1 l2 + | TType_fun (dtys1, rty1, _nullness1), TType_fun (dtys2, rty2, _nullness2) -> // NOTE: nullness annotations are ignored for type equivalence + typeAEquivAux erasureFlag g aenv dtys1 dtys2 && typeAEquivAux erasureFlag g aenv rty1 rty2 | TType_anon (anonInfo1, l1), TType_anon (anonInfo2, l2) -> anonInfoEquiv anonInfo1 anonInfo2 && typesAEquivAux erasureFlag g aenv l1 l2 - | TType_fun (dtys1, rty1), TType_fun (dtys2, rty2) -> - typeAEquivAux erasureFlag g aenv dtys1 dtys2 && typeAEquivAux erasureFlag g aenv rty1 rty2 | TType_measure m1, TType_measure m2 -> match erasureFlag with | EraseNone -> measureAEquiv g aenv m1 m2 @@ -1029,7 +1040,7 @@ let measureEquiv g m1 m2 = measureAEquiv g TypeEquivEnv.Empty m1 m2 let isErasedType g ty = match stripTyEqns g ty with #if !NO_EXTENSIONTYPING - | TType_app (tcref, _) -> tcref.IsProvidedErasedTycon + | TType_app (tcref, _, _) -> tcref.IsProvidedErasedTycon #endif | _ -> false @@ -1040,12 +1051,20 @@ let rec getErasedTypes g ty = match ty with | TType_forall(_, rty) -> getErasedTypes g rty - | TType_var tp -> - if tp.IsErased then [ty] else [] - | TType_app (_, b) | TType_ucase(_, b) | TType_anon (_, b) | TType_tuple (_, b) -> + | TType_var (tp, nullness) -> + match nullness.Evaluate() with + | NullnessInfo.WithNull -> [ty] // with-null annotations can't be tested at runtime (TODO NULLNESS: for value types Nullable<_> they can be) + | _ -> if tp.IsErased then [ty] else [] + | TType_app (_, b, nullness) -> + match nullness.Evaluate() with + | NullnessInfo.WithNull -> [ty] + | _ -> List.foldBack (fun ty tys -> getErasedTypes g ty @ tys) b [] + | TType_ucase(_, b) | TType_anon (_, b) | TType_tuple (_, b) -> List.foldBack (fun ty tys -> getErasedTypes g ty @ tys) b [] - | TType_fun (dty, rty) -> - getErasedTypes g dty @ getErasedTypes g rty + | TType_fun (dty, rty, nullness) -> + match nullness.Evaluate() with + | NullnessInfo.WithNull -> [ty] + | _ -> getErasedTypes g dty @ getErasedTypes g rty | TType_measure _ -> [ty] @@ -1074,9 +1093,7 @@ let unionCaseRefOrder = // Make some common types //--------------------------------------------------------------------------- -let mkFunTy d r = TType_fun (d, r) - -let (-->) d r = mkFunTy d r +let mkFunTy (g: TcGlobals) d r = TType_fun (d, r, g.knownWithoutNull) let mkForallTy d r = TType_forall (d, r) @@ -1084,7 +1101,9 @@ let mkForallTyIfNeeded d r = if isNil d then r else mkForallTy d r let (+->) d r = mkForallTyIfNeeded d r -let mkIteratedFunTy dl r = List.foldBack (-->) dl r +let mkIteratedFunTy g dl r = List.foldBack (mkFunTy g) dl r + +let mkLambdaTy g tps tys rty = mkForallTyIfNeeded tps (mkIteratedFunTy g tys rty) let mkLambdaArgTy m tys = match tys with @@ -1093,8 +1112,8 @@ let mkLambdaArgTy m tys = | _ -> mkRawRefTupleTy tys let typeOfLambdaArg m vs = mkLambdaArgTy m (typesOfVals vs) -let mkMultiLambdaTy m vs rty = mkFunTy (typeOfLambdaArg m vs) rty -let mkLambdaTy tps tys rty = mkForallTyIfNeeded tps (mkIteratedFunTy tys rty) + +let mkMultiLambdaTy g m vs rty = mkFunTy g (typeOfLambdaArg m vs) rty /// When compiling FSharp.Core.dll we have to deal with the non-local references into /// the library arising from env.fs. Part of this means that we have to be able to resolve these @@ -1204,29 +1223,29 @@ let mkTypeChoose m vs b = match vs with [] -> b | _ -> Expr.TyChoose (vs, b, m) let mkObjExpr (ty, basev, basecall, overrides, iimpls, m) = Expr.Obj (newUnique(), ty, basev, basecall, overrides, iimpls, m) -let mkLambdas m tps (vs: Val list) (b, rty) = - mkTypeLambda m tps (List.foldBack (fun v (e, ty) -> mkLambda m v (e, ty), v.Type --> ty) vs (b, rty)) +let mkLambdas g m tps (vs: Val list) (b, rty) = + mkTypeLambda m tps (List.foldBack (fun v (e, ty) -> mkLambda m v (e, ty), mkFunTy g v.Type ty) vs (b, rty)) -let mkMultiLambdasCore m vsl (b, rty) = - List.foldBack (fun v (e, ty) -> mkMultiLambda m v (e, ty), typeOfLambdaArg m v --> ty) vsl (b, rty) +let mkMultiLambdasCore g m vsl (b, rty) = + List.foldBack (fun v (e, ty) -> mkMultiLambda m v (e, ty), mkFunTy g (typeOfLambdaArg m v) ty) vsl (b, rty) -let mkMultiLambdas m tps vsl (b, rty) = - mkTypeLambda m tps (mkMultiLambdasCore m vsl (b, rty) ) +let mkMultiLambdas g m tps vsl (b, rty) = + mkTypeLambda m tps (mkMultiLambdasCore g m vsl (b, rty) ) -let mkMemberLambdas m tps ctorThisValOpt baseValOpt vsl (b, rty) = +let mkMemberLambdas g m tps ctorThisValOpt baseValOpt vsl (b, rty) = let expr = match ctorThisValOpt, baseValOpt with - | None, None -> mkMultiLambdasCore m vsl (b, rty) + | None, None -> mkMultiLambdasCore g m vsl (b, rty) | _ -> match vsl with | [] -> error(InternalError("mk_basev_multi_lambdas_core: can't attach a basev to a non-lambda expression", m)) | h :: t -> - let b, rty = mkMultiLambdasCore m t (b, rty) - (rebuildLambda m ctorThisValOpt baseValOpt h (b, rty), (typeOfLambdaArg m h --> rty)) + let b, rty = mkMultiLambdasCore g m t (b, rty) + (rebuildLambda m ctorThisValOpt baseValOpt h (b, rty), (mkFunTy g (typeOfLambdaArg m h) rty)) mkTypeLambda m tps expr -let mkMultiLambdaBind v letSeqPtOpt m tps vsl (b, rty) = - TBind(v, mkMultiLambdas m tps vsl (b, rty), letSeqPtOpt) +let mkMultiLambdaBind g v letSeqPtOpt m tps vsl (b, rty) = + TBind(v, mkMultiLambdas g m tps vsl (b, rty), letSeqPtOpt) let mkBind seqPtOpt v e = TBind(v, e, seqPtOpt) @@ -1616,36 +1635,36 @@ let tyconRefEqOpt g tcOpt tc = | None -> false | Some tc2 -> tyconRefEq g tc2 tc -let isStringTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tyconRefEq g tcref g.system_String_tcref | _ -> false) -let isListTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tyconRefEq g tcref g.list_tcr_canon | _ -> false) -let isArrayTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> isArrayTyconRef g tcref | _ -> false) -let isArray1DTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tyconRefEq g tcref g.il_arr_tcr_map.[0] | _ -> false) -let isUnitTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tyconRefEq g g.unit_tcr_canon tcref | _ -> false) -let isObjTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tyconRefEq g g.system_Object_tcref tcref | _ -> false) -let isVoidTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tyconRefEq g g.system_Void_tcref tcref | _ -> false) -let isILAppTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tcref.IsILTycon | _ -> false) -let isNativePtrTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tyconRefEq g g.nativeptr_tcr tcref | _ -> false) +let isStringTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g tcref g.system_String_tcref | _ -> false) +let isListTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g tcref g.list_tcr_canon | _ -> false) +let isArrayTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> isArrayTyconRef g tcref | _ -> false) +let isArray1DTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g tcref g.il_arr_tcr_map.[0] | _ -> false) +let isUnitTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g g.unit_tcr_canon tcref | _ -> false) +let isObjTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g g.system_Object_tcref tcref | _ -> false) +let isVoidTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g g.system_Void_tcref tcref | _ -> false) +let isILAppTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tcref.IsILTycon | _ -> false) +let isNativePtrTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g g.nativeptr_tcr tcref | _ -> false) let isByrefTy g ty = ty |> stripTyEqns g |> (function - | TType_app(tcref, _) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref - | TType_app(tcref, _) -> tyconRefEq g g.byref_tcr tcref + | TType_app(tcref, _, _) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref + | TType_app(tcref, _, _) -> tyconRefEq g g.byref_tcr tcref | _ -> false) -let isInByrefTag g ty = ty |> stripTyEqns g |> (function TType_app(tcref, []) -> tyconRefEq g g.byrefkind_In_tcr tcref | _ -> false) +let isInByrefTag g ty = ty |> stripTyEqns g |> (function TType_app(tcref, [], _) -> tyconRefEq g g.byrefkind_In_tcr tcref | _ -> false) let isInByrefTy g ty = ty |> stripTyEqns g |> (function - | TType_app(tcref, [_; tag]) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref && isInByrefTag g tag + | TType_app(tcref, [_; tag], _) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref && isInByrefTag g tag | _ -> false) -let isOutByrefTag g ty = ty |> stripTyEqns g |> (function TType_app(tcref, []) -> tyconRefEq g g.byrefkind_Out_tcr tcref | _ -> false) +let isOutByrefTag g ty = ty |> stripTyEqns g |> (function TType_app(tcref, [], _) -> tyconRefEq g g.byrefkind_Out_tcr tcref | _ -> false) let isOutByrefTy g ty = ty |> stripTyEqns g |> (function - | TType_app(tcref, [_; tag]) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref && isOutByrefTag g tag + | TType_app(tcref, [_; tag], _) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref && isOutByrefTag g tag | _ -> false) #if !NO_EXTENSIONTYPING -let extensionInfoOfTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _) -> tcref.TypeReprInfo | _ -> TNoRepr) +let extensionInfoOfTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tcref.TypeReprInfo | _ -> TNoRepr) #endif type TypeDefMetadata = @@ -2029,6 +2048,7 @@ and accFreeInTyparConstraint opts tpc acc = | TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _ | TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsReferenceType _ | TyparConstraint.IsUnmanaged _ @@ -2078,15 +2098,17 @@ and accFreeInType opts ty acc = match stripTyparEqns ty with | TType_tuple (tupInfo, l) -> accFreeInTypes opts l (accFreeInTupInfo opts tupInfo acc) | TType_anon (anonInfo, l) -> accFreeInTypes opts l (accFreeInTupInfo opts anonInfo.TupInfo acc) - | TType_app (tc, tinst) -> + | TType_app (tc, tinst, _nullness) -> let acc = accFreeTycon opts tc acc match tinst with | [] -> acc // optimization to avoid unneeded call | [h] -> accFreeInType opts h acc // optimization to avoid unneeded call | _ -> accFreeInTypes opts tinst acc - | TType_ucase (UCRef(tc, _), tinst) -> accFreeInTypes opts tinst (accFreeTycon opts tc acc) - | TType_fun (d, r) -> accFreeInType opts d (accFreeInType opts r acc) - | TType_var r -> accFreeTyparRef opts r acc + | TType_ucase (UCRef(tc, _), tinst) -> accFreeInTypes opts tinst (accFreeTycon opts tc acc) + | TType_fun (d, r, _nullness) -> + // note, nullness variables are _not_ part of the type system proper + accFreeInType opts d (accFreeInType opts r acc) + | TType_var (r, _nullness) -> accFreeTyparRef opts r acc | TType_forall (tps, r) -> unionFreeTyvars (boundTypars opts tps (freeInType opts r)) acc | TType_measure unt -> accFreeInMeasure opts unt acc @@ -2149,6 +2171,7 @@ and accFreeInTyparConstraintLeftToRight g cxFlag thruFlag acc tpc = | TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _ | TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsUnmanaged _ | TyparConstraint.IsReferenceType _ @@ -2178,21 +2201,18 @@ and accFreeInTypeLeftToRight g cxFlag thruFlag acc ty = | TType_tuple (tupInfo, tupTys) -> let acc = accFreeInTupInfoLeftToRight g cxFlag thruFlag acc tupInfo accFreeInTypesLeftToRight g cxFlag thruFlag acc tupTys - | TType_app (_, tinst) -> + | TType_app (_, tinst, _nullness) -> accFreeInTypesLeftToRight g cxFlag thruFlag acc tinst - | TType_ucase (_, tinst) -> + | TType_ucase (_, tinst) -> accFreeInTypesLeftToRight g cxFlag thruFlag acc tinst - | TType_fun (d, r) -> - let dacc = accFreeInTypeLeftToRight g cxFlag thruFlag acc d - accFreeInTypeLeftToRight g cxFlag thruFlag dacc r - | TType_var r -> + | TType_fun (d, r, _nullness) -> + accFreeInTypeLeftToRight g cxFlag thruFlag (accFreeInTypeLeftToRight g cxFlag thruFlag acc d ) r + | TType_var (r, _nullness) -> accFreeTyparRefLeftToRight g cxFlag thruFlag acc r - | TType_forall (tps, r) -> - let racc = accFreeInTypeLeftToRight g cxFlag thruFlag emptyFreeTyparsLeftToRight r - unionFreeTyparsLeftToRight (boundTyparsLeftToRight g cxFlag thruFlag tps racc) acc + | TType_forall (tps, r) -> + unionFreeTyparsLeftToRight (boundTyparsLeftToRight g cxFlag thruFlag tps (accFreeInTypeLeftToRight g cxFlag thruFlag emptyFreeTyparsLeftToRight r)) acc | TType_measure unt -> - let mvars = ListMeasureVarOccsWithNonZeroExponents unt - List.foldBack (fun (tp, _) acc -> accFreeTyparRefLeftToRight g cxFlag thruFlag acc tp) mvars acc + List.foldBack (fun (tp, _) acc -> accFreeTyparRefLeftToRight g cxFlag thruFlag acc tp) (ListMeasureVarOccsWithNonZeroExponents unt) acc and accFreeInTupInfoLeftToRight _g _cxFlag _thruFlag acc unt = match unt with @@ -2379,16 +2399,26 @@ let ArgInfosOfPropertyVal g (v: Val) = // Generalize type constructors to types //--------------------------------------------------------------------------- -let generalTyconRefInst (tc: TyconRef) = generalizeTypars tc.TyparsNoRange +let generalTyconRefInst (tcref: TyconRef) = + generalizeTypars tcref.TyparsNoRange -let generalizeTyconRef tc = - let tinst = generalTyconRefInst tc - tinst, TType_app(tc, tinst) +let generalizeTyconRef (g: TcGlobals) tcref = + let tinst = generalTyconRefInst tcref + tinst, TType_app(tcref, tinst, g.knownWithoutNull) -let generalizedTyconRef tc = TType_app(tc, generalTyconRefInst tc) +let generalizedTyOfTyconRef (g: TcGlobals) tcref = + let tinst = generalTyconRefInst tcref + TType_app(tcref, tinst, g.knownWithoutNull) -let isTTyparSupportsStaticMethod = function TyparConstraint.MayResolveMember _ -> true | _ -> false -let isTTyparCoercesToType = function TyparConstraint.CoercesTo _ -> true | _ -> false +let isTTyparSupportsStaticMethod tpc = + match tpc with + | TyparConstraint.MayResolveMember _ -> true + | _ -> false + +let isTTyparCoercesToType tpc = + match tpc with + | TyparConstraint.CoercesTo _ -> true + | _ -> false //-------------------------------------------------------------------------- // Print Signatures/Types - prelude @@ -2581,11 +2611,11 @@ module SimplifyTypes = let z = f z ty match ty with | TType_forall (_, body) -> foldTypeButNotConstraints f z body - | TType_app (_, tys) + | TType_app (_, tys, _) | TType_ucase (_, tys) | TType_anon (_, tys) | TType_tuple (_, tys) -> List.fold (foldTypeButNotConstraints f) z tys - | TType_fun (s, t) -> foldTypeButNotConstraints f (foldTypeButNotConstraints f z s) t + | TType_fun (s, t, _nullness) -> foldTypeButNotConstraints f (foldTypeButNotConstraints f z s) t | TType_var _ -> z | TType_measure _ -> z @@ -2595,7 +2625,7 @@ module SimplifyTypes = let accTyparCounts z ty = // Walk type to determine typars and their counts (for pprinting decisions) - foldTypeButNotConstraints (fun z ty -> match ty with | TType_var tp when tp.Rigidity = TyparRigidity.Rigid -> incM tp z | _ -> z) z ty + foldTypeButNotConstraints (fun z ty -> match ty with | TType_var (tp, _nullness) when tp.Rigidity = TyparRigidity.Rigid -> incM tp z | _ -> z) z ty let emptyTyparCounts = Zmap.empty typarOrder @@ -2766,8 +2796,8 @@ let tagEntityRefName (xref: EntityRef) name = elif xref.IsRecordTycon then tagRecord name else tagClass name -let fullDisplayTextOfTyconRef (tc: TyconRef) = - fullNameOfEntityRef (fun tc -> tc.DisplayNameWithStaticParametersAndUnderscoreTypars) tc +let fullDisplayTextOfTyconRef r = + fullNameOfEntityRef (fun (tcref:TyconRef) -> tcref.DisplayNameWithStaticParametersAndUnderscoreTypars) r let fullNameOfEntityRefAsLayout nmF (xref: EntityRef) = let navigableText = @@ -2799,13 +2829,23 @@ let fullNameOfParentOfValRefAsLayout vref = let fullDisplayTextOfParentOfModRef r = fullNameOfParentOfEntityRef r -let fullDisplayTextOfModRef r = fullNameOfEntityRef (fun (x: EntityRef) -> x.DemangledModuleOrNamespaceName) r -let fullDisplayTextOfTyconRefAsLayout r = fullNameOfEntityRefAsLayout (fun (tc: TyconRef) -> tc.DisplayNameWithStaticParametersAndUnderscoreTypars) r -let fullDisplayTextOfExnRef r = fullNameOfEntityRef (fun (tc: TyconRef) -> tc.DisplayNameWithStaticParametersAndUnderscoreTypars) r -let fullDisplayTextOfExnRefAsLayout r = fullNameOfEntityRefAsLayout (fun (tc: TyconRef) -> tc.DisplayNameWithStaticParametersAndUnderscoreTypars) r +let fullDisplayTextOfModRef r = + fullNameOfEntityRef (fun (x: EntityRef) -> x.DemangledModuleOrNamespaceName) r + +let fullDisplayTextOfTyconRefAsLayout r = + fullNameOfEntityRefAsLayout (fun (tcref: TyconRef) -> tcref.DisplayNameWithStaticParametersAndUnderscoreTypars) r + +let fullDisplayTextOfExnRef r = + fullNameOfEntityRef (fun (tcref: TyconRef) -> tcref.DisplayNameWithStaticParametersAndUnderscoreTypars) r + +let fullDisplayTextOfExnRefAsLayout r = + fullNameOfEntityRefAsLayout (fun (tcref: TyconRef) -> tcref.DisplayNameWithStaticParametersAndUnderscoreTypars) r -let fullDisplayTextOfUnionCaseRef (ucref: UnionCaseRef) = fullDisplayTextOfTyconRef ucref.TyconRef +.+ ucref.CaseName -let fullDisplayTextOfRecdFieldRef (rfref: RecdFieldRef) = fullDisplayTextOfTyconRef rfref.TyconRef +.+ rfref.FieldName +let fullDisplayTextOfUnionCaseRef (ucref: UnionCaseRef) = + fullDisplayTextOfTyconRef ucref.TyconRef +.+ ucref.CaseName + +let fullDisplayTextOfRecdFieldRef (rfref: RecdFieldRef) = + fullDisplayTextOfTyconRef rfref.TyconRef +.+ rfref.FieldName let fullDisplayTextOfValRef (vref: ValRef) = match fullNameOfParentOfValRef vref with @@ -3026,7 +3066,7 @@ let isSpanLikeTyconRef g m tcref = not (isByrefTyconRef g tcref) let isByrefLikeTy g m ty = - ty |> stripTyEqns g |> (function TType_app(tcref, _) -> isByrefLikeTyconRef g m tcref | _ -> false) + ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> isByrefLikeTyconRef g m tcref | _ -> false) let isSpanLikeTy g m ty = isByrefLikeTy g m ty && @@ -3037,7 +3077,7 @@ let isSpanTyconRef g m tcref = tcref.CompiledRepresentationForNamedType.BasicQualifiedName = "System.Span`1" let isSpanTy g m ty = - ty |> stripTyEqns g |> (function TType_app(tcref, _) -> isSpanTyconRef g m tcref | _ -> false) + ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> isSpanTyconRef g m tcref | _ -> false) let rec tryDestSpanTy g m ty = match tryAppTy g ty with @@ -3054,7 +3094,7 @@ let isReadOnlySpanTyconRef g m tcref = tcref.CompiledRepresentationForNamedType.BasicQualifiedName = "System.ReadOnlySpan`1" let isReadOnlySpanTy g m ty = - ty |> stripTyEqns g |> (function TType_app(tcref, _) -> isReadOnlySpanTyconRef g m tcref | _ -> false) + ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> isReadOnlySpanTyconRef g m tcref | _ -> false) let tryDestReadOnlySpanTy g m ty = match tryAppTy g ty with @@ -3072,8 +3112,8 @@ let destReadOnlySpanTy g m ty = let destByrefTy g ty = match ty |> stripTyEqns g with - | TType_app(tcref, [x; _]) when g.byref2_tcr.CanDeref && tyconRefEq g g.byref2_tcr tcref -> x // Check sufficient FSharp.Core - | TType_app(tcref, [x]) when tyconRefEq g g.byref_tcr tcref -> x // all others + | TType_app(tcref, [x; _], _) when g.byref2_tcr.CanDeref && tyconRefEq g g.byref2_tcr tcref -> x // Check sufficient FSharp.Core + | TType_app(tcref, [x], _) when tyconRefEq g g.byref_tcr tcref -> x // all others | _ -> failwith "destByrefTy: not a byref type" let (|ByrefTy|_|) g ty = @@ -3082,7 +3122,7 @@ let (|ByrefTy|_|) g ty = let destNativePtrTy g ty = match ty |> stripTyEqns g with - | TType_app(tcref, [x]) when tyconRefEq g g.nativeptr_tcr tcref -> x + | TType_app(tcref, [x], _) when tyconRefEq g g.nativeptr_tcr tcref -> x | _ -> failwith "destNativePtrTy: not a native ptr type" let isRefCellTy g ty = @@ -3092,7 +3132,7 @@ let isRefCellTy g ty = let destRefCellTy g ty = match ty |> stripTyEqns g with - | TType_app(tcref, [x]) when tyconRefEq g g.refcell_tcr_canon tcref -> x + | TType_app(tcref, [x], _) when tyconRefEq g g.refcell_tcr_canon tcref -> x | _ -> failwith "destRefCellTy: not a ref type" let StripSelfRefCell(g: TcGlobals, baseOrThisInfo: ValBaseOrThisInfo, tau: TType) : TType = @@ -3100,15 +3140,15 @@ let StripSelfRefCell(g: TcGlobals, baseOrThisInfo: ValBaseOrThisInfo, tau: TType then destRefCellTy g tau else tau -let mkRefCellTy (g: TcGlobals) ty = TType_app(g.refcell_tcr_nice, [ty]) +let mkRefCellTy (g: TcGlobals) ty = TType_app(g.refcell_tcr_nice, [ty], g.knownWithoutNull) -let mkLazyTy (g: TcGlobals) ty = TType_app(g.lazy_tcr_nice, [ty]) +let mkLazyTy (g: TcGlobals) ty = TType_app(g.lazy_tcr_nice, [ty], g.knownWithoutNull) -let mkPrintfFormatTy (g: TcGlobals) aty bty cty dty ety = TType_app(g.format_tcr, [aty;bty;cty;dty; ety]) +let mkPrintfFormatTy (g: TcGlobals) aty bty cty dty ety = TType_app(g.format_tcr, [aty;bty;cty;dty; ety], g.knownWithoutNull) -let mkOptionTy (g: TcGlobals) ty = TType_app (g.option_tcr_nice, [ty]) +let mkOptionTy (g: TcGlobals) ty = TType_app (g.option_tcr_nice, [ty], g.knownWithoutNull) -let mkListTy (g: TcGlobals) ty = TType_app (g.list_tcr_nice, [ty]) +let mkListTy (g: TcGlobals) ty = TType_app (g.list_tcr_nice, [ty], g.knownWithoutNull) let isOptionTy (g: TcGlobals) ty = match tryDestAppTy g ty with @@ -3280,8 +3320,7 @@ module DebugPrint = let stampL _n w = w - let layoutTyconRef (tc: TyconRef) = - wordL (tagText tc.DisplayNameWithStaticParameters) |> stampL tc.Stamp + let layoutTyconRef (tcref: TyconRef) = wordL (tagText tcref.DisplayNameWithStaticParameters) |> stampL tcref.Stamp let rec auxTypeL env ty = auxTypeWrapL env false ty @@ -3301,20 +3340,43 @@ module DebugPrint = else tupleL tinstL ^^ tcL + and auxAddNullness coreL (nullness: Nullness) = + match nullness.Evaluate() with + | NullnessInfo.WithNull -> coreL ^^ wordL (tagText "?") + | NullnessInfo.WithoutNull -> coreL + | NullnessInfo.AmbivalentToNull -> coreL ^^ wordL (tagText "%") + and auxTypeWrapL env isAtomic ty = let wrap x = bracketIfL isAtomic x in // wrap iff require atomic expr match stripTyparEqns ty with | TType_forall (typars, rty) -> (leftL (tagText "!") ^^ layoutTyparDecls typars --- auxTypeL env rty) |> wrap - | TType_ucase (UCRef(tcref, _), tinst) - | TType_app (tcref, tinst) -> + + | TType_ucase (UCRef(tcref, _), tinst) -> let prefix = tcref.IsPrefixDisplay let tcL = layoutTyconRef tcref auxTyparsL env tcL prefix tinst - | TType_anon (anonInfo, tys) -> braceBarL (sepListL (wordL (tagText ";")) (List.map2 (fun nm ty -> wordL (tagField nm) --- auxTypeAtomL env ty) (Array.toList anonInfo.SortedNames) tys)) - | TType_tuple (_tupInfo, tys) -> sepListL (wordL (tagText "*")) (List.map (auxTypeAtomL env) tys) |> wrap - | TType_fun (f, x) -> ((auxTypeAtomL env f ^^ wordL (tagText "->")) --- auxTypeL env x) |> wrap - | TType_var typar -> auxTyparWrapL env isAtomic typar + + | TType_app (tcref, tinst, nullness) -> + let prefix = tcref.IsPrefixDisplay + let tcL = layoutTyconRef tcref + let coreL = auxTyparsL env tcL prefix tinst + auxAddNullness coreL nullness + + | TType_tuple (_tupInfo, tys) -> + sepListL (wordL (tagText "*")) (List.map (auxTypeAtomL env) tys) |> wrap + + | TType_fun (f, x, nullness) -> + let coreL = ((auxTypeAtomL env f ^^ wordL (tagText "->")) --- auxTypeL env x) |> wrap + auxAddNullness coreL nullness + + | TType_var (typar, nullness) -> + let coreL = auxTyparWrapL env isAtomic typar + auxAddNullness coreL nullness + + | TType_anon (anonInfo, tys) -> + braceBarL (sepListL (wordL (tagText ";")) (List.map2 (fun nm ty -> wordL (tagField nm) --- auxTypeAtomL env ty) (Array.toList anonInfo.SortedNames) tys)) + | TType_measure unt -> #if DEBUG leftL (tagText "{") ^^ @@ -3326,7 +3388,7 @@ module DebugPrint = let negvs, posvs = ListMeasureVarOccsWithNonZeroExponents unt |> sortVars |> List.partition (fun (_, e) -> SignRational e < 0) let negcs, poscs = ListMeasureConOccsWithNonZeroExponents g false unt |> sortCons |> List.partition (fun (_, e) -> SignRational e < 0) let unparL (uv: Typar) = wordL (tagText ("'" + uv.DisplayName)) - let unconL tc = layoutTyconRef tc + let unconL tcref = layoutTyconRef tcref let rationalL e = wordL (tagText(RationalToString e)) let measureToPowerL x e = if e = OneRational then x else x -- wordL (tagText "^") -- rationalL e let prefix = @@ -3414,6 +3476,8 @@ module DebugPrint = wordL (tagText "struct") |> constraintPrefix | TyparConstraint.IsReferenceType _ -> wordL (tagText "not struct") |> constraintPrefix + | TyparConstraint.NotSupportsNull _ -> + wordL (tagText "not null") |> constraintPrefix | TyparConstraint.IsUnmanaged _ -> wordL (tagText "unmanaged") |> constraintPrefix | TyparConstraint.SimpleChoice(tys, _) -> @@ -3725,8 +3789,8 @@ module DebugPrint = wordL (tagText ecref.LogicalName) ^^ bracketL (commaListL (List.map atomL args)) | Expr.Op (TOp.Tuple _, _, xs, _) -> tupleL (List.map exprL xs) - | Expr.Op (TOp.Recd (ctor, tc), _, xs, _) -> - let fields = tc.TrueInstanceFieldsAsList + | Expr.Op (TOp.Recd (ctor, tcref), _, xs, _) -> + let fields = tcref.TrueInstanceFieldsAsList let lay fs x = (wordL (tagText fs.rfield_id.idText) ^^ sepL(tagText "=")) --- (exprL x) let ctorL = match ctor with @@ -5597,9 +5661,9 @@ let isQuotedExprTy g ty = match tryAppTy g ty with ValueSome (tcref, _) -> tycon let destQuotedExprTy g ty = match tryAppTy g ty with ValueSome (_, [ty]) -> ty | _ -> failwith "destQuotedExprTy" -let mkQuotedExprTy (g: TcGlobals) ty = TType_app(g.expr_tcr, [ty]) +let mkQuotedExprTy (g: TcGlobals) ty = TType_app(g.expr_tcr, [ty], g.knownWithoutNull) -let mkRawQuotedExprTy (g: TcGlobals) = TType_app(g.raw_expr_tcr, []) +let mkRawQuotedExprTy (g: TcGlobals) = TType_app(g.raw_expr_tcr, [], g.knownWithoutNull) let mkAnyTupledTy (g: TcGlobals) tupInfo tys = match tys with @@ -5614,9 +5678,9 @@ let mkRefTupledTy g tys = mkAnyTupledTy g tupInfoRef tys let mkRefTupledVarsTy g vs = mkRefTupledTy g (typesOfVals vs) -let mkMethodTy g argtys rty = mkIteratedFunTy (List.map (mkRefTupledTy g) argtys) rty +let mkMethodTy g argtys rty = mkIteratedFunTy g (List.map (mkRefTupledTy g) argtys) rty -let mkArrayType (g: TcGlobals) ty = TType_app (g.array_tcr_nice, [ty]) +let mkArrayType (g: TcGlobals) ty = TType_app (g.array_tcr_nice, [ty], g.knownWithoutNull) let mkByteArrayTy (g: TcGlobals) = mkArrayType g g.byte_ty @@ -5630,10 +5694,10 @@ let rec tyOfExpr g e = | Expr.Obj (_, ty, _, _, _, _, _) | Expr.Match (_, _, _, _, _, ty) | Expr.Quote (_, _, _, _, ty) - | Expr.Const (_, _, ty) -> (ty) - | Expr.Val (vref, _, _) -> vref.Type - | Expr.Sequential (a, b, k, _, _) -> tyOfExpr g (match k with NormalSeq -> b | ThenDoSeq -> a) - | Expr.Lambda (_, _, _, vs, _, _, rty) -> (mkRefTupledVarsTy g vs --> rty) + | Expr.Const (_, _, ty) -> ty + | Expr.Val (vref, _, _) -> vref.Type + | Expr.Sequential (a, b, k, _, _) -> tyOfExpr g (match k with NormalSeq -> b | ThenDoSeq -> a) + | Expr.Lambda (_, _, _, vs, _, _, rty) -> (mkFunTy g (mkRefTupledVarsTy g vs) rty) | Expr.TyLambda (_, tyvs, _, _, rty) -> (tyvs +-> rty) | Expr.Let (_, e, _, _) | Expr.TyChoose (_, e, _) @@ -6456,11 +6520,11 @@ let destIDelegateEventType g ty = | _ -> failwith "destIDelegateEventType: internal error" else failwith "destIDelegateEventType: not an IDelegateEvent type" -let mkIEventType (g: TcGlobals) ty1 ty2 = TType_app (g.fslib_IEvent2_tcr, [ty1;ty2]) +let mkIEventType (g: TcGlobals) ty1 ty2 = TType_app (g.fslib_IEvent2_tcr, [ty1;ty2], g.knownWithoutNull) -let mkIObservableType (g: TcGlobals) ty1 = TType_app (g.tcref_IObservable, [ty1]) +let mkIObservableType (g: TcGlobals) ty1 = TType_app (g.tcref_IObservable, [ty1], g.knownWithoutNull) -let mkIObserverType (g: TcGlobals) ty1 = TType_app (g.tcref_IObserver, [ty1]) +let mkIObserverType (g: TcGlobals) ty1 = TType_app (g.tcref_IObserver, [ty1], g.knownWithoutNull) let mkRefCellContentsRef (g: TcGlobals) = mkRecdFieldRef g.refcell_tcr_canon "contents" @@ -6796,15 +6860,13 @@ let mkCallArray3DSet (g: TcGlobals) m ty e1 idx1 idx2 idx3 v = mkApps g (typedEx let mkCallArray4DSet (g: TcGlobals) m ty e1 idx1 idx2 idx3 idx4 v = mkApps g (typedExprForIntrinsic g m g.array4D_set_info, [[ty]], [ e1 ; idx1; idx2; idx3; idx4; v ], m) -let mkCallHash (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.hash_info, [[ty]], [ e1 ], m) - -let mkCallBox (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.box_info, [[ty]], [ e1 ], m) +let mkCallHash (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.hash_info, [[ty]], [ e1 ], m) -let mkCallIsNull (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.isnull_info, [[ty]], [ e1 ], m) +let mkCallBox (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.box_info, [[ty]], [ e1 ], m) -let mkCallIsNotNull (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.isnotnull_info, [[ty]], [ e1 ], m) +let mkCallIsNull (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.isnull_info, [[ty]], [ e1 ], m) -let mkCallRaise (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.raise_info, [[ty]], [ e1 ], m) +let mkCallRaise (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.raise_info, [[ty]], [ e1 ], m) let mkCallNewDecimal (g: TcGlobals) m (e1, e2, e3, e4, e5) = mkApps g (typedExprForIntrinsic g m g.new_decimal_info, [], [ e1;e2;e3;e4;e5 ], m) @@ -7035,12 +7097,16 @@ let mkCompilationMappingAttrForQuotationResource (g: TcGlobals) (nm, tys: ILType let isTypeProviderAssemblyAttr (cattr: ILAttribute) = cattr.Method.DeclaringType.BasicQualifiedName = typeof.FullName -let TryDecodeTypeProviderAssemblyAttr ilg (cattr: ILAttribute) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE +let TryDecodeTypeProviderAssemblyAttr ilg (cattr: ILAttribute) : string option = +#else +let TryDecodeTypeProviderAssemblyAttr ilg (cattr: ILAttribute) : string? option = +#endif if isTypeProviderAssemblyAttr cattr then let parms, _args = decodeILAttribData ilg cattr match parms with // The first parameter to the attribute is the name of the assembly with the compiler extensions. - | (ILAttribElem.String (Some assemblyName)) :: _ -> Some assemblyName | (ILAttribElem.String None) :: _ -> Some null + | (ILAttribElem.String (Some assemblyName)) :: _ -> Some assemblyName | [] -> Some null | _ -> None else @@ -7257,7 +7323,7 @@ let AdjustValForExpectedArity g m (vref: ValRef) flags topValInfo = let call = MakeApplicationAndBetaReduce g (Expr.Val (vref, flags, m), vref.Type, [tyargs'], (List.map (mkRefTupledVars g m) vsl), m) let tauexpr, tauty = List.foldBack - (fun vs (e, ty) -> mkMultiLambda m vs (e, ty), (mkRefTupledVarsTy g vs --> ty)) + (fun vs (e, ty) -> mkMultiLambda m vs (e, ty), (mkFunTy g (mkRefTupledVarsTy g vs) ty)) vsl (call, rty') // Build a type-lambda expression for the toplevel value if needed... @@ -7486,8 +7552,8 @@ let AdjustPossibleSubsumptionExpr g (expr: Expr) (suppliedArgs: Expr list) : (Ex let inpsAsVars, inpsAsExprs = inpArgTys |> List.mapi (fun j ty -> mkCompGenLocal appm ("arg" + string i + string j) ty) |> List.unzip let inpsAsActualArg = CoerceDetupled inpArgTys inpsAsExprs actualArgTys - let inpCloVarType = (mkFunTy (mkRefTupledTy g actualArgTys) cloVar.Type) - let newResTy = mkFunTy inpArgTy resTy + let inpCloVarType = mkFunTy g (mkRefTupledTy g actualArgTys) cloVar.Type + let newResTy = mkFunTy g inpArgTy resTy let inpCloVar, inpCloVarAsExpr = mkCompGenLocal appm ("clo" + string i) inpCloVarType let newRes = // For the final arg we can skip introducing the dummy variable @@ -7694,7 +7760,6 @@ let typarEnc _g (gtpsType, gtpsMethod) typar = "``0" let rec typeEnc g (gtpsType, gtpsMethod) ty = - if verbose then dprintf "--> typeEnc" let stripped = stripTyEqnsAndMeasureEqns g ty match stripped with | TType_forall _ -> @@ -7712,7 +7777,7 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = typeEnc g (gtpsType, gtpsMethod) (List.head tinst) + arraySuffix | TType_ucase (UCRef(tcref, _), tinst) - | TType_app (tcref, tinst) -> + | TType_app (tcref, tinst, _) -> if tyconRefEq g g.byref_tcr tcref then typeEnc g (gtpsType, gtpsMethod) (List.head tinst) + "@" elif tyconRefEq g tcref g.nativeptr_tcr then @@ -7721,7 +7786,7 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = let tyName = let ty = stripTyEqnsAndMeasureEqns g ty match ty with - | TType_app (tcref, _tinst) -> + | TType_app (tcref, _tinst, _nullness) -> // Generic type names are (name + "`" + digits) where name does not contain "`". // In XML doc, when used in type instances, these do not use the ticks. let path = Array.toList (fullMangledPathToTyconRef tcref) @ [tcref.CompiledName] @@ -7740,10 +7805,10 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = else sprintf "System.Tuple%s"(tyargsEnc g (gtpsType, gtpsMethod) tys) - | TType_fun (f, x) -> + | TType_fun (f, x, _nullness) -> "Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [f;x] - | TType_var typar -> + | TType_var (typar, _nullness) -> typarEnc g (gtpsType, gtpsMethod) typar | TType_measure _ -> "?" @@ -7859,40 +7924,76 @@ let IsUnionTypeWithNullAsTrueValue (g: TcGlobals) (tycon: Tycon) = let TyconCompilesInstanceMembersAsStatic g tycon = IsUnionTypeWithNullAsTrueValue g tycon let TcrefCompilesInstanceMembersAsStatic g (tcref: TyconRef) = TyconCompilesInstanceMembersAsStatic g tcref.Deref +// TODO NULLNESS: Consider whether we need to adjust this predicate, and the compatibility issues with doing this let TypeNullNever g ty = let underlyingTy = stripTyEqnsAndMeasureEqns g ty (isStructTy g underlyingTy) || (isByrefTy g underlyingTy) +let TyconRefNullIsExtraValue isNew g m (tcref: TyconRef) = + not tcref.IsStructOrEnumTycon && + not (isByrefLikeTyconRef g m tcref) && + (if tcref.IsILTycon then + // Putting AllowNullLiteralAttribute(false) on an IL or provided type means 'null' can't be used with that type + (not isNew && TryFindTyconRefBoolAttribute g m g.attrib_AllowNullLiteralAttribute tcref <> Some false) + else +// Putting AllowNullLiteralAttribute(true) on an F# type means it always admits null even in the new model + (TryFindTyconRefBoolAttribute g m g.attrib_AllowNullLiteralAttribute tcref = Some true)) +let TyconRefNullIsExtraValueOld g m tcref = TyconRefNullIsExtraValue false g m tcref +let TyconRefNullIsExtraValueNew g m tcref = TyconRefNullIsExtraValue true g m tcref -/// Indicates if the type admits the use of 'null' as a value -let TypeNullIsExtraValue g m ty = +/// The F# 4.5 logic about whether a type admits the use of 'null' as a value. +let TypeNullIsExtraValueOld g m ty = if isILReferenceTy g ty || isDelegateTy g ty then - // Putting AllowNullLiteralAttribute(false) on an IL or provided type means 'null' can't be used with that type - not (match tryDestAppTy g ty with ValueSome tcref -> TryFindTyconRefBoolAttribute g m g.attrib_AllowNullLiteralAttribute tcref = Some false | _ -> false) + match tryDestAppTy g ty with + | ValueSome tcref -> + // In F# 4.x, putting AllowNullLiteralAttribute(false) on an IL or provided + // type means 'null' can't be used with that type, otherwise it can + TryFindTyconRefBoolAttribute g m g.attrib_AllowNullLiteralAttribute tcref <> Some false + | _ -> + // In F# 4.5, other IL reference types (e.g. arrays) always support null + true elif TypeNullNever g ty then false else - // Putting AllowNullLiteralAttribute(true) on an F# type means 'null' can be used with that type - match tryDestAppTy g ty with ValueSome tcref -> TryFindTyconRefBoolAttribute g m g.attrib_AllowNullLiteralAttribute tcref = Some true | _ -> false + // In F# 4.x, putting AllowNullLiteralAttribute(true) on an F# type means 'null' can be used with that type + match tryDestAppTy g ty with + | ValueSome tcref -> TryFindTyconRefBoolAttribute g m g.attrib_AllowNullLiteralAttribute tcref = Some true + | _ -> false +/// The F# 5.0 logic about whether a type admits the use of 'null' as a value. +let TypeNullIsExtraValueNew g m ty = + let sty = stripTyparEqns ty + (match tryDestAppTy g sty with + | ValueSome tcref -> + not tcref.IsStructOrEnumTycon && + not (isByrefLikeTyconRef g m tcref) && + (TryFindTyconRefBoolAttribute g m g.attrib_AllowNullLiteralAttribute tcref = Some true) + | _ -> false) + || + (match (nullnessOfTy g sty).Evaluate() with + | NullnessInfo.AmbivalentToNull -> false + | NullnessInfo.WithoutNull -> false + | NullnessInfo.WithNull -> true) + +/// The F# 4.5 and 5.0 logic about whether a type uses 'null' as a true representation value let TypeNullIsTrueValue g ty = (match tryDestAppTy g ty with | ValueSome tcref -> IsUnionTypeWithNullAsTrueValue g tcref.Deref - | _ -> false) || (isUnitTy g ty) + | _ -> false) + || (isUnitTy g ty) +/// Indicates if unbox(null) is actively rejected at runtime. See nullability RFC. This applies to types that don't have null +/// as a valid runtime representation under old compatiblity rules. let TypeNullNotLiked g m ty = - not (TypeNullIsExtraValue g m ty) + not (TypeNullIsExtraValueOld g m ty) && not (TypeNullIsTrueValue g ty) && not (TypeNullNever g ty) -let TypeSatisfiesNullConstraint g m ty = - TypeNullIsExtraValue g m ty - -let rec TypeHasDefaultValue g m ty = +let rec TypeHasDefaultValue isNew g m ty = let ty = stripTyEqnsAndMeasureEqns g ty - TypeSatisfiesNullConstraint g m ty + (if isNew then TypeNullIsExtraValueNew g m ty else TypeNullIsExtraValueOld g m ty) || (isStructTy g ty && // Is it an F# struct type? (if isFSharpStructTy g ty then @@ -7903,18 +8004,21 @@ let rec TypeHasDefaultValue g m ty = // We can ignore fields with the DefaultValue(false) attribute |> List.filter (fun fld -> not (TryFindFSharpBoolAttribute g g.attrib_DefaultValueAttribute fld.FieldAttribs = Some false)) - flds |> List.forall (actualTyOfRecdField (mkTyconRefInst tcref tinst) >> TypeHasDefaultValue g m) + flds |> List.forall (actualTyOfRecdField (mkTyconRefInst tcref tinst) >> TypeHasDefaultValue isNew g m) elif isStructTupleTy g ty then - destStructTupleTy g ty |> List.forall (TypeHasDefaultValue g m) + destStructTupleTy g ty |> List.forall (TypeHasDefaultValue isNew g m) elif isStructAnonRecdTy g ty then match tryDestAnonRecdTy g ty with | ValueNone -> true - | ValueSome (_, ptys) -> ptys |> List.forall (TypeHasDefaultValue g m) + | ValueSome (_, ptys) -> ptys |> List.forall (TypeHasDefaultValue isNew g m) else // All struct types defined in other .NET languages have a DefaultValue regardless of their // instantiation true)) +let TypeHasDefaultValueOld g m ty = TypeHasDefaultValue false g m ty + +let TypeHasDefaultValueNew g m ty = TypeHasDefaultValue true g m ty /// Determines types that are potentially known to satisfy the 'comparable' constraint and returns /// a set of residual types that must also satisfy the constraint @@ -8138,7 +8242,7 @@ type PrettyNaming.ActivePatternInfo with if apinfo.IsTotal then choicety else mkOptionTy g choicety member apinfo.OverallType g m dty rtys = - mkFunTy dty (apinfo.ResultType g m rtys) + mkFunTy g dty (apinfo.ResultType g m rtys) //--------------------------------------------------------------------------- // Active pattern validation @@ -8702,15 +8806,15 @@ let rec mkCompiledTuple g isStruct (argtys, args, m) = | [ty8], [arg8] -> match ty8 with // if it's already been nested or ended, pass it through - | TType_app(tn, _) when (isCompiledTupleTyconRef g tn) -> + | TType_app(tn, _, _) when (isCompiledTupleTyconRef g tn) -> ty8, arg8 | _ -> - let ty8enc = TType_app((if isStruct then g.struct_tuple1_tcr else g.ref_tuple1_tcr), [ty8]) + let ty8enc = TType_app((if isStruct then g.struct_tuple1_tcr else g.ref_tuple1_tcr), [ty8], g.knownWithoutNull) let v8enc = Expr.Op (TOp.Tuple (mkTupInfo isStruct), [ty8], [arg8], m) ty8enc, v8enc | _ -> let a, b, c, d = mkCompiledTuple g isStruct (argtysB, argsB, m) - let ty8plus = TType_app(a, b) + let ty8plus = TType_app (a, b, g.knownWithoutNull) let v8plus = Expr.Op (TOp.Tuple (mkTupInfo isStruct), b, c, d) ty8plus, v8plus let argtysAB = argtysA @ [ty8] @@ -8873,7 +8977,7 @@ let DetectAndOptimizeForExpression g option expr = mkLet spBind mEnumExpr currentVar enumerableExpr // let mutable next = current.TailOrNull (mkCompGenLet mForLoop nextVar tailOrNullExpr - // while nonNull next dp + // while notNull next dp (mkWhile g (spWhileLoop, WhileLoopForCompiledForEachExprMarker, guardExpr, bodyExpr, mBody))) expr diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index f9011081bbf..5df6ed9684b 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -35,10 +35,7 @@ val measureEquiv : TcGlobals -> Measure -> Measure -> bool val stripTyEqnsWrtErasure: Erasure -> TcGlobals -> TType -> TType /// Build a function type -val mkFunTy : TType -> TType -> TType - -/// Build a function type -val ( --> ) : TType -> TType -> TType +val mkFunTy : TcGlobals -> TType -> TType -> TType /// Build a type-forall anonymous generic type if necessary val mkForallTyIfNeeded : Typars -> TType -> TType @@ -46,16 +43,16 @@ val mkForallTyIfNeeded : Typars -> TType -> TType val ( +-> ) : Typars -> TType -> TType /// Build a curried function type -val mkIteratedFunTy : TTypes -> TType -> TType +val mkIteratedFunTy : TcGlobals -> TTypes -> TType -> TType /// Get the natural type of a single argument amongst a set of curried arguments val typeOfLambdaArg : range -> Val list -> TType -/// Get the curried type corresponding to a lambda -val mkMultiLambdaTy : range -> Val list -> TType -> TType +/// Get the type corresponding to a lambda +val mkLambdaTy : TcGlobals -> Typars -> TTypes -> TType -> TType /// Get the curried type corresponding to a lambda -val mkLambdaTy : Typars -> TTypes -> TType -> TType +val mkMultiLambdaTy : TcGlobals -> range -> Val list -> TType -> TType /// Module publication, used while compiling fslib. val ensureCcuHasModuleOrNamespaceAtPath : CcuThunk -> Ident list -> CompilationPath -> XmlDoc -> unit @@ -69,6 +66,14 @@ val valsOfBinds : Bindings -> Vals /// Look for a use of an F# value, possibly including application of a generic thing to a set of type arguments val (|ExprValWithPossibleTypeInst|_|) : Expr -> (ValRef * ValUseFlag * TType list * range) option +//val combineNullness: Nullness -> Nullness -> Nullness +//val tryAddNullnessToTy: Nullness -> TType -> TType option +//val addNullnessToTy: Nullness -> TType -> TType + +//------------------------------------------------------------------------- +// Build decision trees imperatively +//------------------------------------------------------------------------- + /// Build decision trees imperatively type MatchBuilder = @@ -141,16 +146,16 @@ val mkObjExpr : TType * Val option * Expr * ObjExprMethod list * (TType * ObjExp val mkTypeChoose : range -> Typars -> Expr -> Expr /// Build an iterated (curried) lambda expression -val mkLambdas : range -> Typars -> Val list -> Expr * TType -> Expr +val mkLambdas : TcGlobals -> range -> Typars -> Val list -> Expr * TType -> Expr /// Build an iterated (tupled+curried) lambda expression -val mkMultiLambdasCore : range -> Val list list -> Expr * TType -> Expr * TType +val mkMultiLambdasCore : TcGlobals -> range -> Val list list -> Expr * TType -> Expr * TType /// Build an iterated generic (type abstraction + tupled+curried) lambda expression -val mkMultiLambdas : range -> Typars -> Val list list -> Expr * TType -> Expr +val mkMultiLambdas : TcGlobals -> range -> Typars -> Val list list -> Expr * TType -> Expr /// Build a lambda expression that corresponds to the implementation of a member -val mkMemberLambdas : range -> Typars -> Val option -> Val option -> Val list list -> Expr * TType -> Expr +val mkMemberLambdas : TcGlobals -> range -> Typars -> Val option -> Val option -> Val list list -> Expr * TType -> Expr /// Build a 'while' loop expression val mkWhile : TcGlobals -> SequencePointInfoForWhileLoop * SpecialWhileLoopMarker * Expr * Expr * range -> Expr @@ -180,7 +185,7 @@ val mkLetsFromBindings : range -> Bindings -> Expr -> Expr val mkLet : SequencePointInfoForBinding -> range -> Val -> Expr -> Expr -> Expr /// Make a binding that binds a function value to a lambda taking multiple arguments -val mkMultiLambdaBind : Val -> SequencePointInfoForBinding -> range -> Typars -> Val list list -> Expr * TType -> Binding +val mkMultiLambdaBind : TcGlobals -> Val -> SequencePointInfoForBinding -> range -> Typars -> Val list list -> Expr * TType -> Binding // Compiler generated bindings may involve a user variable. // Compiler generated bindings may give rise to a sequence point if they are part of @@ -554,11 +559,12 @@ val instTrait : TyparInst -> TraitConstraintInfo -> TraitConstraint // From typars to types //------------------------------------------------------------------------- +val generalTyconRefInst : TyconRef -> TypeInst val generalizeTypars : Typars -> TypeInst -val generalizeTyconRef : TyconRef -> TTypes * TType +val generalizeTyconRef : TcGlobals -> TyconRef -> TTypes * TType -val generalizedTyconRef : TyconRef -> TType +val generalizedTyOfTyconRef : TcGlobals -> TyconRef -> TType val mkTyparToTyparRenaming : Typars -> Typars -> TyparInst * TTypes @@ -614,6 +620,7 @@ val destAnyParTy : TcGlobals -> TType -> Typar val destMeasureTy : TcGlobals -> TType -> Measure val tryDestForallTy : TcGlobals -> TType -> Typars * TType +val nullnessOfTy : TcGlobals -> TType -> Nullness val isFunTy : TcGlobals -> TType -> bool @@ -1467,7 +1474,7 @@ val destArrayTy : TcGlobals -> TType -> TType val destListTy : TcGlobals -> TType -> TType /// Build an array type of the given rank -val mkArrayTy : TcGlobals -> int -> TType -> range -> TType +val mkArrayTy : TcGlobals -> int -> Nullness -> TType -> range -> TType /// Check if a type definition is one of the artifical type definitions used for array types of different ranks val isArrayTyconRef : TcGlobals -> TyconRef -> bool @@ -1566,17 +1573,21 @@ val ModuleNameIsMangled : TcGlobals -> Attribs -> bool val CompileAsEvent : TcGlobals -> Attribs -> bool -val TypeNullIsExtraValue : TcGlobals -> range -> TType -> bool - val TypeNullIsTrueValue : TcGlobals -> TType -> bool -val TypeNullNotLiked : TcGlobals -> range -> TType -> bool +val TypeNullIsExtraValueNew : TcGlobals -> range -> TType -> bool + +val TypeNullIsExtraValueOld : TcGlobals -> range -> TType -> bool + +val TyconRefNullIsExtraValueOld : TcGlobals -> range -> TyconRef -> bool + +val TyconRefNullIsExtraValueNew : TcGlobals -> range -> TyconRef -> bool val TypeNullNever : TcGlobals -> TType -> bool -val TypeSatisfiesNullConstraint : TcGlobals -> range -> TType -> bool +val TypeHasDefaultValueNew: TcGlobals -> range -> TType -> bool -val TypeHasDefaultValue : TcGlobals -> range -> TType -> bool +val TypeHasDefaultValueOld: TcGlobals -> range -> TType -> bool val isAbstractTycon : Tycon -> bool @@ -1799,8 +1810,6 @@ val mkCallBox : TcGlobals -> range -> TType -> Expr -> Expr val mkCallIsNull : TcGlobals -> range -> TType -> Expr -> Expr -val mkCallIsNotNull : TcGlobals -> range -> TType -> Expr -> Expr - val mkCallRaise : TcGlobals -> range -> TType -> Expr -> Expr val mkCallGenericComparisonWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr @@ -2028,7 +2037,11 @@ val TryFindAttributeUsageAttribute : TcGlobals -> range -> TyconRef -> bool opti #if !NO_EXTENSIONTYPING /// returns Some(assemblyName) for success +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE val TryDecodeTypeProviderAssemblyAttr : ILGlobals -> ILAttribute -> string option +#else +val TryDecodeTypeProviderAssemblyAttr : ILGlobals -> ILAttribute -> string? option +#endif #endif val IsSignatureDataVersionAttr : ILAttribute -> bool diff --git a/src/fsharp/TastPickle.fs b/src/fsharp/TastPickle.fs old mode 100644 new mode 100755 index da6906cf33c..7a241b40dd7 --- a/src/fsharp/TastPickle.fs +++ b/src/fsharp/TastPickle.fs @@ -109,8 +109,9 @@ type NodeOutTable<'Data, 'Node> = Table = Table<_>.Create nm } [] -type WriterState = - { os: ByteBuffer +type WriterState = + { os: ByteBuffer + osB: ByteBuffer oscope: CcuThunk occus: Table oentities: NodeOutTable @@ -142,8 +143,10 @@ type NodeInTable<'Data, 'Node> = { LinkNode = lnk; IsLinked = isLinked; Name = nm; Nodes = Array.init n (fun _i -> mkEmpty() ) } [] -type ReaderState = - { is: ByteStream +type ReaderState = + { is: ByteStream + // secondary stream of information for F# 5.0 + isB: ByteStream iilscope: ILScopeRef iccus: InputTable ientities: NodeInTable @@ -167,17 +170,27 @@ let ufailwith st str = ffailwith st.ifile str type 'T pickler = 'T -> WriterState -> unit let p_byte b st = st.os.EmitIntAsByte b +let p_byteB b st = st.osB.EmitIntAsByte b let p_bool b st = p_byte (if b then 1 else 0) st -let prim_p_int32 i st = + +/// Write an uncompressed integer to the main stream. +let prim_p_int32 i st = p_byte (b0 i) st p_byte (b1 i) st p_byte (b2 i) st p_byte (b3 i) st -/// Compress integers according to the same scheme used by CLR metadata -/// This halves the size of pickled data -let p_int32 n st = - if n >= 0 && n <= 0x7F then +/// Write an uncompressed integer to the B stream. +let prim_p_int32B i st = + p_byteB (b0 i) st + p_byteB (b1 i) st + p_byteB (b2 i) st + p_byteB (b3 i) st + +/// Compress integers according to the same scheme used by CLR metadata +/// This halves the size of pickled data +let p_int32 n st = + if n >= 0 && n <= 0x7F then p_byte (b0 n) st else if n >= 0x80 && n <= 0x3FFF then p_byte ( (0x80 ||| (n >>> 8))) st @@ -186,6 +199,17 @@ let p_int32 n st = p_byte 0xFF st prim_p_int32 n st +/// Write a compressed integer to the B stream. +let p_int32B n st = + if n >= 0 && n <= 0x7F then + p_byteB (b0 n) st + else if n >= 0x80 && n <= 0x3FFF then + p_byteB ( (0x80 ||| (n >>> 8))) st + p_byteB ( (n &&& 0xFF)) st + else + p_byteB 0xFF st + prim_p_int32B n st + let space = () let p_space n () st = for i = 0 to n - 1 do @@ -210,6 +234,7 @@ let p_prim_string (s: string) st = st.os.EmitBytes bytes let p_int c st = p_int32 c st +let p_intB c st = p_int32B c st let p_int8 (i: sbyte) st = p_int32 (int32 i) st let p_uint8 (i: byte) st = p_byte (int i) st let p_int16 (i: int16) st = p_int32 (int32 i) st @@ -261,20 +286,32 @@ let inline p_tup11 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 (a, b, c, d, e, f, x7, x8 let u_byte st = int (st.is.ReadByte()) +/// Unpickle an uncompressed integer from the B stream +/// The extra B stream of bytes is implicitly 0 if not present +let u_byteB st = + if st.isB.IsEOF then 0 else int (st.isB.ReadByte()) + type unpickler<'T> = ReaderState -> 'T let u_bool st = let b = u_byte st in (b = 1) - - -let prim_u_int32 st = +/// Unpickle an uncompressed integer from the main stream +let prim_u_int32 st = let b0 = (u_byte st) let b1 = (u_byte st) let b2 = (u_byte st) let b3 = (u_byte st) b0 ||| (b1 <<< 8) ||| (b2 <<< 16) ||| (b3 <<< 24) -let u_int32 st = +/// Unpickle an uncompressed integer from the B stream +let prim_u_int32B st = + let b0 = u_byteB st + let b1 = u_byteB st + let b2 = u_byteB st + let b3 = u_byteB st + b0 ||| (b1 <<< 8) ||| (b2 <<< 16) ||| (b3 <<< 24) + +let u_int32 st = let b0 = u_byte st if b0 <= 0x7F then b0 else if b0 <= 0xbf then @@ -285,7 +322,20 @@ let u_int32 st = assert(b0 = 0xFF) prim_u_int32 st -let u_bytes st = +/// Unpickle a compressed integer from the B stream. +/// The integer is 0 if the B stream is not present. +let u_int32B st = + let b0 = u_byteB st + if b0 <= 0x7F then b0 + else if b0 <= 0xbf then + let b0 = b0 &&& 0x7F + let b1 = u_byteB st + (b0 <<< 8) ||| b1 + else + assert(b0 = 0xFF) + prim_u_int32B st + +let u_bytes st = let n = (u_int32 st) st.is.ReadBytes n @@ -294,6 +344,7 @@ let u_prim_string st = st.is.ReadUtf8String len let u_int st = u_int32 st +let u_intB st = u_int32B st let u_int8 st = sbyte (u_int32 st) let u_uint8 st = byte (u_byte st) let u_int16 st = int16 (u_int32 st) @@ -371,38 +422,12 @@ let inline u_tup11 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 (st: ReaderState) = let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in (a, b, c, d, e, f, x7, x8, x9, x10, x11) -let inline u_tup12 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in - (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12) - let inline u_tup13 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 (st: ReaderState) = let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13) -let inline u_tup14 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in - let x14 = p14 st in - (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14) -let inline u_tup15 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in - let x14 = p14 st in let x15 = p15 st in - (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14, x15) - -let inline u_tup16 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in - let x14 = p14 st in let x15 = p15 st in let x16 = p16 st in - (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) - let inline u_tup17 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 (st: ReaderState) = let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in @@ -471,6 +496,10 @@ let p_array f (x: 'T[]) st = p_int x.Length st p_array_core f x st +let p_arrayB f (x: 'T[]) st = + p_intB x.Length st + p_array_core f x st + // Optionally encode an extra item using a marker bit. // When extraf is None, the marker bit is not set, and this is identical to p_array. let p_array_ext extraf f (x: 'T[]) st = @@ -489,7 +518,12 @@ let p_list_core f (xs: 'T list) st = let p_list f x st = p_int (List.length x) st p_list_core f x st -let p_list_ext extraf f x st = + +let p_listB f x st = + p_intB (List.length x) st + p_list_core f x st + +let p_list_ext extraf f x st = let n = List.length x let n = if Option.isSome extraf then n ||| 0x80000000 else n p_int n st @@ -569,6 +603,11 @@ let u_array f st = let n = u_int st u_array_core f n st +/// Unpickle an array from the B stream. The array is empty if the B stream is not present. +let u_arrayB f st = + let n = u_intB st + u_array_core f n st + // Optionally decode an extra item if a marker bit is present. // When the marker bit is not set this is identical to u_array, and extraf is not called let u_array_ext extraf f st = @@ -581,22 +620,12 @@ let u_array_ext extraf f st = let arr = u_array_core f (n &&& 0x7FFFFFFF) st extraItem, arr -let u_list_core f n st = - [ for _ in 1..n do - yield f st ] +let u_list f st = Array.toList (u_array f st) -let u_list f st = - let n = u_int st - u_list_core f n st -let u_list_ext extra f st = - let n = u_int st - let extraItem = - if n &&& 0x80000000 = 0x80000000 then - Some (extra st) - else - None - let list = u_list_core f (n &&& 0x7FFFFFFF) st - extraItem, list +/// Unpickle a list from the B stream. The resulting list is empty if the B stream is not present. +let u_listB f st = Array.toList (u_arrayB f st) + +let u_list_ext extra f st = let v, res = u_array_ext extra f st in v, Array.toList res #if FLAT_LIST_AS_LIST #else @@ -634,13 +663,7 @@ let u_option f st = | 1 -> Some (f st) | n -> ufailwith st ("u_option: found number " + string n) -// Boobytrap an OSGN node with a force of a lazy load of a bunch of pickled data -#if LAZY_UNPICKLE -let wire (x: osgn<_>) (res: Lazy<_>) = - x.osgnTripWire <- Some(fun () -> res.Force() |> ignore) -#endif - -let u_lazy u st = +let u_lazy u st = // Read the number of bytes in the record let len = prim_u_int32 st // fixupPos1 @@ -652,25 +675,8 @@ let u_lazy u st = let ovalsIdx1 = prim_u_int32 st // fixupPos6 let ovalsIdx2 = prim_u_int32 st // fixupPos7 -#if LAZY_UNPICKLE - // Record the position in the bytestream to use when forcing the read of the data - let idx1 = st.is.Position - // Skip the length of data - st.is.Skip len - // This is the lazy computation that wil force the unpickling of the term. - // This term must contain OSGN definitions of the given nodes. - let res = - lazy (let st = { st with is = st.is.CloneAndSeek idx1 } - u st) - /// Force the reading of the data as a "tripwire" for each of the OSGN thunks - for i = otyconsIdx1 to otyconsIdx2-1 do wire (st.ientities.Get i) res done - for i = ovalsIdx1 to ovalsIdx2-1 do wire (st.ivals.Get i) res done - for i = otyparsIdx1 to otyparsIdx2-1 do wire (st.itypars.Get i) res done - res -#else ignore (len, otyconsIdx1, otyconsIdx2, otyparsIdx1, otyparsIdx2, ovalsIdx1, ovalsIdx2) Lazy.CreateFromValue(u st) -#endif let u_hole () = @@ -751,9 +757,14 @@ let encode_nleref ccuTab stringTab nlerefTab thisCcu (nleref: NonLocalEntityRef) let p_encoded_nleref = p_tup2 p_int (p_array p_int) let p_nleref x st = p_int (encode_nleref st.occus st.ostrings st.onlerefs st.oscope x) st -// Simple types are types like "int", represented as TType(Ref_nonlocal(..., "int"), []). -// A huge number of these occur in pickled F# data, so make them unique. -let decode_simpletyp st _ccuTab _stringTab nlerefTab a = TType_app(ERefNonLocal (lookup_nleref st nlerefTab a), []) +// Simple types are types like "int", represented as TType(Ref_nonlocal(...,"int"),[]). +// A huge number of these occur in pickled F# data, so make them unique. +// +// TODO NULLNESS - the simpletyp table now holds KnownAmbivalentToNull by default, is this the right default? +// For old assemblies it is, if we give those assemblies the ambivalent interpretation. +// For new asemblies compiled with null-checking on it isn't, if the default is to give +// those the KnownWithoutNull interpretation by default. +let decode_simpletyp st _ccuTab _stringTab nlerefTab a = TType_app(ERefNonLocal (lookup_nleref st nlerefTab a), [], KnownAmbivalentToNull) let lookup_simpletyp st simpleTyTab x = lookup_uniq st simpleTyTab x let u_encoded_simpletyp st = u_int st let u_encoded_anoninfo st = u_int st @@ -763,10 +774,11 @@ let p_encoded_simpletyp x st = p_int x st let p_encoded_anoninfo x st = p_int x st let p_simpletyp x st = p_int (encode_simpletyp st.occus st.ostrings st.onlerefs st.osimpletys st.oscope x) st -let pickleObjWithDanglingCcus inMem file g scope p x = - let ccuNameTab, (ntycons, ntypars, nvals, nanoninfos), stringTab, pubpathTab, nlerefTab, simpleTyTab, phase1bytes = - let st1 = - { os = ByteBuffer.Create 100000 +let pickleObjWithDanglingCcus inMem file (g: TcGlobals) scope p x = + let ccuNameTab,(ntycons, ntypars, nvals, nanoninfos),stringTab,pubpathTab,nlerefTab,simpleTyTab,phase1bytes,phase1bytesB = + let st1 = + { os = ByteBuffer.Create 100000 + osB = ByteBuffer.Create 100000 oscope=scope occus= Table<_>.Create "occus" oentities=NodeOutTable<_, _>.Create((fun (tc: Tycon) -> tc.Stamp), (fun tc -> tc.LogicalName), (fun tc -> tc.Range), (fun osgn -> osgn), "otycons") @@ -780,18 +792,19 @@ let pickleObjWithDanglingCcus inMem file g scope p x = oglobals=g ofile=file oInMem=inMem - isStructThisArgPos = false} + isStructThisArgPos = false } p x st1 let sizes = st1.oentities.Size, st1.otypars.Size, st1.ovals.Size, - st1.oanoninfos.Size - st1.occus, sizes, st1.ostrings, st1.opubpaths, st1.onlerefs, st1.osimpletys, st1.os.Close() + st1.oanoninfos.Size + st1.occus, sizes, st1.ostrings, st1.opubpaths,st1.onlerefs, st1.osimpletys, st1.os.Close(), st1.osB.Close() - let phase2bytes = - let st2 = - { os = ByteBuffer.Create 100000 + let phase2bytes, phase2bytesB = + let st2 = + { os = ByteBuffer.Create 100000 + osB = ByteBuffer.Create 100000 oscope=scope occus= Table<_>.Create "occus (fake)" oentities=NodeOutTable<_, _>.Create((fun (tc: Tycon) -> tc.Stamp), (fun tc -> tc.LogicalName), (fun tc -> tc.Range), (fun osgn -> osgn), "otycons") @@ -807,12 +820,16 @@ let pickleObjWithDanglingCcus inMem file g scope p x = oInMem=inMem isStructThisArgPos = false } p_array p_encoded_ccuref ccuNameTab.AsArray st2 - // Add a 4th integer indicated by a negative 1st integer + + // For F# 5.0 and beyond we add a 4th integer for nanoninfos, indicated by a negative 1st integer + // Note that this means assemblies using anonymous record types are not binary-metadata consumable by previous + // generation F# tooling. let z1 = if nanoninfos > 0 then -ntycons-1 else ntycons p_int z1 st2 p_tup2 p_int p_int (ntypars, nvals) st2 if nanoninfos > 0 then p_int nanoninfos st2 + p_tup5 (p_array p_encoded_string) (p_array p_encoded_pubpath) @@ -821,10 +838,13 @@ let pickleObjWithDanglingCcus inMem file g scope p x = p_bytes (stringTab.AsArray, pubpathTab.AsArray, nlerefTab.AsArray, simpleTyTab.AsArray, phase1bytes) st2 - st2.os.Close() - phase2bytes + st2.os.Close(), st2.osB.Close() + + if phase2bytesB.Length <> 0 then failwith "expected phase2bytesB.Length = 0" -let check (ilscope: ILScopeRef) (inMap : NodeInTable<_, _>) = + phase2bytes, phase1bytesB + +let check (ilscope: ILScopeRef) (inMap: NodeInTable<_,_>) = for i = 0 to inMap.Count - 1 do let n = inMap.Get i if not (inMap.IsLinked n) then @@ -834,19 +854,20 @@ let check (ilscope: ILScopeRef) (inMap : NodeInTable<_, _>) = // an identical copy of the source for the DLL containing the data being unpickled. A message will // then be printed indicating the name of the item. -let unpickleObjWithDanglingCcus file ilscope (iILModule: ILModuleDef option) u (phase2bytes: byte[]) = - let st2 = - { is = ByteStream.FromBytes (phase2bytes, 0, phase2bytes.Length) +let unpickleObjWithDanglingCcus file ilscope (iILModule: ILModuleDef option) u (phase2bytes:byte[]) (phase1bytesB:byte[]) = + let st2 = + { is = ByteStream.FromBytes (phase2bytes,0,phase2bytes.Length) + isB = ByteStream.FromBytes ([| |],0,0) iilscope= ilscope - iccus= new_itbl "iccus (fake)" [| |] - ientities= NodeInTable<_, _>.Create (Tycon.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "itycons", 0) - itypars= NodeInTable<_, _>.Create (Typar.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "itypars", 0) - ivals = NodeInTable<_, _>.Create (Val.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "ivals", 0) - ianoninfos=NodeInTable<_, _>.Create(AnonRecdTypeInfo.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "ianoninfos", 0) - istrings = new_itbl "istrings (fake)" [| |] - inlerefs = new_itbl "inlerefs (fake)" [| |] - ipubpaths = new_itbl "ipubpaths (fake)" [| |] - isimpletys = new_itbl "isimpletys (fake)" [| |] + iccus= new_itbl "iccus (fake)" [| |] + ientities= NodeInTable<_,_>.Create (Tycon.NewUnlinked, (fun osgn tg -> osgn.Link tg),(fun osgn -> osgn.IsLinked),"ientities",0) + itypars= NodeInTable<_,_>.Create (Typar.NewUnlinked, (fun osgn tg -> osgn.Link tg),(fun osgn -> osgn.IsLinked),"itypars",0) + ivals = NodeInTable<_,_>.Create (Val.NewUnlinked , (fun osgn tg -> osgn.Link tg),(fun osgn -> osgn.IsLinked),"ivals",0) + ianoninfos=NodeInTable<_,_>.Create(AnonRecdTypeInfo.NewUnlinked, (fun osgn tg -> osgn.Link tg),(fun osgn -> osgn.IsLinked),"ianoninfos",0) + istrings = new_itbl "istrings (fake)" [| |] + inlerefs = new_itbl "inlerefs (fake)" [| |] + ipubpaths = new_itbl "ipubpaths (fake)" [| |] + isimpletys = new_itbl "isimpletys (fake)" [| |] ifile=file iILModule = iILModule } let ccuNameTab = u_array u_encoded_ccuref st2 @@ -867,27 +888,27 @@ let unpickleObjWithDanglingCcus file ilscope (iILModule: ILModuleDef option) u ( let pubpathTab = new_itbl "ipubpaths" (Array.map (decode_pubpath st2 stringTab) pubpathTab) let nlerefTab = new_itbl "inlerefs" (Array.map (decode_nleref st2 ccuTab stringTab) nlerefTab) let simpletypTab = new_itbl "simpleTyTab" (Array.map (decode_simpletyp st2 ccuTab stringTab nlerefTab) simpleTyTab) - let data = - let st1 = - { is = ByteStream.FromBytes (phase1bytes, 0, phase1bytes.Length) - iccus= ccuTab - iilscope= ilscope - ientities= NodeInTable<_, _>.Create(Tycon.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "itycons", ntycons) - itypars= NodeInTable<_, _>.Create(Typar.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "itypars", ntypars) - ivals= NodeInTable<_, _>.Create(Val.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "ivals", nvals) - ianoninfos=NodeInTable<_, _>.Create(AnonRecdTypeInfo.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "ianoninfos", nanoninfos) + let data = + let st1 = + { is = ByteStream.FromBytes (phase1bytes,0,phase1bytes.Length) + isB = ByteStream.FromBytes (phase1bytesB,0,phase1bytesB.Length) + iccus = ccuTab + iilscope = ilscope + ientities = NodeInTable<_, _>.Create(Tycon.NewUnlinked,(fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked),"ientities", ntycons) + itypars = NodeInTable<_, _>.Create(Typar.NewUnlinked,(fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked),"itypars", ntypars) + ivals = NodeInTable<_, _>.Create(Val.NewUnlinked ,(fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked),"ivals", nvals) + ianoninfos = NodeInTable<_, _>.Create(AnonRecdTypeInfo.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked),"ianoninfos", nanoninfos) istrings = stringTab ipubpaths = pubpathTab inlerefs = nlerefTab isimpletys = simpletypTab - ifile=file + ifile = file iILModule = iILModule } let res = u st1 -#if !LAZY_UNPICKLE + check ilscope st1.ientities check ilscope st1.ientities check ilscope st1.ivals check ilscope st1.itypars -#endif res {RawData=data; FixupThunks=ccuTab.itbl_rows } @@ -1601,7 +1622,7 @@ let p_tyar_constraint x st = | TyparConstraint.MayResolveMember(traitInfo, _) -> p_byte 1 st; p_trait traitInfo st | TyparConstraint.DefaultsTo(_, rty, _) -> p_byte 2 st; p_ty rty st | TyparConstraint.SupportsNull _ -> p_byte 3 st - | TyparConstraint.IsNonNullableStruct _ -> p_byte 4 st + | TyparConstraint.IsNonNullableStruct _ -> p_byte 4 st | TyparConstraint.IsReferenceType _ -> p_byte 5 st | TyparConstraint.RequiresDefaultConstructor _ -> p_byte 6 st | TyparConstraint.SimpleChoice(tys, _) -> p_byte 7 st; p_tys tys st @@ -1610,7 +1631,20 @@ let p_tyar_constraint x st = | TyparConstraint.SupportsComparison _ -> p_byte 10 st | TyparConstraint.SupportsEquality _ -> p_byte 11 st | TyparConstraint.IsUnmanaged _ -> p_byte 12 st -let p_tyar_constraints = (p_list p_tyar_constraint) + | TyparConstraint.NotSupportsNull _ -> + failwith "NotSupportsNull constraints should only be emitted to streamB" + +// Some extra F# 5.0 constraints are stored in stream B, these will be ignored by earlier F# compilers +let p_tyar_constraintB x st = + match x with + | TyparConstraint.NotSupportsNull _ -> p_byteB 1 st + | _ -> failwith "only NotSupportsNull constraints should be emitted to streamB" + +let p_tyar_constraints cxs st = + let cxs1, cxs2 = cxs |> List.partition (function TyparConstraint.NotSupportsNull _ -> false | _ -> true) + p_list p_tyar_constraint cxs1 st + // Some extra F# 5.0 constraints are stored in stream B, these will be ignored by earlier F# compilers + p_listB p_tyar_constraintB cxs2 st let u_tyar_constraint st = let tag = u_byte st @@ -1630,9 +1664,21 @@ let u_tyar_constraint st = | 12 -> (fun _ -> TyparConstraint.IsUnmanaged range0) | _ -> ufailwith st "u_tyar_constraint" - -let u_tyar_constraints = (u_list_revi u_tyar_constraint) - +// Some extra F# 5.0 constraints are stored in stream B, these will be ignored by earlier F# compilers +let u_tyar_constraintB st = + let tag = u_byteB st + match tag with + | 1 -> TyparConstraint.NotSupportsNull range0 + | _ -> ufailwith st "u_tyar_constraintB - unexpected constraint in streamB" + +let u_tyar_constraints st = + let cxs1 = u_list_revi u_tyar_constraint st + // Some extra F# 5.0 constraints are stored in stream B, these will be ignored by earlier F# compilers + // + // If the B stream is not present (e.g. reading F# 4.5 components) then this list will be empty + // via the implementation of u_listB. + let cxs2 = u_listB u_tyar_constraintB st + cxs1 @ cxs2 let p_tyar_spec_data (x: Typar) st = p_tup5 @@ -1684,36 +1730,116 @@ let _ = fill_p_ty2 (fun isStructThisArgPos ty st -> p_byte 8 st; p_tys l st else p_byte 0 st; p_tys l st - | TType_app(ERefNonLocal nleref, []) -> p_byte 1 st; p_simpletyp nleref st - | TType_app (tc, tinst) -> p_byte 2 st; p_tup2 (p_tcref "typ") p_tys (tc, tinst) st - | TType_fun (d, r) -> + + | TType_app(ERefNonLocal nleref, [], nullness) -> + if st.oglobals.langFeatureNullness then + match nullness.Evaluate() with + | NullnessInfo.WithNull -> p_byteB 9 st + | NullnessInfo.WithoutNull -> p_byteB 10 st + | NullnessInfo.AmbivalentToNull -> p_byteB 11 st + p_byte 1 st; p_simpletyp nleref st + + | TType_app (tc, tinst, nullness) -> + if st.oglobals.langFeatureNullness then + match nullness.Evaluate() with + | NullnessInfo.WithNull -> p_byteB 12 st + | NullnessInfo.WithoutNull -> p_byteB 13 st + | NullnessInfo.AmbivalentToNull -> p_byteB 14 st + p_byte 2 st; p_tcref "typ" tc st; p_tys tinst st + + | TType_fun (d,r,nullness) -> + if st.oglobals.langFeatureNullness then + match nullness.Evaluate() with + | NullnessInfo.WithNull -> p_byteB 15 st + | NullnessInfo.WithoutNull -> p_byteB 16 st + | NullnessInfo.AmbivalentToNull -> p_byteB 17 st p_byte 3 st // Note, the "this" argument may be found in the domain position of a function type, so propagate the isStructThisArgPos value p_ty2 isStructThisArgPos d st p_ty r st - | TType_var r -> p_byte 4 st; p_tpref r st - | TType_forall (tps, r) -> + + | TType_var (r, nullness) -> + if st.oglobals.langFeatureNullness then + match nullness.Evaluate() with + | NullnessInfo.WithNull -> p_byteB 18 st + | NullnessInfo.WithoutNull -> p_byteB 19 st + | NullnessInfo.AmbivalentToNull -> p_byteB 20 st + p_byte 4 st + p_tpref r st + + | TType_forall (tps,r) -> p_byte 5 st p_tyar_specs tps st // Note, the "this" argument may be found in the body of a generic forall type, so propagate the isStructThisArgPos value p_ty2 isStructThisArgPos r st - | TType_measure unt -> p_byte 6 st; p_measure_expr unt st - | TType_ucase (uc, tinst) -> p_byte 7 st; p_tup2 p_ucref p_tys (uc, tinst) st + + | TType_measure unt -> p_byte 6 st; p_measure_expr unt st + + | TType_ucase (uc, tinst) -> p_byte 7 st; p_tup2 p_ucref p_tys (uc, tinst) st + // p_byte 8 taken by TType_tuple above | TType_anon (anonInfo, l) -> p_byte 9 st p_anonInfo anonInfo st - p_tys l st) + p_tys l st + ) let _ = fill_u_ty (fun st -> let tag = u_byte st + match tag with - | 0 -> let l = u_tys st in TType_tuple (tupInfoRef, l) - | 1 -> u_simpletyp st - | 2 -> let tc = u_tcref st in let tinst = u_tys st in TType_app (tc, tinst) - | 3 -> let d = u_ty st in let r = u_ty st in TType_fun (d, r) - | 4 -> let r = u_tpref st in r.AsType - | 5 -> let tps = u_tyar_specs st in let r = u_ty st in TType_forall (tps, r) + | 0 -> + let l = u_tys st + TType_tuple (tupInfoRef, l) + | 1 -> + let tagB = u_byteB st + let sty = u_simpletyp st + match tagB with + | 0 -> + sty + | 9 -> + match sty with + | TType_app(tcref, _, _) -> TType_app(tcref, [], KnownWithNull) + | _ -> ufailwith st "u_ty 9a" + | 10 -> + match sty with + | TType_app(tcref, _, _) -> TType_app(tcref, [], KnownWithoutNull) + | _ -> ufailwith st "u_ty 9b" + | 11 -> + match sty with + | TType_app(tcref, _, _) -> TType_app(tcref, [], KnownAmbivalentToNull) + | _ -> ufailwith st "u_ty 9c" + | b -> ufailwith st (sprintf "u_ty - 1/B, byte = %A" b) + | 2 -> + let tagB = u_byteB st + let tcref = u_tcref st + let tinst = u_tys st + match tagB with + | 0 -> TType_app (tcref, tinst, KnownAmbivalentToNull) + | 12 -> TType_app (tcref, tinst, KnownWithNull) + | 13 -> TType_app (tcref, tinst, KnownWithoutNull) + | 14 -> TType_app (tcref, tinst, KnownAmbivalentToNull) + | _ -> ufailwith st "u_ty - 2/B" + | 3 -> + let tagB = u_byteB st + let d = u_ty st + let r = u_ty st + match tagB with + | 0 -> TType_fun (d, r, KnownAmbivalentToNull) + | 15 -> TType_fun (d, r, KnownWithNull) + | 16 -> TType_fun (d, r, KnownWithoutNull) + | 17 -> TType_fun (d, r, KnownAmbivalentToNull) + | _ -> ufailwith st "u_ty - 3/B" + | 4 -> + let tagB = u_byteB st + let r = u_tpref st + match tagB with + | 0 -> r.AsType KnownAmbivalentToNull + | 18 -> r.AsType KnownWithNull + | 19 -> r.AsType KnownWithoutNull + | 20 -> r.AsType KnownAmbivalentToNull + | _ -> ufailwith st "u_ty - 4/B" + | 5 -> let tps = u_tyar_specs st in let r = u_ty st in TType_forall (tps,r) | 6 -> let unt = u_measure_expr st in TType_measure unt | 7 -> let uc = u_ucref st in let tinst = u_tys st in TType_ucase (uc, tinst) | 8 -> let l = u_tys st in TType_tuple (tupInfoStruct, l) diff --git a/src/fsharp/TastPickle.fsi b/src/fsharp/TastPickle.fsi index 9f1000580ae..efb4c5de746 100644 --- a/src/fsharp/TastPickle.fsi +++ b/src/fsharp/TastPickle.fsi @@ -82,7 +82,7 @@ val internal p_ty : pickler val internal pickleCcuInfo : pickler /// Serialize an arbitrary object using the given pickler -val pickleObjWithDanglingCcus : inMem: bool -> file: string -> TcGlobals -> scope:CcuThunk -> pickler<'T> -> 'T -> byte[] +val pickleObjWithDanglingCcus : inMem: bool -> file: string -> TcGlobals -> scope:CcuThunk -> pickler<'T> -> 'T -> byte[] * byte[] /// The type of state unpicklers read from type ReaderState @@ -142,7 +142,7 @@ val internal u_ty : unpickler val internal unpickleCcuInfo : ReaderState -> PickledCcuInfo /// Deserialize an arbitrary object which may have holes referring to other compilation units -val internal unpickleObjWithDanglingCcus : file:string -> viewedScope:ILScopeRef -> ilModule:ILModuleDef option -> ('T unpickler) -> byte[] -> PickledDataWithReferences<'T> +val internal unpickleObjWithDanglingCcus : file:string -> viewedScope:ILScopeRef -> ilModule:ILModuleDef option -> ('T unpickler) -> byte[] -> byte[] -> PickledDataWithReferences<'T> diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 337205632e3..6c2e43035a6 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -83,19 +83,6 @@ module FSharpLib = // Access the initial environment: helpers to build references //------------------------------------------------------------------------- -let private mkNonGenericTy tcref = TType_app(tcref, []) - -let mkNonLocalTyconRef2 ccu path n = mkNonLocalTyconRef (mkNonLocalEntityRef ccu path) n - -let mk_MFCore_tcref ccu n = mkNonLocalTyconRef2 ccu FSharpLib.CorePathArray n -let mk_MFQuotations_tcref ccu n = mkNonLocalTyconRef2 ccu FSharpLib.QuotationsPath n -let mk_MFLinq_tcref ccu n = mkNonLocalTyconRef2 ccu LinqPathArray n -let mk_MFCollections_tcref ccu n = mkNonLocalTyconRef2 ccu FSharpLib.CollectionsPathArray n -let mk_MFCompilerServices_tcref ccu n = mkNonLocalTyconRef2 ccu FSharpLib.CompilerServicesPath n -let mk_MFRuntimeHelpers_tcref ccu n = mkNonLocalTyconRef2 ccu FSharpLib.RuntimeHelpersPath n -let mk_MFControl_tcref ccu n = mkNonLocalTyconRef2 ccu FSharpLib.ControlPathArray n - - type [] BuiltinAttribInfo = @@ -176,12 +163,31 @@ let tname_IAsyncResult = "System.IAsyncResult" //------------------------------------------------------------------------- type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, directoryToResolveRelativePaths, - mlCompatibility: bool, isInteractive:bool, + mlCompatibility: bool, isInteractive:bool, assumeNullOnImport: bool, checkNullness: bool, langVersion: double, // The helper to find system types amongst referenced DLLs tryFindSysTypeCcu, emitDebugInfoInQuotations: bool, noDebugData: bool, pathMap: PathMap) = + let v_langFeatureNullness = (langVersion >= 5.0) + let v_langFeatureAnonRecds = (langVersion >= 5.0) + + let v_knownWithoutNull = + if v_langFeatureNullness then KnownWithoutNull else KnownAmbivalentToNull + + let mkNonGenericTy tcref = TType_app(tcref, [], v_knownWithoutNull) + + let mkNonGenericTyWithNullness tcref nullness = TType_app(tcref, [], nullness) + + let mkNonLocalTyconRef2 ccu path n = mkNonLocalTyconRef (mkNonLocalEntityRef ccu path) n + + let mk_MFCore_tcref ccu n = mkNonLocalTyconRef2 ccu FSharpLib.CorePathArray n + let mk_MFQuotations_tcref ccu n = mkNonLocalTyconRef2 ccu FSharpLib.QuotationsPath n + let mk_MFLinq_tcref ccu n = mkNonLocalTyconRef2 ccu LinqPathArray n + let mk_MFCollections_tcref ccu n = mkNonLocalTyconRef2 ccu FSharpLib.CollectionsPathArray n + let mk_MFCompilerServices_tcref ccu n = mkNonLocalTyconRef2 ccu FSharpLib.CompilerServicesPath n + let mk_MFControl_tcref ccu n = mkNonLocalTyconRef2 ccu FSharpLib.ControlPathArray n + let vara = NewRigidTypar "a" envRange let varb = NewRigidTypar "b" envRange let varc = NewRigidTypar "c" envRange @@ -232,6 +238,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_fastFunc_tcr = mk_MFCore_tcref fslibCcu "FSharpFunc`2" let v_refcell_tcr_canon = mk_MFCore_tcref fslibCcu "Ref`1" let v_refcell_tcr_nice = mk_MFCore_tcref fslibCcu "ref`1" + let v_mfe_tcr = mk_MFCore_tcref fslibCcu "MatchFailureException" let dummyAssemblyNameCarryingUsefulErrorInformation path typeName = FSComp.SR.tcGlobalsSystemTypeNotFound (String.concat "." path + "." + typeName) @@ -344,10 +351,10 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_nullable_tcr = findSysTyconRef sys "Nullable`1" (* local helpers to build value infos *) - let mkNullableTy ty = TType_app(v_nullable_tcr, [ty]) - let mkByrefTy ty = TType_app(v_byref_tcr, [ty]) - let mkNativePtrTy ty = TType_app(v_nativeptr_tcr, [ty]) - let mkFunTy d r = TType_fun (d, r) + let mkNullableTy ty = TType_app(v_nullable_tcr, [ty], v_knownWithoutNull) + let mkByrefTy ty = TType_app(v_byref_tcr, [ty], v_knownWithoutNull) + let mkNativePtrTy ty = TType_app(v_nativeptr_tcr, [ty], v_knownWithoutNull) + let mkFunTy d r = TType_fun (d, r, v_knownWithoutNull) let (-->) d r = mkFunTy d r let mkIteratedFunTy dl r = List.foldBack mkFunTy dl r let mkSmallRefTupledTy l = match l with [] -> v_unit_ty | [h] -> h | tys -> mkRawRefTupleTy tys @@ -383,22 +390,22 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let mk_compare_withc_sig ty = [[v_IComparer_ty];[ty]; [ty]], v_int_ty let mk_equality_withc_sig ty = [[v_IEqualityComparer_ty];[ty];[ty]], v_bool_ty let mk_hash_withc_sig ty = [[v_IEqualityComparer_ty]; [ty]], v_int_ty - let mkListTy ty = TType_app(v_list_tcr_nice, [ty]) - let mkSeqTy ty1 = TType_app(v_seq_tcr, [ty1]) - let mkRefCellTy ty = TType_app(v_refcell_tcr_canon, [ty]) - let mkQuerySourceTy ty1 ty2 = TType_app(v_querySource_tcr, [ty1; ty2]) + let mkListTy ty = TType_app(v_list_tcr_nice, [ty], v_knownWithoutNull) + let mkSeqTy ty1 = TType_app(v_seq_tcr, [ty1], v_knownWithoutNull) + let mkRefCellTy ty = TType_app(v_refcell_tcr_canon, [ty], v_knownWithoutNull) + let mkQuerySourceTy ty1 ty2 = TType_app(v_querySource_tcr, [ty1; ty2], v_knownWithoutNull) let v_tcref_System_Collections_IEnumerable = findSysTyconRef sysCollections "IEnumerable"; let mkArrayType rank (ty : TType) : TType = assert (rank >= 1 && rank <= 32) - TType_app(v_il_arr_tcr_map.[rank - 1], [ty]) - let mkLazyTy ty = TType_app(lazy_tcr, [ty]) + TType_app(v_il_arr_tcr_map.[rank - 1], [ty], v_knownWithoutNull) + let mkLazyTy ty = TType_app(lazy_tcr, [ty], v_knownWithoutNull) - let mkPrintfFormatTy aty bty cty dty ety = TType_app(v_format_tcr, [aty;bty;cty;dty; ety]) - let mk_format4_ty aty bty cty dty = TType_app(v_format4_tcr, [aty;bty;cty;dty]) - let mkQuotedExprTy aty = TType_app(v_expr_tcr, [aty]) - let mkRawQuotedExprTy = TType_app(v_raw_expr_tcr, []) - let mkQueryBuilderTy = TType_app(v_query_builder_tcref, []) - let mkLinqExpressionTy aty = TType_app(v_linqExpression_tcr, [aty]) + let mkPrintfFormatTy aty bty cty dty ety = TType_app(v_format_tcr, [aty;bty;cty;dty; ety], v_knownWithoutNull) + let mk_format4_ty aty bty cty dty = TType_app(v_format4_tcr, [aty;bty;cty;dty], v_knownWithoutNull) + let mkQuotedExprTy aty = TType_app(v_expr_tcr, [aty], v_knownWithoutNull) + let mkRawQuotedExprTy = TType_app(v_raw_expr_tcr, [], v_knownWithoutNull) + let mkQueryBuilderTy = TType_app(v_query_builder_tcref, [], v_knownWithoutNull) + let mkLinqExpressionTy aty = TType_app(v_linqExpression_tcr, [aty], v_knownWithoutNull) let v_cons_ucref = mkUnionCaseRef v_list_tcr_canon "op_ColonColon" let v_nil_ucref = mkUnionCaseRef v_list_tcr_canon "op_Nil" @@ -510,8 +517,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d match l with | [t1;t2;t3;t4;t5;t6;t7;marker] -> match marker with - | TType_app(tcref, [t8]) when tyconRefEq tcref v_ref_tuple1_tcr -> mkRawRefTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] |> Some - | TType_app(tcref, [t8]) when tyconRefEq tcref v_struct_tuple1_tcr -> mkRawStructTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] |> Some + | TType_app(tcref, [t8], _nullness) when tyconRefEq tcref v_ref_tuple1_tcr -> mkRawRefTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] |> Some + | TType_app(tcref, [t8], _nullness) when tyconRefEq tcref v_struct_tuple1_tcr -> mkRawStructTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] |> Some | TType_tuple (_structness2, t8plus) -> TType_tuple (tupInfo, [t1;t2;t3;t4;t5;t6;t7] @ t8plus) |> Some | _ -> None | [] -> None @@ -519,15 +526,18 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d | _ -> TType_tuple (tupInfo, l) |> Some - let decodeTupleTy tupInfo l = - match tryDecodeTupleTy tupInfo l with + let decodeTupleTyAndNullness tupInfo tinst _nullness = // TODO nullness + match tryDecodeTupleTy tupInfo tinst with | Some ty -> ty | None -> failwith "couldn't decode tuple ty" - let decodeTupleTyIfPossible tcref tupInfo l = - match tryDecodeTupleTy tupInfo l with + let decodeTupleTyAndNullnessIfPossible tcref tupInfo tinst nullness = // TODO nullness + match tryDecodeTupleTy tupInfo tinst with | Some ty -> ty - | None -> TType_app(tcref, l) + | None -> TType_app(tcref, tinst, nullness) + + let decodeTupleTy tupInfo tinst = + decodeTupleTyAndNullness tupInfo tinst v_knownWithoutNull let mk_MFCore_attrib nm : BuiltinAttribInfo = AttribInfo(mkILTyRef(IlxSettings.ilxFsharpCoreLibScopeRef (), FSharpLib.Core + "." + nm), mk_MFCore_tcref fslibCcu nm) @@ -652,7 +662,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_hash_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "hash" , None , Some "Hash" , [vara], ([[varaTy]], v_int_ty)) let v_box_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "box" , None , Some "Box" , [vara], ([[varaTy]], v_obj_ty)) let v_isnull_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "isNull" , None , Some "IsNull" , [vara], ([[varaTy]], v_bool_ty)) - let v_isnotnull_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "isNotNull" , None , Some "IsNotNull" , [vara], ([[varaTy]], v_bool_ty)) let v_raise_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "raise" , None , Some "Raise" , [vara], ([[mkSysNonGenericTy sys "Exception"]], varaTy)) let v_failwith_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "failwith" , None , Some "FailWith" , [vara], ([[v_string_ty]], varaTy)) let v_invalid_arg_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "invalidArg" , None , Some "InvalidArg" , [vara], ([[v_string_ty]; [v_string_ty]], varaTy)) @@ -689,7 +698,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_seq_generated_info = makeIntrinsicValRef(fslib_MFRuntimeHelpers_nleref, "EnumerateWhile" , None , None , [varb], ([[v_unit_ty --> v_bool_ty]; [mkSeqTy varbTy]], mkSeqTy varbTy)) let v_seq_finally_info = makeIntrinsicValRef(fslib_MFRuntimeHelpers_nleref, "EnumerateThenFinally" , None , None , [varb], ([[mkSeqTy varbTy]; [v_unit_ty --> v_unit_ty]], mkSeqTy varbTy)) let v_seq_of_functions_info = makeIntrinsicValRef(fslib_MFRuntimeHelpers_nleref, "EnumerateFromFunctions" , None , None , [vara;varb], ([[v_unit_ty --> varaTy]; [varaTy --> v_bool_ty]; [varaTy --> varbTy]], mkSeqTy varbTy)) - let v_create_event_info = makeIntrinsicValRef(fslib_MFRuntimeHelpers_nleref, "CreateEvent" , None , None , [vara;varb], ([[varaTy --> v_unit_ty]; [varaTy --> v_unit_ty]; [(v_obj_ty --> (varbTy --> v_unit_ty)) --> varaTy]], TType_app (v_fslib_IEvent2_tcr, [varaTy;varbTy]))) + let v_create_event_info = makeIntrinsicValRef(fslib_MFRuntimeHelpers_nleref, "CreateEvent" , None , None , [vara;varb], ([[varaTy --> v_unit_ty]; [varaTy --> v_unit_ty]; [(v_obj_ty --> (varbTy --> v_unit_ty)) --> varaTy]], TType_app (v_fslib_IEvent2_tcr, [varaTy;varbTy], v_knownWithoutNull))) let v_seq_to_array_info = makeIntrinsicValRef(fslib_MFSeqModule_nleref, "toArray" , None , Some "ToArray", [varb], ([[mkSeqTy varbTy]], mkArrayType 1 varbTy)) let v_seq_to_list_info = makeIntrinsicValRef(fslib_MFSeqModule_nleref, "toList" , None , Some "ToList" , [varb], ([[mkSeqTy varbTy]], mkListTy varbTy)) let v_seq_map_info = makeIntrinsicValRef(fslib_MFSeqModule_nleref, "map" , None , Some "Map" , [vara;varb], ([[varaTy --> varbTy]; [mkSeqTy varaTy]], mkSeqTy varbTy)) @@ -795,35 +804,39 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d "Single" , v_float32_tcr |] |> Array.map (fun (nm, tcr) -> let ty = mkNonGenericTy tcr - nm, findSysTyconRef sys nm, (fun _ -> ty)) + nm, findSysTyconRef sys nm, (fun _ nullness -> + match nullness with + | Nullness.Known NullnessInfo.WithoutNull -> ty + | _ -> mkNonGenericTyWithNullness tcr nullness)) let decompileTyconEntries = [| - "FSharpFunc`2" , v_fastFunc_tcr , (fun tinst -> mkFunTy (List.item 0 tinst) (List.item 1 tinst)) - "Tuple`2" , v_ref_tuple2_tcr , decodeTupleTy tupInfoRef - "Tuple`3" , v_ref_tuple3_tcr , decodeTupleTy tupInfoRef - "Tuple`4" , v_ref_tuple4_tcr , decodeTupleTy tupInfoRef - "Tuple`5" , v_ref_tuple5_tcr , decodeTupleTy tupInfoRef - "Tuple`6" , v_ref_tuple6_tcr , decodeTupleTy tupInfoRef - "Tuple`7" , v_ref_tuple7_tcr , decodeTupleTy tupInfoRef - "Tuple`8" , v_ref_tuple8_tcr , decodeTupleTyIfPossible v_ref_tuple8_tcr tupInfoRef - "ValueTuple`2" , v_struct_tuple2_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`3" , v_struct_tuple3_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`4" , v_struct_tuple4_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`5" , v_struct_tuple5_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`6" , v_struct_tuple6_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`7" , v_struct_tuple7_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`8" , v_struct_tuple8_tcr , decodeTupleTyIfPossible v_struct_tuple8_tcr tupInfoStruct |] + // TODO: nullness here + "FSharpFunc`2" , v_fastFunc_tcr , (fun tinst _nullness -> mkFunTy (List.item 0 tinst) (List.item 1 tinst)) + "Tuple`2" , v_ref_tuple2_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`3" , v_ref_tuple3_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`4" , v_ref_tuple4_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`5" , v_ref_tuple5_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`6" , v_ref_tuple6_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`7" , v_ref_tuple7_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`8" , v_ref_tuple8_tcr , decodeTupleTyAndNullnessIfPossible v_ref_tuple8_tcr tupInfoRef + "ValueTuple`2" , v_struct_tuple2_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`3" , v_struct_tuple3_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`4" , v_struct_tuple4_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`5" , v_struct_tuple5_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`6" , v_struct_tuple6_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`7" , v_struct_tuple7_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`8" , v_struct_tuple8_tcr , decodeTupleTyAndNullnessIfPossible v_struct_tuple8_tcr tupInfoStruct |] let betterEntries = Array.append betterTyconEntries decompileTyconEntries - let mutable decompileTypeDict = null - let mutable betterTypeDict1 = null - let mutable betterTypeDict2 = null + let mutable decompileTypeDict = Unchecked.defaultof<_> + let mutable betterTypeDict1 = Unchecked.defaultof<_> + let mutable betterTypeDict2 = Unchecked.defaultof<_> /// This map is indexed by stamps and lazy to avoid dereferencing while setting up the base imports. let getDecompileTypeDict () = - match decompileTypeDict with + match box decompileTypeDict with | null -> let entries = decompileTyconEntries let t = Dictionary.newWithSize entries.Length @@ -832,26 +845,31 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d t.Add(tcref.Stamp, builder) decompileTypeDict <- t t - | t -> t + | _ -> decompileTypeDict /// This map is for use when building FSharp.Core.dll. The backing Tycon's may not yet exist for /// the TyconRef's we have in our hands, hence we can't dereference them to find their stamps. /// So this dictionary is indexed by names. Make it lazy to avoid dereferencing while setting up the base imports. let getBetterTypeDict1 () = - match betterTypeDict1 with + match box betterTypeDict1 with | null -> let entries = betterEntries let t = Dictionary.newWithSize entries.Length for nm, tcref, builder in entries do - t.Add(nm, fun tcref2 tinst2 -> if tyconRefEq tcref tcref2 then builder tinst2 else TType_app (tcref2, tinst2)) + t.Add(nm, + (fun tcref2 tinst2 nullness -> + if tyconRefEq tcref tcref2 then + builder tinst2 nullness + else + TType_app (tcref2, tinst2, nullness))) betterTypeDict1 <- t t - | t -> t + | _ -> betterTypeDict1 /// This map is for use in normal times (not building FSharp.Core.dll). It is indexed by stamps /// and lazy to avoid dereferencing while setting up the base imports. let getBetterTypeDict2 () = - match betterTypeDict2 with + match box betterTypeDict2 with | null -> let entries = betterEntries let t = Dictionary.newWithSize entries.Length @@ -860,41 +878,54 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d t.Add(tcref.Stamp, builder) betterTypeDict2 <- t t - | t -> t + | _ -> betterTypeDict2 /// For logical purposes equate some F# types with .NET types, e.g. TType_tuple == System.Tuple/ValueTuple. /// Doing this normalization is a fairly performance critical piece of code as it is frequently invoked /// in the process of converting .NET metadata to F# internal compiler data structures (see import.fs). - let decompileTy (tcref: EntityRef) tinst = + let decompileTy (tcref: EntityRef) tinst nullness = if compilingFslib then // No need to decompile when compiling FSharp.Core.dll - TType_app (tcref, tinst) + TType_app (tcref, tinst, nullness) else let dict = getDecompileTypeDict() match dict.TryGetValue tcref.Stamp with - | true, builder -> builder tinst - | _ -> TType_app (tcref, tinst) + | true, builder -> builder tinst nullness + | _ -> TType_app (tcref, tinst, nullness) /// For cosmetic purposes "improve" some .NET types, e.g. Int32 --> int32. /// Doing this normalization is a fairly performance critical piece of code as it is frequently invoked /// in the process of converting .NET metadata to F# internal compiler data structures (see import.fs). - let improveTy (tcref: EntityRef) tinst = + let improveTy (tcref: EntityRef) tinst nullness= if compilingFslib then let dict = getBetterTypeDict1() match dict.TryGetValue tcref.LogicalName with - | true, builder -> builder tcref tinst - | _ -> TType_app (tcref, tinst) + | true, builder -> builder tcref tinst nullness + | _ -> TType_app (tcref, tinst, nullness) else let dict = getBetterTypeDict2() match dict.TryGetValue tcref.Stamp with - | true, builder -> builder tinst - | _ -> TType_app (tcref, tinst) + | true, builder -> builder tinst nullness + | _ -> TType_app (tcref, tinst, nullness) override x.ToString() = "" member __.ilg=ilg - // A table of all intrinsics that the compiler cares about + + /// A table of all intrinsics that the compiler cares about member __.knownIntrinsics = v_knownIntrinsics + + member __.assumeNullOnImport = assumeNullOnImport + + member __.checkNullness = checkNullness + + member __.langFeatureNullness = v_langFeatureNullness + + member __.langFeatureAnonRecds = v_langFeatureAnonRecds + + member g.knownWithoutNull = v_knownWithoutNull + + member __.langVersion = langVersion // A table of known modules in FSharp.Core. Not all modules are necessarily listed, but the more we list the // better the job we do of mapping from provided expressions back to FSharp.Core F# functions and values. member __.knownFSharpCoreModules = v_knownFSharpCoreModules @@ -955,6 +986,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.voidptr_tcr = v_voidptr_tcr member __.ilsigptr_tcr = v_ilsigptr_tcr member __.fastFunc_tcr = v_fastFunc_tcr + member __.MatchFailureException_tcr = v_mfe_tcr member __.tcref_IQueryable = v_tcref_IQueryable member __.tcref_IObservable = v_tcref_IObservable member __.tcref_IObserver = v_tcref_IObserver @@ -1316,7 +1348,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.hash_info = v_hash_info member __.box_info = v_box_info member __.isnull_info = v_isnull_info - member __.isnotnull_info = v_isnotnull_info member __.raise_info = v_raise_info member __.failwith_info = v_failwith_info member __.invalid_arg_info = v_invalid_arg_info diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 66267dbe148..92c7fbcd2e6 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -696,8 +696,8 @@ let UnifyRefTupleType contextInfo cenv denv m ty ps = if isRefTupleTy cenv.g ty then let ptys = destRefTupleTy cenv.g ty if List.length ps = List.length ptys then ptys - else NewInferenceTypes ps - else NewInferenceTypes ps + else NewInferenceTypes cenv.g ps + else NewInferenceTypes cenv.g ps let contextInfo = match contextInfo with @@ -716,10 +716,10 @@ let UnifyTupleTypeAndInferCharacteristics contextInfo cenv denv m knownTy isExpl let tupInfo = (if isExplicitStruct then tupInfoStruct else tupInfo) let ptys = if List.length ps = List.length ptys then ptys - else NewInferenceTypes ps + else NewInferenceTypes cenv.g ps tupInfo, ptys else - mkTupInfo isExplicitStruct, NewInferenceTypes ps + mkTupInfo isExplicitStruct, NewInferenceTypes cenv.g ps let contextInfo = match contextInfo with @@ -743,12 +743,12 @@ let UnifyAnonRecdTypeAndInferCharacteristics contextInfo cenv denv m ty isExplic let anonInfo = AnonRecdTypeInfo.Create(anonInfo.Assembly, tupInfo, unsortedNames) let ptys = if List.length ptys = Array.length unsortedNames then ptys - else NewInferenceTypes (Array.toList anonInfo.SortedNames) + else NewInferenceTypes cenv.g (Array.toList anonInfo.SortedNames) anonInfo, ptys | ValueNone -> // Note: no known anonymous record type - use our assembly let anonInfo = AnonRecdTypeInfo.Create(cenv.topCcu, mkTupInfo isExplicitStruct, unsortedNames) - anonInfo, NewInferenceTypes (Array.toList anonInfo.SortedNames) + anonInfo, NewInferenceTypes cenv.g (Array.toList anonInfo.SortedNames) let ty2 = TType_anon (anonInfo, ptys) AddCxTypeEqualsType contextInfo denv cenv.css m ty ty2 anonInfo, ptys @@ -759,9 +759,9 @@ let UnifyAnonRecdTypeAndInferCharacteristics contextInfo cenv denv m ty isExplic let UnifyFunctionTypeUndoIfFailed cenv denv m ty = match tryDestFunTy cenv.g ty with | ValueNone -> - let domainTy = NewInferenceType () - let resultTy = NewInferenceType () - if AddCxTypeEqualsTypeUndoIfFailed denv cenv.css m ty (domainTy --> resultTy) then + let domainTy = NewInferenceType cenv.g + let resultTy = NewInferenceType cenv.g + if AddCxTypeEqualsTypeUndoIfFailed denv cenv.css m ty (mkFunTy cenv.g domainTy resultTy) then ValueSome(domainTy, resultTy) else ValueNone @@ -820,9 +820,9 @@ let UnifyUnitType cenv (env: TcEnv) m ty expr = if AddCxTypeEqualsTypeUndoIfFailed denv cenv.css m ty cenv.g.unit_ty then true else - let domainTy = NewInferenceType () - let resultTy = NewInferenceType () - if AddCxTypeEqualsTypeUndoIfFailed denv cenv.css m ty (domainTy --> resultTy) then + let domainTy = NewInferenceType cenv.g + let resultTy = NewInferenceType cenv.g + if AddCxTypeEqualsTypeUndoIfFailed denv cenv.css m ty (mkFunTy cenv.g domainTy resultTy) then warning (FunctionValueUnexpected(denv, ty, m)) else let reportImplicitlyDiscardError() = @@ -1432,7 +1432,7 @@ let MakeAndPublishVal cenv env (altActualParent, inSig, declKind, vrec, vscheme, if Tastops.MemberIsExplicitImpl cenv.g memberInfo then let slotSig = List.head memberInfo.ImplementedSlotSigs match slotSig.ImplementedType with - | TType_app (tyconref, _) -> Some tyconref.Accessibility + | TType_app (tyconref, _, _nullness) -> Some tyconref.Accessibility | _ -> None else None @@ -1904,14 +1904,16 @@ let MakeAndPublishSimpleVals cenv env m names mergeNamesInOneNameresEnv = // to C<_> occurs then generate C for a fresh type inference variable ?ty. //------------------------------------------------------------------------- -let FreshenTyconRef m rigid (tcref: TyconRef) declaredTyconTypars = +let FreshenTyconRef (g: TcGlobals) m rigid (tcref: TyconRef) declaredTyconTypars = let tpsorig = declaredTyconTypars let tps = copyTypars tpsorig if rigid <> TyparRigidity.Rigid then tps |> List.iter (fun tp -> tp.SetRigidity rigid) let renaming, tinst = FixupNewTypars m [] [] tpsorig tps - (TType_app(tcref, List.map mkTyparTy tpsorig), tps, renaming, TType_app(tcref, tinst)) + let origObjTy = TType_app(tcref, List.map mkTyparTy tpsorig, g.knownWithoutNull) + let freshTy = TType_app(tcref, tinst, g.knownWithoutNull) + (origObjTy, tps, renaming, freshTy) let FreshenPossibleForallTy g m rigid ty = let tpsorig, tau = tryDestForallTy g ty @@ -1923,10 +1925,9 @@ let FreshenPossibleForallTy g m rigid ty = let tps, renaming, tinst = CopyAndFixupTypars m rigid tpsorig tpsorig, tps, tinst, instType renaming tau -let infoOfTyconRef m (tcref: TyconRef) = +let infoOfTyconRef (g: TcGlobals) m (tcref: TyconRef) = let tps, renaming, tinst = FreshenTypeInst m (tcref.Typars m) - tps, renaming, tinst, TType_app (tcref, tinst) - + tps, renaming, tinst, TType_app (tcref, tinst, g.knownWithoutNull) /// Given a abstract method, which may be a generic method, freshen the type in preparation /// to apply it as a constraint to the method that implements the abstract slot @@ -2237,7 +2238,7 @@ module GeneralizationHelpers = match tp.Constraints |> List.partition (function (TyparConstraint.CoercesTo _) -> true | _ -> false) with | [TyparConstraint.CoercesTo(cxty, _)], others -> // Throw away null constraints if they are implied - if others |> List.exists (function (TyparConstraint.SupportsNull(_)) -> not (TypeSatisfiesNullConstraint cenv.g m cxty) | _ -> true) + if others |> List.exists (function (TyparConstraint.SupportsNull(_)) -> not (TypeNullIsExtraValueOld cenv.g m cxty) | _ -> true) then None else Some cxty | _ -> None @@ -2671,9 +2672,9 @@ module EventDeclarationNormalization = /// Also adjust the "this" type to take into account whether the type is a struct. let FreshenObjectArgType cenv m rigid tcref isExtrinsic declaredTyconTypars = #if EXTENDED_EXTENSION_MEMBERS // indicates if extension members can add additional constraints to type parameters - let tcrefObjTy, enclosingDeclaredTypars, renaming, objTy = FreshenTyconRef m (if isExtrinsic then TyparRigidity.Flexible else rigid) tcref declaredTyconTypars + let tcrefObjTy, enclosingDeclaredTypars, renaming, objTy = FreshenTyconRef cenv.g m (if isExtrinsic then TyparRigidity.Flexible else rigid) tcref declaredTyconTypars #else - let tcrefObjTy, enclosingDeclaredTypars, renaming, objTy = FreshenTyconRef m rigid tcref declaredTyconTypars + let tcrefObjTy, enclosingDeclaredTypars, renaming, objTy = FreshenTyconRef cenv.g m rigid tcref declaredTyconTypars #endif // Struct members have a byref 'this' type (unless they are extrinsic extension members) let thisTy = @@ -2959,20 +2960,19 @@ let MakeApplicableExprWithFlex cenv (env: TcEnv) expr = if isNonFlexibleType actualType then actualType else - let flexibleType = NewInferenceType () - AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace actualType flexibleType + let flexibleType = NewInferenceType cenv.g + AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace actualType flexibleType; flexibleType) // Create a coercion to represent the expansion of the application - let expr = mkCoerceExpr (expr, mkIteratedFunTy (List.map (mkRefTupledTy g) curriedFlexibleTypes) retTy, m, exprTy) + let expr = mkCoerceExpr (expr, mkIteratedFunTy g (List.map (mkRefTupledTy g) curriedFlexibleTypes) retTy, m, exprTy) ApplicableExpr (cenv, expr, true) - /// Checks, warnings and constraint assertions for downcasts let TcRuntimeTypeTest isCast isOperator cenv denv m tgtTy srcTy = let g = cenv.g if TypeDefinitelySubsumesTypeNoCoercion 0 g cenv.amap m tgtTy srcTy then - warning(TypeTestUnnecessary m) + warning (TypeTestUnnecessary m) if isTyparTy g srcTy && not (destTyparTy g srcTy).IsCompatFlex then error(IndeterminateRuntimeCoercion(denv, srcTy, tgtTy, m)) @@ -3409,7 +3409,7 @@ let AnalyzeArbitraryExprAsEnumerable cenv (env: TcEnv) localAlloc m exprty expr else None // Next try to typecheck the thing as a sequence - let enumElemTy = NewInferenceType () + let enumElemTy = NewInferenceType cenv.g let exprTyAsSeq = mkSeqTy cenv.g enumElemTy match probe exprTyAsSeq with @@ -3426,7 +3426,7 @@ let AnalyzeArbitraryExprAsEnumerable cenv (env: TcEnv) localAlloc m exprty expr // Used inside sequence expressions let ConvertArbitraryExprToEnumerable cenv ty (env: TcEnv) (expr: Expr) = let m = expr.Range - let enumElemTy = NewInferenceType () + let enumElemTy = NewInferenceType cenv.g if AddCxTypeMustSubsumeTypeUndoIfFailed env.DisplayEnv cenv.css m ( mkSeqTy cenv.g enumElemTy) ty then expr, enumElemTy else @@ -3444,43 +3444,43 @@ let ConvertArbitraryExprToEnumerable cenv ty (env: TcEnv) (expr: Expr) = let mkSeqEmpty cenv env m genTy = // We must discover the 'zero' of the monadic algebra being generated in order to compile failing matches. - let genResultTy = NewInferenceType () + let genResultTy = NewInferenceType cenv.g UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) mkCallSeqEmpty cenv.g m genResultTy let mkSeqCollect cenv env m enumElemTy genTy lam enumExpr = - let genResultTy = NewInferenceType () + let genResultTy = NewInferenceType cenv.g UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) let enumExpr = mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g enumElemTy) (tyOfExpr cenv.g enumExpr) enumExpr mkCallSeqCollect cenv.g m enumElemTy genResultTy lam enumExpr let mkSeqUsing cenv (env: TcEnv) m resourceTy genTy resourceExpr lam = AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace cenv.g.system_IDisposable_ty resourceTy - let genResultTy = NewInferenceType () + let genResultTy = NewInferenceType cenv.g UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) mkCallSeqUsing cenv.g m resourceTy genResultTy resourceExpr lam let mkSeqDelay cenv env m genTy lam = - let genResultTy = NewInferenceType () + let genResultTy = NewInferenceType cenv.g UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) mkCallSeqDelay cenv.g m genResultTy (mkUnitDelayLambda cenv.g m lam) let mkSeqAppend cenv env m genTy e1 e2 = - let genResultTy = NewInferenceType () + let genResultTy = NewInferenceType cenv.g UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) let e1 = mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e1) e1 let e2 = mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e2) e2 mkCallSeqAppend cenv.g m genResultTy e1 e2 let mkSeqFromFunctions cenv env m genTy e1 e2 = - let genResultTy = NewInferenceType () + let genResultTy = NewInferenceType cenv.g UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) let e2 = mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e2) e2 mkCallSeqGenerated cenv.g m genResultTy e1 e2 let mkSeqFinally cenv env m genTy e1 e2 = - let genResultTy = NewInferenceType () + let genResultTy = NewInferenceType cenv.g UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) let e1 = mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e1) e1 mkCallSeqFinally cenv.g m genResultTy e1 e2 @@ -3884,9 +3884,9 @@ let EliminateInitializationGraphs | _ -> let ty = v.Type let m = v.Range - let vty = (mkLazyTy g ty) + let vty = mkLazyTy g ty - let fty = (g.unit_ty --> ty) + let fty = mkFunTy g g.unit_ty ty let flazy, felazy = Tastops.mkCompGenLocal m v.LogicalName fty let frhs = mkUnitDelayLambda g m e if mustHaveArity then flazy.SetValReprInfo (Some(InferArityOfExpr g AllowTypeDirectedDetupling.Yes fty [] [] frhs)) @@ -4010,7 +4010,7 @@ let CheckAndRewriteObjectCtor g env (ctorLambaExpr: Expr) = error expr let body = checkAndRewrite body - mkMultiLambdas m tps vsl (body, returnTy) + mkMultiLambdas g m tps vsl (body, returnTy) @@ -4044,7 +4044,7 @@ let buildApp cenv expr resultTy arg m = | ApplicableExpr(_, Expr.App (Expr.Val (vf, _, _), _, _, [], _), _), _ when (valRefEq g vf g.nativeptr_tobyref_vref) -> - let argty = NewInferenceType() + let argty = NewInferenceType g let resultTy = mkByrefTyWithInference g argty (NewByRefKindInferenceType g m) expr.SupplyArgument (arg, m), resultTy @@ -4294,7 +4294,9 @@ let rec TcTyparConstraint ridx cenv newOk checkCxs occ (env: TcEnv) tpenv c = AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace ty' (mkTyparTy tp') tpenv - | WhereTyparSupportsNull(tp, m) -> checkSimpleConstraint tp m AddCxTypeMustSupportNull + | WhereTyparSupportsNull(tp, m) -> checkSimpleConstraint tp m AddCxTypeDefnSupportsNull + + | WhereTyparNotSupportsNull(tp, m) -> checkSimpleConstraint tp m AddCxTypeDefnNotSupportsNull | WhereTyparIsComparable(tp, m) -> checkSimpleConstraint tp m AddCxTypeMustSupportComparison @@ -4431,11 +4433,14 @@ and TcValSpec cenv env declKind newOk containerInfo memFlagsOpt thisTyOpt tpenv match memberFlags.MemberKind with | MemberKind.PropertyGet -> if SynInfo.HasNoArgs valSynInfo then - (cenv.g.unit_ty --> declaredTy), (SynInfo.IncorporateEmptyTupledArgForPropertyGetter valSynInfo) + let getterTy = mkFunTy cenv.g cenv.g.unit_ty declaredTy + getterTy, (SynInfo.IncorporateEmptyTupledArgForPropertyGetter valSynInfo) else declaredTy, valSynInfo | _ -> - let setterTy = (mkRefTupledTy cenv.g (List.map fst (List.concat arginfos) @ [returnTy]) --> cenv.g.unit_ty) + let setterArgTys = List.map fst (List.concat arginfos) @ [returnTy] + let setterArgTy = mkRefTupledTy cenv.g setterArgTys + let setterTy = mkFunTy cenv.g setterArgTy cenv.g.unit_ty let synInfo = SynInfo.IncorporateSetterArg valSynInfo setterTy, synInfo | MemberKind.PropertyGetSet -> @@ -4446,7 +4451,7 @@ and TcValSpec cenv env declKind newOk containerInfo memFlagsOpt thisTyOpt tpenv let ty', valSynInfo = if memberFlags.IsInstance then - (thisTy --> ty'), (SynInfo.IncorporateSelfArg valSynInfo) + (mkFunTy cenv.g thisTy ty'), (SynInfo.IncorporateSelfArg valSynInfo) else ty', valSynInfo @@ -4469,7 +4474,7 @@ and TcValSpec cenv env declKind newOk containerInfo memFlagsOpt thisTyOpt tpenv |> List.map (fun (argty, argInfo) -> if SynInfo.IsOptionalArg argInfo then mkOptionTy cenv.g argty else argty)) - mkIteratedFunTy (List.map (mkRefTupledTy cenv.g) curriedArgTys) returnTy + mkIteratedFunTy cenv.g (List.map (mkRefTupledTy cenv.g) curriedArgTys) returnTy else ty' let memberInfoOpt = @@ -4490,9 +4495,9 @@ and TcValSpec cenv env declKind newOk containerInfo memFlagsOpt thisTyOpt tpenv let delTy = FindDelegateTypeOfPropertyEvent cenv.g cenv.amap id.idText id.idRange declaredTy let ty = if memberFlags.IsInstance then - thisTy --> (delTy --> cenv.g.unit_ty) + mkFunTy cenv.g thisTy (mkFunTy cenv.g delTy cenv.g.unit_ty) else - (delTy --> cenv.g.unit_ty) + mkFunTy cenv.g delTy cenv.g.unit_ty yield reallyGenerateOneMember(ident("add_" + id.idText, id.idRange), valSynInfo, ty, memberFlags) yield reallyGenerateOneMember(ident("remove_" + id.idText, id.idRange), valSynInfo, ty, memberFlags) ] @@ -4671,6 +4676,9 @@ and TcTypeOrMeasure optKind cenv newOk checkCxs occ env (tpenv: SyntacticUnscope TType_tuple(tupInfo,args'),tpenv | SynType.AnonRecd(isStruct, args,m) -> + if not g.langFeatureAnonRecds then + error(Error(FSComp.SR.tcLangFeatureNotEnabled50(), m)) + let tupInfo = mkTupInfo isStruct let args',tpenv = TcTypesAsTuple cenv newOk checkCxs occ env tpenv (args |> List.map snd |> List.map (fun x -> (false,x))) m let unsortedFieldIds = args |> List.map fst |> List.toArray @@ -4685,11 +4693,12 @@ and TcTypeOrMeasure optKind cenv newOk checkCxs occ env (tpenv: SyntacticUnscope | SynType.Fun(domainTy, resultTy, _) -> let domainTy', tpenv = TcTypeAndRecover cenv newOk checkCxs occ env tpenv domainTy let resultTy', tpenv = TcTypeAndRecover cenv newOk checkCxs occ env tpenv resultTy - (domainTy' --> resultTy'), tpenv + let ty' = mkFunTy cenv.g domainTy' resultTy' + ty', tpenv | SynType.Array (n, elemTy, m) -> let elemTy, tpenv = TcTypeAndRecover cenv newOk checkCxs occ env tpenv elemTy - mkArrayTy g n elemTy m, tpenv + mkArrayTy g n g.knownWithoutNull elemTy m, tpenv | SynType.Var (tp, _) -> let tp', tpenv = TcTyparOrMeasurePar optKind cenv env newOk tpenv tp @@ -4713,8 +4722,9 @@ and TcTypeOrMeasure optKind cenv newOk checkCxs occ env (tpenv: SyntacticUnscope | SynType.HashConstraint(ty, m) -> let tp = TcAnonTypeOrMeasure (Some TyparKind.Type) cenv TyparRigidity.WarnIfNotRigid TyparDynamicReq.Yes newOk m let ty', tpenv = TcTypeAndRecover cenv newOk checkCxs occ env tpenv ty - AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace ty' (mkTyparTy tp) - tp.AsType, tpenv + let tpTy = mkTyparTy tp + AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace ty' tpTy + tpTy, tpenv | SynType.StaticConstant (c, m) -> match c, optKind with @@ -4727,12 +4737,46 @@ and TcTypeOrMeasure optKind cenv newOk checkCxs occ env (tpenv: SyntacticUnscope errorR(Error(FSComp.SR.parsInvalidLiteralInType(), m)) NewErrorType (), tpenv + | SynType.StaticConstantNull m | SynType.StaticConstantNamed (_, _, m) - | SynType.StaticConstantExpr (_, m) -> errorR(Error(FSComp.SR.parsInvalidLiteralInType(), m)) NewErrorType (), tpenv + | SynType.WithNull(innerTy, ambivalent, m) -> + let innerTyC, tpenv = TcTypeAndRecover cenv newOk checkCxs occ env tpenv innerTy + if g.langFeatureNullness then + if TypeNullNever g innerTyC then + let tyString = NicePrint.minimalStringOfType env.DisplayEnv innerTyC + errorR(Error(FSComp.SR.tcTypeDoesNotHaveAnyNull(tyString), m)) + + // TODO - doesn't feel right - it will add KnownNotNull + KnownWithNull --> KnownWithNull, e.g. + // let f (x: string) = (x = null) + match tryAddNullnessToTy (if ambivalent then KnownAmbivalentToNull else KnownWithNull) innerTyC with + + | None -> + let tyString = NicePrint.minimalStringOfType env.DisplayEnv innerTyC + errorR(Error(FSComp.SR.tcTypeDoesNotHaveAnyNull(tyString), m)) + innerTyC, tpenv + + | Some innerTyCWithNull -> + // The inner type is not allowed to support null or use null as a representation value. + // For example "int option?" is not allowed, not "string??". + // + // For variable types in FSharp.Core we make an exception because we must allow + // val toObj: value: 'T option -> 'T? when 'T : not struct (* and 'T : not null *) + // wihout implying 'T is not null. This is because it is legitimate to use this + // function to "collapse" null and obj-null-coming-from-option using such a function. + + if g.compilingFslib && not (isTyparTy g innerTyC) then + AddCxTypeDefnNotSupportsNull env.DisplayEnv cenv.css m NoTrace innerTyC + + innerTyCWithNull, tpenv + + else + warning(Error(FSComp.SR.tcNullnessCheckingNotEnabled(), m)) + innerTyC, tpenv + | SynType.MeasurePower(ty, exponent, m) -> match optKind with | Some TyparKind.Type -> @@ -4847,17 +4891,18 @@ and TcStaticConstantParameter cenv (env: TcEnv) tpenv kind (v: SynType) idOpt co | SynConst.Int32 n when typeEquiv g g.int32_ty kind -> record(g.int32_ty); box (n: int) | SynConst.Int64 n when typeEquiv g g.int64_ty kind -> record(g.int64_ty); box (n: int64) | SynConst.SByte n when typeEquiv g g.sbyte_ty kind -> record(g.sbyte_ty); box (n: sbyte) - | SynConst.UInt16 n when typeEquiv g g.uint16_ty kind -> record(g.uint16_ty); box (n: uint16) - | SynConst.UInt32 n when typeEquiv g g.uint32_ty kind -> record(g.uint32_ty); box (n: uint32) - | SynConst.UInt64 n when typeEquiv g g.uint64_ty kind -> record(g.uint64_ty); box (n: uint64) + | SynConst.UInt16 n when typeEquiv g g.uint16_ty kind -> record(g.uint16_ty); box (n: uint16) + | SynConst.UInt32 n when typeEquiv g g.uint32_ty kind -> record(g.uint32_ty); box (n: uint32) + | SynConst.UInt64 n when typeEquiv g g.uint64_ty kind -> record(g.uint64_ty); box (n: uint64) | SynConst.Decimal n when typeEquiv g g.decimal_ty kind -> record(g.decimal_ty); box (n: decimal) | SynConst.Single n when typeEquiv g g.float32_ty kind -> record(g.float32_ty); box (n: single) | SynConst.Double n when typeEquiv g g.float_ty kind -> record(g.float_ty); box (n: double) | SynConst.Char n when typeEquiv g g.char_ty kind -> record(g.char_ty); box (n: char) - | SynConst.String (s, _) when s <> null && typeEquiv g g.string_ty kind -> record(g.string_ty); box (s: string) + | SynConst.String (s, _) when typeEquiv g g.string_ty kind -> record(g.string_ty); box s | SynConst.Bool b when typeEquiv g g.bool_ty kind -> record(g.bool_ty); box (b: bool) | _ -> fail() v, tpenv + | SynType.StaticConstantNull(_) -> fail() | SynType.StaticConstantExpr(e, _ ) -> // If an error occurs, don't try to recover, since the constant expression will be nothing like what we need @@ -4882,10 +4927,9 @@ and TcStaticConstantParameter cenv (env: TcEnv) tpenv kind (v: SynType) idOpt co | Const.Single n -> record(g.float32_ty); box (n: single) | Const.Double n -> record(g.float_ty); box (n: double) | Const.Char n -> record(g.char_ty); box (n: char) - | Const.String null -> fail() | Const.String s -> record(g.string_ty); box (s: string) | Const.Bool b -> record(g.bool_ty); box (b: bool) - | _ -> fail() + | _ -> fail() | _ -> error(Error(FSComp.SR.tcInvalidConstantExpression(), v.Range)) v, tpenv' | SynType.LongIdent lidwd -> @@ -5024,7 +5068,7 @@ and TcTypeApp cenv newOk checkCxs occ env tpenv m tcref pathTypeArgs (synArgTys: if tcref.Deref.IsProvided then TcProvidedTypeApp cenv env tpenv tcref synArgTys m else #endif - let tps, _, tinst, _ = infoOfTyconRef m tcref + let tps, _, tinst = FreshenTypeInst m (tcref.Typars m) // If we're not checking constraints, i.e. when we first assert the super/interfaces of a type definition, then just // clear the constraint lists of the freshly generated type variables. A little ugly but fairly localized. @@ -5045,7 +5089,7 @@ and TcTypeApp cenv newOk checkCxs occ env tpenv m tcref pathTypeArgs (synArgTys: List.iter2 (UnifyTypes cenv env m) tinst actualArgTys // Try to decode System.Tuple --> F~ tuple types etc. - let ty = g.decompileType tcref actualArgTys + let ty = g.decompileType tcref actualArgTys g.knownWithoutNull ty, tpenv @@ -5069,7 +5113,7 @@ and TcNestedTypeApplication cenv newOk checkCxs occ env tpenv mWholeTypeApp ty t let ty = convertToTypeWithMetadataIfPossible cenv.g ty if not (isAppTy cenv.g ty) then error(Error(FSComp.SR.tcTypeHasNoNestedTypes(), mWholeTypeApp)) match ty with - | TType_app(tcref, tinst) -> + | TType_app(tcref, tinst, _nullness) -> let pathTypeArgs = List.truncate (max (tinst.Length - tcref.Typars(mWholeTypeApp).Length) 0) tinst TcTypeApp cenv newOk checkCxs occ env tpenv mWholeTypeApp tcref pathTypeArgs tyargs | _ -> error(InternalError("TcNestedTypeApplication: expected type application", mWholeTypeApp)) @@ -5096,7 +5140,7 @@ and TcSimplePat optArgsOK checkCxs cenv ty env (tpenv, names, takenNames) p = if not optArgsOK then errorR(Error(FSComp.SR.tcOptionalArgsOnlyOnMembers(), m)) - let tyarg = NewInferenceType () + let tyarg = NewInferenceType cenv.g UnifyTypes cenv env m ty (mkOptionTy cenv.g tyarg) let _, names, takenNames = TcPatBindingName cenv env id ty isMemberThis None None (ValInline.Optional, permitInferTypars, noArgOrRetAttribs, false, None, compgen) (names, takenNames) @@ -5177,7 +5221,7 @@ and TcSimplePats cenv optArgsOK checkCxs ty env (tpenv, names, takenNames: Set<_ TcSimplePats cenv optArgsOK checkCxs ty env (tpenv, names, takenNames) p and TcSimplePatsOfUnknownType cenv optArgsOK checkCxs env tpenv spats = - let argty = NewInferenceType () + let argty = NewInferenceType cenv.g TcSimplePats cenv optArgsOK checkCxs argty env (tpenv, NameMap.empty, Set.empty) spats and TcPatBindingName cenv env id ty isMemberThis vis1 topValData (inlineFlag, declaredTypars, argAttribs, isMutable, vis2, compgen) (names, takenNames: Set) = @@ -5364,7 +5408,7 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv, names, takenNames) ty p | _ -> error(Error(FSComp.SR.tcInvalidArgForParameterizedPattern(), x.Range)) let activePatArgsAsSynExprs = List.map convSynPatToSynExpr activePatArgsAsSynPats - let activePatResTys = NewInferenceTypes apinfo.Names + let activePatResTys = NewInferenceTypes cenv.g apinfo.Names let activePatType = apinfo.OverallType cenv.g m ty activePatResTys let delayed = activePatArgsAsSynExprs |> List.map (fun arg -> DelayedApp(ExprAtomicFlag.NonAtomic, arg, unionRanges (rangeOfLid longId) arg.Range)) @@ -5507,7 +5551,7 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv, names, takenNames) ty p TcPat warnOnUpper cenv env None vFlags (tpenv, names, takenNames) ty p | SynPat.ArrayOrList (isArray, args, m) -> - let argty = NewInferenceType () + let argty = NewInferenceType cenv.g UnifyTypes cenv env m ty (if isArray then mkArrayType cenv.g argty else Tastops.mkListTy cenv.g argty) let args', acc = TcPatterns warnOnUpper cenv env vFlags (tpenv, names, takenNames) (List.map (fun _ -> argty) args) args (fun values -> @@ -5518,7 +5562,7 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv, names, takenNames) ty p | SynPat.Record (flds, m) -> let tcref, fldsmap, _fldsList = BuildFieldMap cenv env true ty flds m // REVIEW: use _fldsList to type check pattern in code order not field defn order - let _, inst, tinst, gtyp = infoOfTyconRef m tcref + let _, inst, tinst, gtyp = infoOfTyconRef cenv.g m tcref UnifyTypes cenv env m ty gtyp let fields = tcref.TrueInstanceFieldsAsList let ftys = fields |> List.map (fun fsp -> actualTyOfRecdField inst fsp, fsp) @@ -5536,12 +5580,13 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv, names, takenNames) ty p (fun _ -> TPat_range(c1, c2, m)), (tpenv, names, takenNames) | SynPat.Null m -> - AddCxTypeMustSupportNull env.DisplayEnv cenv.css m NoTrace ty + AddCxTypeDefnSupportsNull env.DisplayEnv cenv.css m NoTrace ty (fun _ -> TPat_null m), (tpenv, names, takenNames) | SynPat.InstanceMember (_, _, _, _, m) -> errorR(Error(FSComp.SR.tcIllegalPattern(), pat.Range)) (fun _ -> TPat_wild m), (tpenv, names, takenNames) + | SynPat.FromParseError (pat, _) -> suppressErrorReporting (fun () -> TcPatAndRecover warnOnUpper cenv env topValInfo vFlags (tpenv, names, takenNames) (NewErrorType()) pat) @@ -5594,13 +5639,13 @@ and UnifyTypesAndRecover cenv env m expectedTy actualTy = errorRecovery e m and TcExprOfUnknownType cenv env tpenv expr = - let exprty = NewInferenceType () + let exprty = NewInferenceType cenv.g let expr', tpenv = TcExpr cenv exprty env tpenv expr expr', exprty, tpenv and TcExprFlex cenv flex compat ty (env: TcEnv) tpenv (e: SynExpr) = if flex then - let argty = NewInferenceType () + let argty = NewInferenceType cenv.g if compat then (destTyparTy cenv.g argty).SetIsCompatFlex(true) AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css e.Range NoTrace ty argty @@ -5640,7 +5685,7 @@ and TcExprNoRecover cenv ty (env: TcEnv) tpenv (expr: SynExpr) = // and has been added relatively late in F# 4.0 to preserve the structure of previous code. It pushes a 'delayed' parameter // through TcExprOfUnknownType, TcExpr and TcExprNoRecover and TcExprOfUnknownTypeThen cenv env tpenv expr delayed = - let exprty = NewInferenceType () + let exprty = NewInferenceType cenv.g let expr', tpenv = try TcExprThen cenv exprty env tpenv expr delayed @@ -5745,8 +5790,8 @@ and CheckSuperInit cenv objTy m = // TcExprUndelayed //------------------------------------------------------------------------- -and TcExprUndelayedNoType cenv env tpenv synExpr: Expr * TType * _ = - let overallTy = NewInferenceType () +and TcExprUndelayedNoType cenv env tpenv synExpr : Expr * TType * _ = + let overallTy = NewInferenceType cenv.g let expr, tpenv = TcExprUndelayed cenv overallTy env tpenv synExpr expr, overallTy, tpenv @@ -5861,11 +5906,11 @@ and TcExprUndelayed cenv overallTy env tpenv (synExpr: SynExpr) = expr, tpenv | SynExpr.Null m -> - AddCxTypeMustSupportNull env.DisplayEnv cenv.css m NoTrace overallTy + AddCxTypeDefnSupportsNull env.DisplayEnv cenv.css m NoTrace overallTy mkNull m overallTy, tpenv | SynExpr.Lazy (synInnerExpr, m) -> - let innerTy = NewInferenceType () + let innerTy = NewInferenceType cenv.g UnifyTypes cenv env m overallTy (mkLazyTy cenv.g innerTy) let innerExpr, tpenv = TcExpr cenv innerTy env tpenv synInnerExpr let expr = mkLazyDelayed cenv.g m innerTy (mkUnitDelayLambda cenv.g m innerExpr) @@ -5885,7 +5930,7 @@ and TcExprUndelayed cenv overallTy env tpenv (synExpr: SynExpr) = | SynExpr.ArrayOrList (isArray, args, m) -> CallExprHasTypeSink cenv.tcSink (m, env.NameEnv, overallTy, env.DisplayEnv, env.eAccessRights) - let argty = NewInferenceType () + let argty = NewInferenceType cenv.g UnifyTypes cenv env m overallTy (if isArray then mkArrayType cenv.g argty else Tastops.mkListTy cenv.g argty) // Always allow subsumption if a nominal type is known prior to type checking any arguments @@ -5986,7 +6031,7 @@ and TcExprUndelayed cenv overallTy env tpenv (synExpr: SynExpr) = TcExprUndelayed cenv overallTy env tpenv replacementExpr | _ -> - let genCollElemTy = NewInferenceType () + let genCollElemTy = NewInferenceType cenv.g let genCollTy = (if isArray then mkArrayType else mkListTy) cenv.g genCollElemTy @@ -6159,7 +6204,7 @@ and TcExprUndelayed cenv overallTy env tpenv (synExpr: SynExpr) = mkf n e2', tpenv | SynExpr.LibraryOnlyILAssembly (s, tyargs, args, rtys, m) -> - let argTys = NewInferenceTypes args + let argTys = NewInferenceTypes cenv.g args let tyargs', tpenv = TcTypes cenv NewTyparsOK CheckCxs ItemOccurence.UseInType env tpenv tyargs // No subsumption at uses of IL assembly code let flexes = argTys |> List.map (fun _ -> false) @@ -6567,7 +6612,7 @@ and FreshenObjExprAbstractSlot cenv (env: TcEnv) (implty: TType) virtNameAndArit = FreshenAbstractSlot cenv.g cenv.amap mBinding synTyparDecls absSlot // Work out the required type of the member - let bindingTy = implty --> (mkMethodTy cenv.g argTysFromAbsSlot retTyFromAbsSlot) + let bindingTy = mkFunTy cenv.g implty (mkMethodTy cenv.g argTysFromAbsSlot retTyFromAbsSlot) Some(typarsFromAbsSlotAreRigid, typarsFromAbsSlot, bindingTy) @@ -6606,7 +6651,7 @@ and TcObjectExprBinding cenv (env: TcEnv) implty tpenv (absSlotInfo, bind) = | Some(_, _, memberTyFromAbsSlot) -> memberTyFromAbsSlot | _ -> - implty --> NewInferenceType () + mkFunTy cenv.g implty (NewInferenceType cenv.g) let (CheckedBindingInfo(inlineFlag, bindingAttribs, _, _, ExplicitTyparInfo(_, declaredTypars, _), nameToPrelimValSchemeMap, rhsExpr, _, _, m, _, _, _, _), tpenv) = let flex, tpenv = TcNonrecBindingTyparDecls cenv env tpenv bind @@ -6845,16 +6890,16 @@ and TcObjectExpr cenv overallTy env tpenv (synObjTy, argopt, binds, extraImpls, //------------------------------------------------------------------------- /// Check a constant string expression. It might be a 'printf' format string -and TcConstStringExpr cenv overallTy env m tpenv s = +and TcConstStringExpr cenv overallTy env m tpenv (s: string) = if (AddCxTypeEqualsTypeUndoIfFailed env.DisplayEnv cenv.css m overallTy cenv.g.string_ty) then mkString cenv.g m s, tpenv else - let aty = NewInferenceType () - let bty = NewInferenceType () - let cty = NewInferenceType () - let dty = NewInferenceType () - let ety = NewInferenceType () + let aty = NewInferenceType cenv.g + let bty = NewInferenceType cenv.g + let cty = NewInferenceType cenv.g + let dty = NewInferenceType cenv.g + let ety = NewInferenceType cenv.g let ty' = mkPrintfFormatTy cenv.g aty bty cty dty ety if (not (isObjTy cenv.g overallTy) && AddCxTypeMustSubsumeTypeUndoIfFailed env.DisplayEnv cenv.css m overallTy ty') then // Parse the format string to work out the phantom types @@ -6884,7 +6929,6 @@ and TcConstStringExpr cenv overallTy env m tpenv s = and TcConstExpr cenv overallTy env m tpenv c = match c with - // NOTE: these aren't "really" constants | SynConst.Bytes (bytes, m) -> UnifyTypes cenv env m overallTy (mkByteArrayTy cenv.g) Expr.Op (TOp.Bytes bytes, [], [], m), tpenv @@ -6977,7 +7021,7 @@ and TcRecdExpr cenv overallTy env tpenv (inherits, optOrigExpr, flds, mWholeExpr | [] -> [] | _ -> let tcref, _, fldsList = BuildFieldMap cenv env hasOrigExpr overallTy flds mWholeExpr - let _, _, _, gtyp = infoOfTyconRef mWholeExpr tcref + let _, _, _, gtyp = infoOfTyconRef cenv.g mWholeExpr tcref UnifyTypes cenv env mWholeExpr overallTy gtyp [ for n, v in fldsList do @@ -7080,7 +7124,7 @@ and TcAnonRecdExpr cenv overallTy env tpenv (isStruct, optOrigSynExpr, unsortedF // Unlike in the case of record type copy-and-update we do _not_ assume that the origExpr has the same type as the overall expression. // Unlike in the case of record type copy-and-update {| a with X = 1 |} does not force a.X to exist or have had type 'int' - let origExprTy = NewInferenceType() + let origExprTy = NewInferenceType cenv.g let origExprChecked, tpenv = TcExpr cenv origExprTy env tpenv origExpr let oldv, oldve = mkCompGenLocal mWholeExpr "inputRecord" origExprTy let mOrigExpr = origExpr.Range @@ -7323,7 +7367,7 @@ and TcForEachExpr cenv overallTy env tpenv (pat, enumSynExpr, bodySynExpr, mWhol //------------------------------------------------------------------------- and TcQuotationExpr cenv overallTy env tpenv (_oper, raw, ast, isFromQueryExpression, m) = - let astTy = NewInferenceType () + let astTy = NewInferenceType cenv.g // Assert the overall type for the domain of the quotation template UnifyTypes cenv env m overallTy (if raw then mkRawQuotedExprTy cenv.g else mkQuotedExprTy cenv.g astTy) @@ -7835,13 +7879,13 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv let varSpaceWithFirstVars = addVarsToVarSpace varSpace (fun _mCustomOp env -> use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType()) env tpenv (firstSourcePat, None) + let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType cenv.g) env tpenv (firstSourcePat, None) vspecs, envinner) let varSpaceWithSecondVars = addVarsToVarSpace varSpaceWithFirstVars (fun _mCustomOp env -> use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType()) env tpenv (secondSourcePat, None) + let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType cenv.g) env tpenv (secondSourcePat, None) vspecs, envinner) let varSpaceWithGroupJoinVars = @@ -7849,7 +7893,7 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv | Some pat3 -> addVarsToVarSpace varSpaceWithFirstVars (fun _mCustomOp env -> use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType()) env tpenv (pat3, None) + let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType cenv.g) env tpenv (pat3, None) vspecs, envinner) | None -> varSpace @@ -7982,7 +8026,7 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv let varSpace = addVarsToVarSpace varSpace (fun _mCustomOp env -> use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType()) env tpenv (pat, None) + let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType cenv.g) env tpenv (pat, None) vspecs, envinner) Some (trans true q varSpace innerComp @@ -8224,7 +8268,7 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv | [NormalizedBinding(_vis, NormalBinding, false, false, _, _, _, _, pat, _, _, _)] -> // successful case use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType()) env tpenv (pat, None) + let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType cenv.g) env tpenv (pat, None) vspecs, envinner | _ -> // error case @@ -8254,7 +8298,7 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv let varSpace = addVarsToVarSpace varSpace (fun _mCustomOp env -> use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType()) env tpenv (pat, None) + let _, _, vspecs, envinner, _ = TcMatchPattern cenv (NewInferenceType cenv.g) env tpenv (pat, None) vspecs, envinner) let rhsExpr = if isFromSource then mkSourceExpr rhsExpr else rhsExpr @@ -8388,7 +8432,7 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv | SynExpr.YieldOrReturn ((_, true), _, _) -> { env with eContextInfo = ContextInfo.ReturnInComputationExpression } | _ -> env - let lambdaExpr, tpenv= TcExpr cenv (builderTy --> overallTy) env tpenv lambdaExpr + let lambdaExpr , tpenv= TcExpr cenv (mkFunTy cenv.g builderTy overallTy) env tpenv lambdaExpr // beta-var-reduce to bind the builder using a 'let' binding let coreExpr = mkApps cenv.g ((lambdaExpr, tyOfExpr cenv.g lambdaExpr), [], [interpExpr], mBuilderVal) @@ -8403,7 +8447,7 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv /// Also "ienumerable extraction" is performed on arguments to "for". and TcSequenceExpression cenv env tpenv comp overallTy m = - let genEnumElemTy = NewInferenceType () + let genEnumElemTy = NewInferenceType cenv.g UnifyTypes cenv env m overallTy (mkSeqTy cenv.g genEnumElemTy) // Allow subsumption at 'yield' if the element type is nominal prior to the analysis of the body of the sequence expression @@ -8512,8 +8556,8 @@ and TcSequenceExpression cenv env tpenv comp overallTy m = // 'use x = expr in expr' | SynExpr.LetOrUse (_isRec, true, [Binding (_vis, NormalBinding, _, _, _, _, _, pat, _, rhsExpr, _, _spBind)], innerComp, wholeExprMark) -> - let bindPatTy = NewInferenceType () - let inputExprTy = NewInferenceType () + let bindPatTy = NewInferenceType cenv.g + let inputExprTy = NewInferenceType cenv.g let pat', _, vspecs, envinner, tpenv = TcMatchPattern cenv bindPatTy env tpenv (pat, None) UnifyTypes cenv env m inputExprTy bindPatTy let inputExpr, tpenv = TcExpr cenv inputExprTy env tpenv rhsExpr @@ -8553,8 +8597,8 @@ and TcSequenceExpression cenv env tpenv comp overallTy m = AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace genOuterTy genExprTy Some(mkCoerceExpr(resultExpr, genOuterTy, m, genExprTy), tpenv) - | SynExpr.YieldOrReturn ((isYield, _), yieldExpr, m) -> - let genResultTy = NewInferenceType () + | SynExpr.YieldOrReturn((isYield, _), yieldExpr, m) -> + let genResultTy = NewInferenceType cenv.g if not isYield then errorR(Error(FSComp.SR.tcSeqResultsUseYield(), m)) UnifyTypes cenv env m genOuterTy (mkSeqTy cenv.g genResultTy) @@ -8785,7 +8829,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del // x where x is a union case or active pattern result tag. | (Item.UnionCase _ | Item.ExnCase _ | Item.ActivePatternResult _) as item -> // ucaseAppTy is the type of the union constructor applied to its (optional) argument - let ucaseAppTy = NewInferenceType () + let ucaseAppTy = NewInferenceType g let mkConstrApp, argTys, argNames = match item with | Item.ActivePatternResult(apinfo, _, n, _) -> @@ -8796,7 +8840,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del mkConstrApp, [ucaseAppTy], [ for (s, m) in apinfo.ActiveTagsWithRanges -> mkSynId m s ] | _ -> let ucref = mkChoiceCaseRef g mItem aparity n - let _, _, tinst, _ = infoOfTyconRef mItem ucref.TyconRef + let _, _, tinst = FreshenTypeInst mItem (ucref.TyconRef.Typars mItem) let ucinfo = UnionCaseInfo(tinst, ucref) ApplyUnionCaseOrExnTypes mItem cenv env ucaseAppTy (Item.UnionCase(ucinfo, false)) | _ -> @@ -8870,8 +8914,8 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del (currentIndex <> SEEN_NAMED_ARGUMENT) && (currentIndex < numArgTys) && match stripTyEqns g argTys.[currentIndex] with - | TType_app(tcref, _) -> tyconRefEq g g.bool_tcr tcref || tyconRefEq g g.system_Bool_tcref tcref - | TType_var(_) -> true + | TType_app (tcref, _, _) -> tyconRefEq g g.bool_tcr tcref || tyconRefEq g g.system_Bool_tcref tcref + | TType_var _ -> true | _ -> false if isSpecialCaseForBackwardCompatibility then @@ -9051,6 +9095,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del | Item.FakeInterfaceCtor _ -> error(Error(FSComp.SR.tcInvalidUseOfInterfaceType(), mItem)) + | Item.ImplicitOp(id, sln) -> let isPrefix = PrettyNaming.IsPrefixOperator id.idText @@ -9080,7 +9125,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del let traitInfo = TTrait(argTys, logicalCompiledName, memberFlags, argTys, Some retTy, sln) let expr = Expr.Op (TOp.TraitCall traitInfo, [], ves, mItem) - let expr = mkLambdas mItem [] vs (expr, retTy) + let expr = mkLambdas g mItem [] vs (expr, retTy) let rec isSimpleArgument e = match e with @@ -9157,7 +9202,8 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del let delayed1, delayed2 = let pred = (function (DelayedApp (_, arg, _)) -> isSimpleArgument arg | _ -> false) List.takeWhile pred delayed, List.skipWhile pred delayed - let intermediateTy = if isNil delayed2 then overallTy else NewInferenceType () + + let intermediateTy = if isNil delayed2 then overallTy else NewInferenceType g let resultExpr, tpenv = TcDelayed cenv intermediateTy env tpenv mItem (MakeApplicableExprNoFlex cenv expr) (tyOfExpr g expr) ExprAtomicFlag.NonAtomic delayed1 @@ -9192,7 +9238,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del UnifyTypes cenv env mStmt overallTy g.unit_ty vref.Deref.SetHasBeenReferenced() CheckValAccessible mItem env.eAccessRights vref - CheckValAttributes g vref mItem |> CommitOperationResult + CheckValAttributes g vref mItem |> CommitOperationResult let vty = vref.Type let vty2 = if isByrefTy g vty then @@ -9548,7 +9594,7 @@ and TcEventValueThen cenv overallTy env tpenv mItem mExprAndItem objDetails (ein (let dv, de = mkCompGenLocal mItem "eventDelegate" delegateType let callExpr, _ = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates mItem false einfo.RemoveMethod NormalValUse [] objVars [de] mkLambda mItem dv (callExpr, cenv.g.unit_ty)) - (let fvty = (cenv.g.obj_ty --> (argsTy --> cenv.g.unit_ty)) + (let fvty = (mkFunTy cenv.g cenv.g.obj_ty (mkFunTy cenv.g argsTy cenv.g.unit_ty)) let fv, fe = mkCompGenLocal mItem "callback" fvty let createExpr = BuildNewDelegateExpr (Some einfo, cenv.g, cenv.amap, delegateType, invokeMethInfo, compiledViewOfDelArgTys, fe, fvty, mItem) mkLambda mItem fv (createExpr, delegateType))) @@ -9590,7 +9636,7 @@ and TcMethodApplicationThen // Work out if we know anything about the return type of the overall expression. If there are any delayed // lookups then we don't know anything. - let exprTy = if isNil delayed then overallTy else NewInferenceType () + let exprTy = if isNil delayed then overallTy else NewInferenceType cenv.g // Call the helper below to do the real checking let (expr, attributeAssignedNamedItems, delayed), tpenv = @@ -9610,13 +9656,13 @@ and TcMethodApplicationThen /// Infer initial type information at the callsite from the syntax of an argument, prior to overload resolution. and GetNewInferenceTypeForMethodArg cenv env tpenv x = match x with - | SynExprParen(a, _, _, _) -> GetNewInferenceTypeForMethodArg cenv env tpenv a + | SynExprParen (a, _, _, _) -> GetNewInferenceTypeForMethodArg cenv env tpenv a | SynExpr.AddressOf (true, a, _, m) -> mkByrefTyWithInference cenv.g (GetNewInferenceTypeForMethodArg cenv env tpenv a) (NewByRefKindInferenceType cenv.g m) - | SynExpr.Lambda (_, _, _, a, _) -> mkFunTy (NewInferenceType ()) (GetNewInferenceTypeForMethodArg cenv env tpenv a) + | SynExpr.Lambda (_, _, _, a, _) -> mkFunTy cenv.g (NewInferenceType cenv.g) (GetNewInferenceTypeForMethodArg cenv env tpenv a) | SynExpr.Quote (_, raw, a, _, _) -> if raw then mkRawQuotedExprTy cenv.g else mkQuotedExprTy cenv.g (GetNewInferenceTypeForMethodArg cenv env tpenv a) - | _ -> NewInferenceType () + | _ -> NewInferenceType cenv.g /// Method calls, property lookups, attribute constructions etc. get checked through here and TcMethodApplication @@ -9655,7 +9701,7 @@ and TcMethodApplication let curriedCallerArgs, exprTy, delayed = match calledMeths with | [calledMeth] when not isProp && calledMeth.NumArgs.Length > 1 -> - [], NewInferenceType (), [ for x in curriedCallerArgs -> DelayedApp(ExprAtomicFlag.NonAtomic, x, x.Range) ] @ delayed + [], NewInferenceType cenv.g, [ for x in curriedCallerArgs -> DelayedApp(ExprAtomicFlag.NonAtomic, x, x.Range) ] @ delayed | _ when not isProp && calledMeths |> List.exists (fun calledMeth -> calledMeth.NumArgs.Length > 1) -> // This condition should only apply when multiple conflicting curried extension members are brought into scope error(Error(FSComp.SR.tcOverloadsCannotHaveCurriedArguments(), mMethExpr)) @@ -9729,7 +9775,7 @@ and TcMethodApplication curriedCalledArgs.Head |> List.forall isSimpleFormalArg) -> // The call lambda has function type - let exprTy = mkFunTy (NewInferenceType ()) exprTy + let exprTy = mkFunTy cenv.g (NewInferenceType cenv.g) exprTy (None, Some unnamedCurriedCallerArgs.Head.Head, exprTy) @@ -9754,7 +9800,7 @@ and TcMethodApplication let GenerateMatchingSimpleArgumentTypes (calledMeth: MethInfo) = let curriedMethodArgAttribs = calledMeth.GetParamAttribs(cenv.amap, mItem) curriedMethodArgAttribs - |> List.map (List.filter isSimpleFormalArg >> NewInferenceTypes) + |> List.map (List.filter isSimpleFormalArg >> NewInferenceTypes cenv.g) let UnifyMatchingSimpleArgumentTypes exprTy (calledMeth: MethInfo) = let curriedArgTys = GenerateMatchingSimpleArgumentTypes calledMeth @@ -10680,9 +10726,9 @@ and TcAndBuildFixedExpr cenv env (overallPatTy, fixedExpr, overallExprTy, mBindi let elemPtrTy = mkNativePtrTy cenv.g elemTy UnifyTypes cenv env mBinding elemPtrTy overallPatTy - // let ptr: nativeptr = - // let tmpArray: elem[] = arr - // if nonNull tmpArray then + // let ptr : nativeptr = + // let tmpArray : elem[] = arr + // if notNull tmpArray then // if tmpArray.Length <> 0 then // let pinned tmpArrayByref: byref = &arr.[0] // (nativeint) tmpArrayByref @@ -10741,7 +10787,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt let isFixed, rhsExpr, overallPatTy, overallExprTy = match rhsExpr with - | SynExpr.Fixed (e, _) -> true, e, NewInferenceType(), overallTy + | SynExpr.Fixed (e, _) -> true, e, NewInferenceType cenv.g, overallTy | e -> false, e, overallTy, overallTy // Check the attributes of the binding, parameters or return value @@ -10794,7 +10840,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt if Option.isSome memberFlagsOpt then errorR(Error(FSComp.SR.tcEntryPointAttributeRequiresFunctionInModule(), mBinding)) else - UnifyTypes cenv env mBinding overallPatTy (mkArrayType cenv.g cenv.g.string_ty --> cenv.g.int_ty) + UnifyTypes cenv env mBinding overallPatTy (mkFunTy cenv.g (mkArrayType cenv.g cenv.g.string_ty) cenv.g.int_ty) if isMutable && isInline then errorR(Error(FSComp.SR.tcMutableValuesCannotBeInline(), mBinding)) @@ -10873,7 +10919,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt // Assert the return type of an active pattern match apinfoOpt with | Some (apinfo, ty, _) -> - let activePatResTys = NewInferenceTypes apinfo.ActiveTags + let activePatResTys = NewInferenceTypes cenv.g apinfo.ActiveTags let _, rty = stripFunTy cenv.g ty UnifyTypes cenv env mBinding (apinfo.ResultType cenv.g rhsExpr.Range activePatResTys) rty | None -> @@ -11044,7 +11090,7 @@ and TcAttribute canFail cenv (env: TcEnv) attrTgt (synAttr: SynAttribute) = let meths = minfos |> List.map (fun minfo -> minfo, None) let afterResolution = ForNewConstructors cenv.tcSink env tyid.idRange methodName minfos let (expr, attributeAssignedNamedItems, _), _ = - TcMethodApplication true cenv env tpenv None [] mAttr mAttr methodName None ad PossiblyMutates false meths afterResolution NormalValUse [arg] (NewInferenceType ()) [] + TcMethodApplication true cenv env tpenv None [] mAttr mAttr methodName None ad PossiblyMutates false meths afterResolution NormalValUse [arg] (NewInferenceType cenv.g) [] UnifyTypes cenv env mAttr ty (tyOfExpr cenv.g expr) @@ -11139,7 +11185,7 @@ and TcAttributes cenv env attrTgt synAttribs = and TcLetBinding cenv isUse env containerInfo declKind tpenv (synBinds, synBindsRange, scopem) = // Typecheck all the bindings... - let checkedBinds, tpenv = List.mapFold (fun tpenv b -> TcNonRecursiveBinding declKind cenv env tpenv (NewInferenceType ()) b) tpenv synBinds + let checkedBinds, tpenv = List.mapFold (fun tpenv b -> TcNonRecursiveBinding declKind cenv env tpenv (NewInferenceType cenv.g) b) tpenv synBinds let (ContainerInfo(altActualParent, _)) = containerInfo // Canonicalize constraints prior to generalization @@ -11446,10 +11492,10 @@ and ApplyAbstractSlotInference (cenv: cenv) (envinner: TcEnv) (bindingTy, m, syn then mkMethodTy cenv.g argTysFromAbsSlot retTyFromAbsSlot else match argTysFromAbsSlot with - | [argTysFromAbsSlot] -> mkRefTupledTy cenv.g argTysFromAbsSlot --> cenv.g.unit_ty + | [argTysFromAbsSlot] -> mkFunTy cenv.g (mkRefTupledTy cenv.g argTysFromAbsSlot) cenv.g.unit_ty | _ -> error(Error(FSComp.SR.tcInvalidSignatureForSet(), memberId.idRange)) - retTyFromAbsSlot --> cenv.g.unit_ty + mkFunTy cenv.g retTyFromAbsSlot cenv.g.unit_ty UnifyTypes cenv envinner m bindingTy absSlotTy) @@ -11539,11 +11585,11 @@ and AnalyzeRecursiveStaticMemberOrValDecl | Some superTy -> MakeAndPublishBaseVal cenv envinner (match baseValOpt with None -> None | Some v -> Some v.Id) superTy | None -> None - let domainTy = NewInferenceType () + let domainTy = NewInferenceType cenv.g // This is the type we pretend a constructor has, because its implementation must ultimately appear to return a value of the given type // This is somewhat awkward later in codegen etc. - UnifyTypes cenv envinner mBinding ty (domainTy --> objTy) + UnifyTypes cenv envinner mBinding ty (mkFunTy cenv.g domainTy objTy) safeThisValOpt, baseValOpt @@ -11593,8 +11639,8 @@ and AnalyzeRecursiveInstanceMemberDecl let baseValOpt = if tcref.IsFSharpObjectModelTycon then baseValOpt else None // Apply the known type of 'this' - let bindingTy = NewInferenceType () - UnifyTypes cenv envinner mBinding ty (thisTy --> bindingTy) + let bindingTy = NewInferenceType cenv.g + UnifyTypes cenv envinner mBinding ty (mkFunTy cenv.g thisTy bindingTy) CheckForNonAbstractInterface declKind tcref memberFlags memberId.idRange @@ -11691,7 +11737,7 @@ and AnalyzeAndMakeAndPublishRecursiveValue overridesOK isGeneratedEventVal cenv let bindingAttribs = TcAttributes cenv env attrTgt bindingSynAttribs // Allocate the type inference variable for the inferred type - let ty = NewInferenceType () + let ty = NewInferenceType cenv.g let inlineFlag = ComputeInlineFlag memberFlagsOpt isInline isMutable mBinding @@ -12158,7 +12204,7 @@ and TcLetrecAdjustMemberForSpecialVals cenv (pgrbind: PostGeneralizationRecursiv | Some bind -> let m = expr.Range let tps, vsl, body, returnTy = stripTopLambda (expr, vspec.Type) - mkMultiLambdas m tps vsl (mkLetBind m bind body, returnTy) + mkMultiLambdas cenv.g m tps vsl (mkLetBind m bind body, returnTy) // Add a call to CheckInit if necessary for instance members let expr = @@ -12171,7 +12217,7 @@ and TcLetrecAdjustMemberForSpecialVals cenv (pgrbind: PostGeneralizationRecursiv let thisVar = vsl.Head.Head let thisTypeInst = argsOfAppTy cenv.g thisVar.Type let newBody = MakeCheckSafeInitField cenv.g thisTypeInst (Some thisVar) rfref (mkOne cenv.g m) body - mkMultiLambdas m tps vsl (newBody, returnTy) + mkMultiLambdas cenv.g m tps vsl (newBody, returnTy) | NoSafeInitInfo -> expr @@ -12184,7 +12230,7 @@ and TcLetrecAdjustMemberForSpecialVals cenv (pgrbind: PostGeneralizationRecursiv | _ -> let m = expr.Range let tps, vsl, body, returnTy = stripTopLambda (expr, vspec.Type) - mkMemberLambdas m tps None baseValOpt vsl (body, returnTy) + mkMemberLambdas cenv.g m tps None baseValOpt vsl (body, returnTy) { ValScheme = pgrbind.ValScheme Binding = TBind(vspec, expr, spBind) } @@ -12501,8 +12547,8 @@ module TcRecdUnionAndEnumDeclarations = begin NewRecdField true (Some v) id false thisTy false false [] attrs (xmldoc.ToXmlDoc()) vis false let TcEnumDecls cenv env parent thisTy enumCases = - let fieldTy = NewInferenceType () - let enumCases' = enumCases |> List.map (TcEnumDecl cenv env parent thisTy fieldTy) |> CheckDuplicates (fun f -> f.Id) "enum element" + let fieldTy = NewInferenceType cenv.g + let enumCases' = enumCases |> List.map (TcEnumDecl cenv env parent thisTy fieldTy) |> CheckDuplicates (fun f -> f.Id) "enum element" fieldTy, enumCases' end @@ -12692,7 +12738,7 @@ module IncrClassChecking = let ctorValScheme, ctorVal = let argty = mkRefTupledTy cenv.g (typesOfVals ctorArgs) // Initial type has known information - let ctorTy = mkFunTy argty objTy + let ctorTy = mkFunTy cenv.g argty objTy // REVIEW: no attributes can currently be specified for the implicit constructor let attribs = TcAttributes cenv env (AttributeTargets.Constructor ||| AttributeTargets.Method) attrs let memberFlags = CtorMemberFlags @@ -12718,7 +12764,7 @@ module IncrClassChecking = lazy (let cctorArgs = [ fst(mkCompGenLocal m "unitVar" cenv.g.unit_ty) ] - let cctorTy = mkFunTy cenv.g.unit_ty cenv.g.unit_ty + let cctorTy = mkFunTy cenv.g cenv.g.unit_ty cenv.g.unit_ty let valSynData = SynValInfo([[]], SynInfo.unnamedRetVal) let id = ident ("cctor", m) CheckForNonAbstractInterface ModuleOrMemberBinding tcref ClassCtorMemberFlags id.idRange @@ -12888,7 +12934,7 @@ module IncrClassChecking = if isStatic then tauTy, topValInfo else - let tauTy = ctorInfo.InstanceCtorThisVal.Type --> v.TauType + let tauTy = mkFunTy cenv.g ctorInfo.InstanceCtorThisVal.Type v.TauType let (ValReprInfo(tpNames, args, ret)) = topValInfo let topValInfo = ValReprInfo(tpNames, ValReprInfo.selfMetadata :: args, ret) tauTy, topValInfo @@ -13183,7 +13229,7 @@ module IncrClassChecking = | InMethod(isStatic, methodVal, _) -> let _, chooseTps, tauExpr, tauTy, m = match rhsExpr with - | Expr.TyChoose (chooseTps, b, _) -> [], chooseTps, b, (tyOfExpr g b), m + | Expr.TyChoose (chooseTps, b, _) -> [], chooseTps, b, tyOfExpr g b, m | Expr.TyLambda (_, tps, Expr.TyChoose (chooseTps, b, _), m, returnTy) -> tps, chooseTps, b, returnTy, m | Expr.TyLambda (_, tps, b, m, returnTy) -> tps, [], b, returnTy, m | e -> [], [], e, (tyOfExpr g e), e.Range @@ -13388,7 +13434,7 @@ module IncrClassChecking = let ctorBody = List.foldBack (fun (_, binder) acc -> binder acc) ctorInitActionsPre ctorBody // Add the final wrapping to make this into a method - let ctorBody = mkMemberLambdas m [] (Some thisVal) ctorInfo.InstanceCtorBaseValOpt [ctorInfo.InstanceCtorArgs] (ctorBody, g.unit_ty) + let ctorBody = mkMemberLambdas g m [] (Some thisVal) ctorInfo.InstanceCtorBaseValOpt [ctorInfo.InstanceCtorArgs] (ctorBody, g.unit_ty) ctorBody @@ -13402,8 +13448,8 @@ module IncrClassChecking = let cctorArgs, cctorVal, _ = ctorInfo.StaticCtorValInfo.Force() // Reconstitute the type of the implicit class constructor with the correct quantified type variables. cctorVal.SetType (mkForallTyIfNeeded ctorDeclaredTypars cctorVal.TauType) - let cctorBody = mkMemberLambdas m [] None None [cctorArgs] (cctorInitAction, g.unit_ty) - Some cctorBody + let cctorBody = mkMemberLambdas g m [] None None [cctorArgs] (cctorInitAction, g.unit_ty) + Some(cctorBody) ctorBody, cctorBodyOpt, methodBinds, reps @@ -13484,8 +13530,6 @@ module MutRecBindingChecking = type MutRecDefnsPhase2CData = MutRecShape list - - // Phase2A: create member prelimRecValues for "recursive" items, i.e. ctor val and member vals // Phase2A: also processes their arg patterns - collecting type assertions let TcMutRecBindings_Phase2A_CreateRecursiveValuesAndCheckArgumentPatterns cenv tpenv (envMutRec, mutRecDefns: MutRecDefnsPhase2Info) = @@ -13805,7 +13849,7 @@ module MutRecBindingChecking = errorR(Error(FSComp.SR.tcDllImportNotAllowed(), bind.Var.Range)) let nm = bind.Var.DisplayName - let ty = generalizedTyconRef tcref + let ty = generalizedTyOfTyconRef g tcref let ad = envNonRec.eAccessRights match TryFindIntrinsicMethInfo cenv.infoReader bind.Var.Range ad nm ty, TryFindPropInfo cenv.infoReader bind.Var.Range ad nm ty with @@ -13882,7 +13926,6 @@ module MutRecBindingChecking = // Fixup recursive references to members. let TcMutRecBindings_Phase2C_FixupRecursiveReferences cenv (denv, defnsBs: MutRecDefnsPhase2BData, generalizedTyparsForRecursiveBlock: Typar list, generalizedRecBinds: PostGeneralizationRecursiveBinding list, scopem) = let g = cenv.g - // Build an index ---> binding map let generalizedBindingsMap = generalizedRecBinds |> List.map (fun pgrbind -> (pgrbind.RecBindingInfo.Index, pgrbind)) |> Map.ofList @@ -13973,7 +14016,7 @@ module MutRecBindingChecking = | _ -> false) if needsSafeStaticInit && hasStaticBindings then - let rfield = MakeSafeInitField g envForDecls tcref.Range true + let rfield = MakeSafeInitField g envForDecls tcref.Range true SafeInitField(mkRecdFieldRef tcref rfield.Name, rfield) else NoSafeInitInfo @@ -14071,6 +14114,7 @@ module MutRecBindingChecking = /// Check a "module X = A.B.C" module abbreviation declaration let TcModuleAbbrevDecl (cenv: cenv) scopem env (id, p, m) = + let g = cenv.g let ad = env.eAccessRights let resolved = match p with @@ -14083,7 +14127,7 @@ module MutRecBindingChecking = errorR(Error(FSComp.SR.tcModuleAbbreviationForNamespace(fullDisplayTextOfModRef (List.head modrefs)), m)) let modrefs = modrefs |> List.filter (fun mvv -> not mvv.IsNamespace) if isNil modrefs then env else - modrefs |> List.iter (fun modref -> CheckEntityAttributes cenv.g modref m |> CommitOperationResult) + modrefs |> List.iter (fun modref -> CheckEntityAttributes g modref m |> CommitOperationResult) let env = AddModuleAbbreviationAndReport cenv.tcSink scopem id modrefs env env @@ -14103,6 +14147,7 @@ module MutRecBindingChecking = /// Compute the active environments within each nested module. let TcMutRecDefns_ComputeEnvs getTyconOpt getVals (cenv: cenv) report scopem m envInitial mutRecShape = + let g = cenv.g (envInitial, mutRecShape) ||> MutRecShapes.computeEnvs (fun envAbove (MutRecDefnsPhase2DataForModule (mtypeAcc, mspec)) -> MakeInnerEnvWithAcc envAbove mspec.Id mtypeAcc mspec.ModuleOrNamespaceType.ModuleOrNamespaceKind) (fun envAbove decls -> @@ -14135,15 +14180,15 @@ module MutRecBindingChecking = let envForDecls = envAbove // Add the modules being defined - let envForDecls = (envForDecls, mspecs) ||> List.fold ((if report then AddLocalSubModuleAndReport cenv.tcSink scopem else AddLocalSubModule) cenv.g cenv.amap m) + let envForDecls = (envForDecls, mspecs) ||> List.fold ((if report then AddLocalSubModuleAndReport cenv.tcSink scopem else AddLocalSubModule) g cenv.amap m) // Process the 'open' declarations - let envForDecls = (envForDecls, opens) ||> List.fold (fun env (mp, m) -> TcOpenDecl cenv.tcSink cenv.g cenv.amap m scopem env mp) + let envForDecls = (envForDecls, opens) ||> List.fold (fun env (mp, m) -> TcOpenDecl cenv.tcSink g cenv.amap m scopem env mp) // Add the type definitions being defined - let envForDecls = (if report then AddLocalTyconsAndReport cenv.tcSink scopem else AddLocalTycons) cenv.g cenv.amap m tycons envForDecls + let envForDecls = (if report then AddLocalTyconsAndReport cenv.tcSink scopem else AddLocalTycons) g cenv.amap m tycons envForDecls // Add the exception definitions being defined let envForDecls = (envForDecls, exns) ||> List.fold (AddLocalExnDefnAndReport cenv.tcSink scopem) // Add the modules again (but don't report them a second time) - let envForDecls = (envForDecls, mspecs) ||> List.fold (AddLocalSubModule cenv.g cenv.amap m) + let envForDecls = (envForDecls, mspecs) ||> List.fold (AddLocalSubModule g cenv.amap m) // Add the module abbreviations let envForDecls = (envForDecls, moduleAbbrevs) ||> List.fold (TcModuleAbbrevDecl cenv scopem) // Add the values and members @@ -14291,7 +14336,7 @@ let TcMutRecDefns_Phase2 cenv envInitial bindsm scopem mutRecNSInfo (envMutRec: let overridesOK = DeclKind.CanOverrideOrImplement declKind members |> List.collect (function | SynMemberDefn.Interface(ity, defnOpt, _) -> - let _, ty = if tcref.Deref.IsExceptionDecl then [], g.exn_ty else generalizeTyconRef tcref + let ty = if tcref.Deref.IsExceptionDecl then g.exn_ty else generalizedTyOfTyconRef g tcref let m = ity.Range if tcref.IsTypeAbbrev then error(Error(FSComp.SR.tcTypeAbbreviationsCannotHaveInterfaceDeclaration(), m)) if tcref.IsEnumTycon then error(Error(FSComp.SR.tcEnumerationsCannotHaveInterfaceDeclaration(), m)) @@ -14402,7 +14447,7 @@ module AddAugmentationDeclarations = if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare g tycon && scSet.Contains tycon.Stamp then let tcref = mkLocalTyconRef tycon let tcaug = tycon.TypeContents - let _, ty = if tcref.Deref.IsExceptionDecl then [], g.exn_ty else generalizeTyconRef tcref + let ty = if tcref.Deref.IsExceptionDecl then g.exn_ty else generalizedTyOfTyconRef g tcref let m = tycon.Range let genericIComparableTy = mkAppTy g.system_GenericIComparable_tcref [ty] @@ -14456,7 +14501,7 @@ module AddAugmentationDeclarations = let AddGenericCompareBindings cenv (tycon: Tycon) = - if (* AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare cenv.g tycon && *) Option.isSome tycon.GeneratedCompareToValues then + if (* AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare g tycon && *) Option.isSome tycon.GeneratedCompareToValues then AugmentWithHashCompare.MakeBindingsForCompareAugmentation cenv.g tycon else [] @@ -14489,7 +14534,7 @@ module AddAugmentationDeclarations = if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals g tycon then let tcref = mkLocalTyconRef tycon let tcaug = tycon.TypeContents - let _, ty = if tcref.Deref.IsExceptionDecl then [], g.exn_ty else generalizeTyconRef tcref + let ty = if tcref.Deref.IsExceptionDecl then g.exn_ty else generalizedTyOfTyconRef g tcref let m = tycon.Range // Note: tycon.HasOverride only gives correct results after we've done the type augmentation @@ -14528,7 +14573,7 @@ module TyconConstraintInference = // Initially, assume the equality relation is available for all structural type definitions let initialAssumedTycons = set [ for (tycon, _) in tyconsWithStructuralTypes do - if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare cenv.g tycon then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare g tycon then yield tycon.Stamp ] // Initially, don't assume that the equality relation is dependent on any type variables @@ -14544,7 +14589,7 @@ module TyconConstraintInference = let rec checkIfFieldTypeSupportsComparison (tycon: Tycon) (ty: TType) = // Is the field type a type parameter? - match tryDestTyparTy cenv.g ty with + match tryDestTyparTy g ty with | ValueSome tp -> // Look for an explicit 'comparison' constraint if tp.Constraints |> List.exists (function TyparConstraint.SupportsComparison _ -> true | _ -> false) then @@ -14592,8 +14637,8 @@ module TyconConstraintInference = assumedTycons |> Set.filter (fun tyconStamp -> let (tycon, structuralTypes) = tab.[tyconStamp] - if cenv.g.compilingFslib && - AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare cenv.g tycon && + if g.compilingFslib && + AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare g tycon && not (HasFSharpAttribute g g.attrib_StructuralComparisonAttribute tycon.Attribs) && not (HasFSharpAttribute g g.attrib_NoComparisonAttribute tycon.Attribs) then errorR(Error(FSComp.SR.tcFSharpCoreRequiresExplicit(), tycon.Range)) @@ -14659,7 +14704,7 @@ module TyconConstraintInference = // Initially, assume the equality relation is available for all structural type definitions let initialAssumedTycons = set [ for (tycon, _) in tyconsWithStructuralTypes do - if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals cenv.g tycon then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals g tycon then yield tycon.Stamp ] // Initially, don't assume that the equality relation is dependent on any type variables @@ -14673,7 +14718,7 @@ module TyconConstraintInference = // Checks if a field type supports the 'equality' constraint based on the assumptions about the type constructors // and type parameters. let rec checkIfFieldTypeSupportsEquality (tycon: Tycon) (ty: TType) = - match tryDestTyparTy cenv.g ty with + match tryDestTyparTy g ty with | ValueSome tp -> // Look for an explicit 'equality' constraint if tp.Constraints |> List.exists (function TyparConstraint.SupportsEquality _ -> true | _ -> false) then @@ -14720,8 +14765,8 @@ module TyconConstraintInference = let (tycon, structuralTypes) = tab.[tyconStamp] - if cenv.g.compilingFslib && - AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals cenv.g tycon && + if g.compilingFslib && + AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals g tycon && not (HasFSharpAttribute g g.attrib_StructuralEqualityAttribute tycon.Attribs) && not (HasFSharpAttribute g g.attrib_NoEqualityAttribute tycon.Attribs) then errorR(Error(FSComp.SR.tcFSharpCoreRequiresExplicit(), tycon.Range)) @@ -14733,7 +14778,7 @@ module TyconConstraintInference = if not res then match TryFindFSharpBoolAttribute g g.attrib_StructuralEqualityAttribute tycon.Attribs with | Some true -> - if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals cenv.g tycon then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals g tycon then match structuralTypes |> List.tryFind (fst >> checkIfFieldTypeSupportsEquality tycon >> not) with | None -> assert false @@ -14748,7 +14793,7 @@ module TyconConstraintInference = | Some false -> () | None -> - if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals cenv.g tycon then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals g tycon then match structuralTypes |> List.tryFind (fst >> checkIfFieldTypeSupportsEquality tycon >> not) with | None -> assert false @@ -14817,7 +14862,7 @@ module TcExceptionDeclarations = NewExn cpath id vis (TExnFresh (MakeRecdFieldsTable [])) attrs (doc.ToXmlDoc()) let TcExnDefnCore_Phase1G_EstablishRepresentation cenv env parent (exnc: Entity) (SynExceptionDefnRepr(_, UnionCase(_, _, args, _, _, _), reprIdOpt, _, _, m)) = - let g = cenv.g + let g = cenv.g let args = match args with (UnionCaseFields args) -> args | _ -> error(Error(FSComp.SR.tcExplicitTypeSpecificationCannotBeUsedForExceptionConstructors(), m)) let ad = env.eAccessRights let id = exnc.Id @@ -15614,7 +15659,7 @@ module EstablishTypeDefinitionCores = let id = tycon.Id let thisTyconRef = mkLocalTyconRef tycon let innerParent = Parent thisTyconRef - let thisTyInst, thisTy = generalizeTyconRef thisTyconRef + let thisTyInst, thisTy = generalizeTyconRef g thisTyconRef let hasAbstractAttr = HasFSharpAttribute g g.attrib_AbstractClassAttribute attrs let hasSealedAttr = @@ -15646,8 +15691,8 @@ module EstablishTypeDefinitionCores = let allowNullLiteralAttributeCheck() = if hasAllowNullLiteralAttr then - tycon.TypeContents.tcaug_super |> Option.iter (fun ty -> if not (TypeNullIsExtraValue g m ty) then errorR (Error(FSComp.SR.tcAllowNullTypesMayOnlyInheritFromAllowNullTypes(), m))) - tycon.ImmediateInterfaceTypesOfFSharpTycon |> List.iter (fun ty -> if not (TypeNullIsExtraValue g m ty) then errorR (Error(FSComp.SR.tcAllowNullTypesMayOnlyInheritFromAllowNullTypes(), m))) + tycon.TypeContents.tcaug_super |> Option.iter (fun ty -> if not (TypeNullIsExtraValueOld g m ty) then errorR (Error(FSComp.SR.tcAllowNullTypesMayOnlyInheritFromAllowNullTypes(), m))) + tycon.ImmediateInterfaceTypesOfFSharpTycon |> List.iter (fun ty -> if not (TypeNullIsExtraValueOld g m ty) then errorR (Error(FSComp.SR.tcAllowNullTypesMayOnlyInheritFromAllowNullTypes(), m))) let structLayoutAttributeCheck allowed = @@ -15663,9 +15708,9 @@ module EstablishTypeDefinitionCores = errorR (Error(FSComp.SR.tcGenericTypesCannotHaveStructLayout(), m)) | None -> () - let hiddenReprChecks hasRepr = + let hiddenReprChecks(hasRepr) = structLayoutAttributeCheck false - if hasSealedAttr = Some false || (hasRepr && hasSealedAttr <> Some true && not (id.idText = "Unit" && g.compilingFslib) ) then + if hasSealedAttr = Some false || (hasRepr && hasSealedAttr <> Some(true) && not (id.idText = "Unit" && g.compilingFslib) ) then errorR(Error(FSComp.SR.tcRepresentationOfTypeHiddenBySignature(), m)) if hasAbstractAttr then errorR (Error(FSComp.SR.tcOnlyClassesCanHaveAbstract(), m)) @@ -15875,7 +15920,7 @@ module EstablishTypeDefinitionCores = noAbstractClassAttributeCheck() noFieldsCheck userFields let ty', _ = TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurence.UseInType envinner tpenv ty - let _, curriedArgInfos, returnTy, _ = GetTopValTypeInCompiledForm g (arity |> TranslateTopValSynInfo m (TcAttributes cenv envinner) |> TranslatePartialArity []) ty' m + let _, curriedArgInfos, returnTy, _ = GetTopValTypeInCompiledForm g (arity |> TranslateTopValSynInfo m (TcAttributes cenv envinner) |> TranslatePartialArity []) ty' m if curriedArgInfos.Length < 1 then error(Error(FSComp.SR.tcInvalidDelegateSpecification(), m)) if curriedArgInfos.Length > 1 then error(Error(FSComp.SR.tcDelegatesCannotBeCurried(), m)) let ttps = thisTyconRef.Typars m @@ -15974,7 +16019,7 @@ module EstablishTypeDefinitionCores = | TType_anon (_,l) | TType_tuple (_, l) -> accInAbbrevTypes l acc | TType_ucase (UCRef(tc, _), tinst) - | TType_app (tc, tinst) -> + | TType_app (tc, tinst, _) -> let tycon2 = tc.Deref let acc = accInAbbrevTypes tinst acc // Record immediate recursive references @@ -15987,7 +16032,7 @@ module EstablishTypeDefinitionCores = else acc - | TType_fun (d, r) -> + | TType_fun (d, r, _nullness) -> accInAbbrevType d (accInAbbrevType r acc) | TType_var _ -> acc @@ -16085,7 +16130,7 @@ module EstablishTypeDefinitionCores = and accStructFieldType structTycon structTyInst fspec fieldTy (doneTypes, acc) = let fieldTy = stripTyparEqns fieldTy match fieldTy with - | TType_app (tcref2, tinst2) when tcref2.IsStructOrEnumTycon -> + | TType_app (tcref2, tinst2, _nullness) when tcref2.IsStructOrEnumTycon -> // The field is a struct. // An edge (tycon, tycon2) should be recorded, unless it is the "static self-typed field" case. let tycon2 = tcref2.Deref @@ -16105,7 +16150,7 @@ module EstablishTypeDefinitionCores = else let acc = insertEdgeToTycon tycon2 acc // collect edge (tycon, tycon2), if tycon2 is initial. accStructInstanceFields fieldTy tycon2 tinst2 (doneTypes, acc) // recurse through struct field looking for more edges - | TType_app (tcref2, tinst2) when tcref2.IsTypeAbbrev -> + | TType_app (tcref2, tinst2, _nullness) when tcref2.IsTypeAbbrev -> // The field is a type abbreviation. Expand and repeat. accStructFieldType structTycon structTyInst fspec (reduceTyconRefAbbrev tcref2 tinst2) (doneTypes, acc) | _ -> @@ -16135,7 +16180,7 @@ module EstablishTypeDefinitionCores = let acc = [] let acc = if tycon.IsStructOrEnumTycon then - let tinst, ty = generalizeTyconRef (mkLocalTyconRef tycon) + let tinst, ty = generalizeTyconRef g (mkLocalTyconRef tycon) let _, acc = accStructAllFields ty tycon tinst ([], acc) acc else @@ -16332,7 +16377,7 @@ module TcDeclarations = /// Given a type definition, compute whether its members form an extension of an existing type, and if so if it is an /// intrinsic or extrinsic extension - let private ComputeTyconDeclKind cenv envForDecls tyconOpt isAtOriginalTyconDefn inSig m (synTypars: SynTyparDecl list) synTyparCxs longPath = + let private ComputeTyconDeclKind cenv tyconOpt isAtOriginalTyconDefn envForDecls inSig m (synTypars: SynTyparDecl list) synTyparCxs longPath = let g = cenv.g let ad = envForDecls.eAccessRights @@ -16666,7 +16711,7 @@ module TcDeclarations = let (MutRecDefnsPhase1DataForTycon(synTyconInfo, _, _, _, _, isAtOriginalTyconDefn)) = typeDefnCore let tyDeclRange = synTyconInfo.Range let (ComponentInfo(_, typars, cs, longPath, _, _, _, _)) = synTyconInfo - let declKind, tcref, declaredTyconTypars = ComputeTyconDeclKind cenv envForDecls tyconOpt isAtOriginalTyconDefn false tyDeclRange typars cs longPath + let declKind, tcref, declaredTyconTypars = ComputeTyconDeclKind cenv tyconOpt isAtOriginalTyconDefn envForDecls false tyDeclRange typars cs longPath let newslotsOK = (if isAtOriginalTyconDefn && tcref.IsFSharpObjectModelTycon then NewSlotsOK else NoNewSlots) if (declKind = ExtrinsicExtensionBinding) && isByrefTyconRef cenv.g tcref then @@ -16787,7 +16832,7 @@ module TcDeclarations = let tpenv = emptyUnscopedTyparEnv let (MutRecDefnsPhase1DataForTycon (_, _, _, _, _, isAtOriginalTyconDefn)) = tyconCore let (ComponentInfo(_, typars, cs, longPath, _, _, _, m)) = synTyconInfo - let declKind, tcref, declaredTyconTypars = ComputeTyconDeclKind cenv envForDecls tyconOpt isAtOriginalTyconDefn true m typars cs longPath + let declKind, tcref, declaredTyconTypars = ComputeTyconDeclKind cenv tyconOpt isAtOriginalTyconDefn envForDecls true m typars cs longPath let envForTycon = AddDeclaredTypars CheckForDuplicateTypars declaredTyconTypars envForDecls let envForTycon = MakeInnerEnvForTyconRef envForTycon tcref (declKind = ExtrinsicExtensionBinding) @@ -16839,6 +16884,7 @@ module TcDeclarations = let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synSigDecl: Eventually = eventually { try + let g = cenv.g match synSigDecl with | SynModuleSigDecl.Exception (edef, m) -> let scopem = unionRanges m.EndRange endm @@ -16853,7 +16899,7 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS | SynModuleSigDecl.Open (mp, m) -> let scopem = unionRanges m.EndRange endm - let env = TcOpenDecl cenv.tcSink cenv.g cenv.amap m scopem env mp + let env = TcOpenDecl cenv.tcSink g cenv.amap m scopem env mp return env | SynModuleSigDecl.Val (vspec, m) -> @@ -16877,8 +16923,8 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS let id = ComputeModuleName longPath let vis, _ = ComputeAccessAndCompPath env None im vis None parent let attribs = TcAttributes cenv env AttributeTargets.ModuleDecl attribs - CheckNamespaceModuleOrTypeName cenv.g id - let modKind = EstablishTypeDefinitionCores.ComputeModuleOrNamespaceKind cenv.g true typeNames attribs id.idText + CheckNamespaceModuleOrTypeName g id + let modKind = EstablishTypeDefinitionCores.ComputeModuleOrNamespaceKind g true typeNames attribs id.idText let modName = EstablishTypeDefinitionCores.AdjustModuleName modKind id.idText CheckForDuplicateConcreteType env modName id.idRange @@ -16892,7 +16938,7 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS mspec.entity_modul_contents <- MaybeLazy.Strict mtyp let scopem = unionRanges m endm PublishModuleDefn cenv env mspec - let env = AddLocalSubModuleAndReport cenv.tcSink scopem cenv.g cenv.amap m env mspec + let env = AddLocalSubModuleAndReport cenv.tcSink scopem g cenv.amap m env mspec return env | SynModuleSigDecl.ModuleAbbrev (id, p, m) -> @@ -16911,7 +16957,7 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS errorR(Error(FSComp.SR.tcModuleAbbreviationForNamespace(fullDisplayTextOfModRef (List.head unfilteredModrefs)), m)) if List.isEmpty modrefs then return env else - modrefs |> List.iter (fun modref -> CheckEntityAttributes cenv.g modref m |> CommitOperationResult) + modrefs |> List.iter (fun modref -> CheckEntityAttributes g modref m |> CommitOperationResult) let env = AddModuleAbbreviationAndReport cenv.tcSink scopem id modrefs env return env @@ -16923,7 +16969,7 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS | SynModuleSigDecl.NamespaceFragment (SynModuleOrNamespaceSig(longId, isRec, kind, defs, xml, attribs, vis, m)) -> do for id in longId do - CheckNamespaceModuleOrTypeName cenv.g id + CheckNamespaceModuleOrTypeName g id // Logically speaking, this changes // module [rec] A.B.M @@ -16940,7 +16986,7 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS longId, defs let envNS = LocateEnv cenv.topCcu env enclosingNamespacePath - let envNS = ImplicitlyOpenOwnNamespace cenv.tcSink cenv.g cenv.amap m enclosingNamespacePath envNS + let envNS = ImplicitlyOpenOwnNamespace cenv.tcSink g cenv.amap m enclosingNamespacePath envNS // For 'namespace rec' and 'module rec' we add the thing being defined let mtypNS = !(envNS.eModuleOrNamespaceTypeAccumulator) @@ -16953,7 +16999,7 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS CallNameResolutionSink cenv.tcSink (mspec.Range, env.NameEnv, item, item, emptyTyparInst, ItemOccurence.Binding, env.DisplayEnv, env.eAccessRights)) // For 'namespace rec' and 'module rec' we add the thing being defined - let envNS = if isRec then AddLocalRootModuleOrNamespace cenv.tcSink cenv.g cenv.amap m envNS mtypRoot else envNS + let envNS = if isRec then AddLocalRootModuleOrNamespace cenv.tcSink g cenv.amap m envNS mtypRoot else envNS let nsInfo = Some (mspecNSOpt, envNS.eModuleOrNamespaceTypeAccumulator) let mutRecNSInfo = if isRec then nsInfo else None @@ -16965,12 +17011,12 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS if isNil enclosingNamespacePath then envAtEnd else - let env = AddLocalRootModuleOrNamespace cenv.tcSink cenv.g cenv.amap m env mtypRoot + let env = AddLocalRootModuleOrNamespace cenv.tcSink g cenv.amap m env mtypRoot // If the namespace is an interactive fragment e.g. FSI_0002, then open FSI_0002 in the subsequent environment. let env = - match TryStripPrefixPath cenv.g enclosingNamespacePath with - | Some(p, _) -> TcOpenDecl cenv.tcSink cenv.g cenv.amap m.EndRange m.EndRange env [p] + match TryStripPrefixPath g enclosingNamespacePath with + | Some(p, _) -> TcOpenDecl cenv.tcSink g cenv.amap m.EndRange m.EndRange env [p] | None -> env // Publish the combined module type @@ -17121,6 +17167,7 @@ let CheckLetOrDoInNamespace binds m = /// The non-mutually recursive case for a declaration let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem env synDecl = eventually { + let g = cenv.g cenv.synArgNameGenerator.Reset() let tpenv = emptyUnscopedTyparEnv @@ -17149,7 +17196,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem | SynModuleDecl.Open (LongIdentWithDots(mp, _), m) -> let scopem = unionRanges m.EndRange scopem - let env = TcOpenDecl cenv.tcSink cenv.g cenv.amap m scopem env mp + let env = TcOpenDecl cenv.tcSink g cenv.amap m scopem env mp return ((fun e -> e), []), env, env | SynModuleDecl.Let (letrec, binds, m) -> @@ -17191,7 +17238,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem let id = ComputeModuleName longPath let modAttrs = TcAttributes cenv env AttributeTargets.ModuleDecl attribs - let modKind = EstablishTypeDefinitionCores.ComputeModuleOrNamespaceKind cenv.g true typeNames modAttrs id.idText + let modKind = EstablishTypeDefinitionCores.ComputeModuleOrNamespaceKind g true typeNames modAttrs id.idText let modName = EstablishTypeDefinitionCores.AdjustModuleName modKind id.idText CheckForDuplicateConcreteType env modName im CheckForDuplicateModule env id.idText id.idRange @@ -17200,7 +17247,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem let endm = m.EndRange let id = ident (modName, id.idRange) - CheckNamespaceModuleOrTypeName cenv.g id + CheckNamespaceModuleOrTypeName g id let envForModule, mtypeAcc = MakeInnerEnv env id modKind @@ -17215,7 +17262,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem mspec.entity_modul_contents <- MaybeLazy.Strict !mtypeAcc let modDefn = TMDefRec(false, [], [ModuleOrNamespaceBinding.Module(mspec, mexpr)], m) PublishModuleDefn cenv env mspec - let env = AddLocalSubModuleAndReport cenv.tcSink scopem cenv.g cenv.amap m env mspec + let env = AddLocalSubModuleAndReport cenv.tcSink scopem g cenv.amap m env mspec // isContinuingModule is true for all of the following // - the implicit module of a script @@ -17235,7 +17282,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem let endm = m.EndRange do for id in longId do - CheckNamespaceModuleOrTypeName cenv.g id + CheckNamespaceModuleOrTypeName g id // Logically speaking, this changes // module [rec] A.B.M @@ -17252,7 +17299,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem longId, defs let envNS = LocateEnv cenv.topCcu env enclosingNamespacePath - let envNS = ImplicitlyOpenOwnNamespace cenv.tcSink cenv.g cenv.amap m enclosingNamespacePath envNS + let envNS = ImplicitlyOpenOwnNamespace cenv.tcSink g cenv.amap m enclosingNamespacePath envNS let mtypNS = !(envNS.eModuleOrNamespaceTypeAccumulator) let mtypRoot, mspecNSs = BuildRootModuleType enclosingNamespacePath envNS.eCompPath mtypNS @@ -17264,7 +17311,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem CallNameResolutionSink cenv.tcSink (mspec.Range, env.NameEnv, item, item, emptyTyparInst, ItemOccurence.Binding, env.DisplayEnv, env.eAccessRights)) // For 'namespace rec' and 'module rec' we add the thing being defined - let envNS = if isRec then AddLocalRootModuleOrNamespace cenv.tcSink cenv.g cenv.amap m envNS mtypRoot else envNS + let envNS = if isRec then AddLocalRootModuleOrNamespace cenv.tcSink g cenv.amap m envNS mtypRoot else envNS let nsInfo = Some (mspecNSOpt, envNS.eModuleOrNamespaceTypeAccumulator) let mutRecNSInfo = if isRec then nsInfo else None @@ -17276,12 +17323,12 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem if isNil enclosingNamespacePath then envAtEnd else - let env = AddLocalRootModuleOrNamespace cenv.tcSink cenv.g cenv.amap m env mtypRoot + let env = AddLocalRootModuleOrNamespace cenv.tcSink g cenv.amap m env mtypRoot // If the namespace is an interactive fragment e.g. FSI_0002, then open FSI_0002 in the subsequent environment let env = - match TryStripPrefixPath cenv.g enclosingNamespacePath with - | Some(p, _) -> TcOpenDecl cenv.tcSink cenv.g cenv.amap m.EndRange m.EndRange env [p] + match TryStripPrefixPath g enclosingNamespacePath with + | Some(p, _) -> TcOpenDecl cenv.tcSink g cenv.amap m.EndRange m.EndRange env [p] | None -> env // Publish the combined module type @@ -17526,7 +17573,7 @@ let ApplyDefaults cenv g denvAtEnd m mexpr extraAttribs = match tpc with | TyparConstraint.DefaultsTo(priority2, ty2, m) when priority2 = priority -> let ty1 = mkTyparTy tp - if not tp.IsSolved && not (typeEquiv cenv.g ty1 ty2) then + if not tp.IsSolved && not (typeEquiv g ty1 ty2) then let csenv = MakeConstraintSolverEnv ContextInfo.NoContext cenv.css m denvAtEnd TryD (fun () -> ConstraintSolver.SolveTyparEqualsType csenv 0 m NoTrace ty1 ty2) (fun e -> solveTypAsError cenv denvAtEnd m ty1 @@ -17593,11 +17640,11 @@ let CheckModuleSignature g cenv m denvAtEnd rootSigOpt implFileTypePriorToSig im raise (ReportedError None) // Compute the remapping from implementation to signature - let remapInfo, _ = ComputeRemappingFromInferredSignatureToExplicitSignature cenv.g implFileTypePriorToSig sigFileType + let remapInfo , _ = ComputeRemappingFromInferredSignatureToExplicitSignature g implFileTypePriorToSig sigFileType let aenv = { TypeEquivEnv.Empty with EquivTycons = TyconRefMap.OfList remapInfo.RepackagedEntities } - if not (SignatureConformance.Checker(cenv.g, cenv.amap, denv, remapInfo, true).CheckSignature aenv (mkLocalModRef implFileSpecPriorToSig) sigFileType) then ( + if not (SignatureConformance.Checker(g, cenv.amap, denv, remapInfo, true).CheckSignature aenv (mkLocalModRef implFileSpecPriorToSig) sigFileType) then ( // We can just raise 'ReportedError' since CheckModuleOrNamespace raises its own error raise (ReportedError None) ) diff --git a/src/fsharp/TypeRelations.fs b/src/fsharp/TypeRelations.fs index 6eae6fcf4f6..17902053a81 100755 --- a/src/fsharp/TypeRelations.fs +++ b/src/fsharp/TypeRelations.fs @@ -30,15 +30,15 @@ let rec TypeDefinitelySubsumesTypeNoCoercion ndeep g amap m ty1 ty2 = else let ty1 = stripTyEqns g ty1 let ty2 = stripTyEqns g ty2 - match ty1, ty2 with - | TType_app (tc1, l1), TType_app (tc2, l2) when tyconRefEq g tc1 tc2 -> + match ty1,ty2 with + | TType_app (tc1, l1, _nullness1),TType_app (tc2, l2, _nullness2) when tyconRefEq g tc1 tc2 -> // TODO NULLNESS - check it is ok to ignore nullness for this List.lengthsEqAndForall2 (typeEquiv g) l1 l2 | TType_ucase (tc1, l1), TType_ucase (tc2, l2) when g.unionCaseRefEq tc1 tc2 -> List.lengthsEqAndForall2 (typeEquiv g) l1 l2 | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> evalTupInfoIsStruct tupInfo1 = evalTupInfoIsStruct tupInfo2 && List.lengthsEqAndForall2 (typeEquiv g) l1 l2 - | TType_fun (d1, r1), TType_fun (d2, r2) -> + | TType_fun (d1, r1, _nullness1) ,TType_fun (d2, r2, _nullness2) -> // TODO NULLNESS - check it is ok to ignore nullness for this typeEquiv g d1 d2 && typeEquiv g r1 r2 | TType_measure measure1, TType_measure measure2 -> measureEquiv g measure1 measure2 @@ -69,7 +69,7 @@ let rec TypesFeasiblyEquiv ndeep g amap m ty1 ty2 = | TType_var _, _ | _, TType_var _ -> true - | TType_app (tc1, l1), TType_app (tc2, l2) when tyconRefEq g tc1 tc2 -> + | TType_app (tc1, l1, _nullness1), TType_app (tc2, l2, _nullness2) when tyconRefEq g tc1 tc2 -> List.lengthsEqAndForall2 (TypesFeasiblyEquiv ndeep g amap m) l1 l2 | TType_anon (anonInfo1, l1),TType_anon (anonInfo2, l2) -> @@ -82,7 +82,7 @@ let rec TypesFeasiblyEquiv ndeep g amap m ty1 ty2 = evalTupInfoIsStruct tupInfo1 = evalTupInfoIsStruct tupInfo2 && List.lengthsEqAndForall2 (TypesFeasiblyEquiv ndeep g amap m) l1 l2 - | TType_fun (d1, r1), TType_fun (d2, r2) -> + | TType_fun (d1, r1, _nullness1), TType_fun (d2, r2, _nullness2) -> (TypesFeasiblyEquiv ndeep g amap m) d1 d2 && (TypesFeasiblyEquiv ndeep g amap m) r1 r2 | TType_measure _, TType_measure _ -> @@ -99,8 +99,7 @@ let rec TypeFeasiblySubsumesType ndeep g amap m ty1 canCoerce ty2 = let ty2 = stripTyEqns g ty2 match ty1, ty2 with | TType_var _, _ | _, TType_var _ -> true - - | TType_app (tc1, l1), TType_app (tc2, l2) when tyconRefEq g tc1 tc2 -> + | TType_app (tc1, l1, _nullness1), TType_app (tc2, l2, _nullness2) when tyconRefEq g tc1 tc2 -> List.lengthsEqAndForall2 (TypesFeasiblyEquiv ndeep g amap m) l1 l2 | TType_tuple _, TType_tuple _ @@ -153,7 +152,9 @@ let ChooseTyparSolutionAndRange (g: TcGlobals) amap (tp:Typar) = errorR(Error(FSComp.SR.typrelCannotResolveAmbiguityInPrintf(), m)) maxSoFar, m | TyparConstraint.SupportsNull m -> - maxSoFar, m + addNullnessToTy KnownWithNull maxSoFar, m + | TyparConstraint.NotSupportsNull m -> + maxSoFar, m // NOTE: this doesn't "force" non-nullness, since it is the default choice in 'obj' or 'int' | TyparConstraint.SupportsComparison m -> join m g.mk_IComparable_ty, m | TyparConstraint.SupportsEquality m -> diff --git a/src/fsharp/ast.fs b/src/fsharp/ast.fs index 09e46ba3386..f8165ab2991 100644 --- a/src/fsharp/ast.fs +++ b/src/fsharp/ast.fs @@ -270,6 +270,7 @@ type | UserNum of value: string * suffix: string /// F# syntax: verbatim or regular string, e.g. "abc" + /// May be null coming from parser in type provider instantiation but is always treated as an error. | String of text: string * range: range /// F# syntax: verbatim or regular byte string, e.g. "abc"B. @@ -452,7 +453,10 @@ and /// F# syntax is 'typar: null | WhereTyparSupportsNull of genericName: SynTypar * range: range - /// F# syntax is 'typar: comparison + /// F# syntax is 'typar : null + | WhereTyparNotSupportsNull of genericName: SynTypar * range: range + + /// F# syntax is 'typar : comparison | WhereTyparIsComparable of genericName: SynTypar * range: range /// F# syntax is 'typar: equality @@ -528,12 +532,18 @@ and /// For the dimensionless units i.e. 1, and static parameters to provided types | StaticConstant of constant: SynConst * range: range - /// F# syntax: const expr, used in static parameters to type providers + /// F# syntax : nul used in parameters to type providers + | StaticConstantNull of range: range + + /// F# syntax : const expr, used in static parameters to type providers | StaticConstantExpr of expr: SynExpr * range: range /// F# syntax: ident=1 etc., used in static parameters to type providers | StaticConstantNamed of expr: SynType * SynType * range: range + /// F# syntax : type | null + | WithNull of SynType * ambivalent: bool * range:range + /// Get the syntactic range of source code covered by this construct. member x.Range = match x with @@ -547,10 +557,12 @@ and | SynType.Anon (range=m) | SynType.WithGlobalConstraints (range=m) | SynType.StaticConstant (range=m) + | SynType.StaticConstantNull (range=m) | SynType.StaticConstantExpr (range=m) | SynType.StaticConstantNamed (range=m) | SynType.HashConstraint (range=m) | SynType.MeasureDivide (range=m) + | SynType.WithNull (range=m) | SynType.MeasurePower (range=m) -> m | SynType.LongIdent lidwd -> lidwd.Range diff --git a/src/fsharp/autobox.fs b/src/fsharp/autobox.fs index da6b5c1d648..74ced89a283 100644 --- a/src/fsharp/autobox.fs +++ b/src/fsharp/autobox.fs @@ -70,7 +70,7 @@ let DecideExpr cenv exprF noInterceptF z expr = match expr with | Expr.Lambda (_, _ctorThisValOpt, _baseValOpt, argvs, _, m, rty) -> let topValInfo = ValReprInfo ([], [argvs |> List.map (fun _ -> ValReprInfo.unnamedTopArg1)], ValReprInfo.unnamedRetVal) - let ty = mkMultiLambdaTy m argvs rty + let ty = mkMultiLambdaTy cenv.g m argvs rty DecideLambda (Some exprF) cenv topValInfo expr ty z | Expr.TyLambda (_, tps, _, _m, rty) -> diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 89b2d6ec395..44c48698ee6 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -440,14 +440,13 @@ let GenerateInterfaceData(tcConfig: TcConfig) = let EncodeInterfaceData(tcConfig: TcConfig, tcGlobals, exportRemapping, generatedCcu, outfile, isIncrementalBuild) = if GenerateInterfaceData tcConfig then - let resource = WriteSignatureData (tcConfig, tcGlobals, exportRemapping, generatedCcu, outfile, isIncrementalBuild) + let resource1, resource2 = WriteSignatureData (tcConfig, tcGlobals, exportRemapping, generatedCcu, outfile, isIncrementalBuild) // The resource gets written to a file for FSharp.Core let useDataFiles = (tcConfig.useOptimizationDataFile || tcGlobals.compilingFslib) && not isIncrementalBuild if useDataFiles then let sigDataFileName = (Filename.chopExtension outfile)+".sigdata" - File.WriteAllBytes(sigDataFileName, resource.GetBytes()) - let resources = - [ resource ] + File.WriteAllBytes(sigDataFileName, resource1.GetBytes()) + let resources = [resource1; resource2] let sigAttr = mkSignatureDataVersionAttr tcGlobals (IL.parseILVersion Internal.Utilities.FSharpEnvironment.FSharpBinaryMetadataFormatRevision) [sigAttr], resources else @@ -463,7 +462,7 @@ let EncodeOptimizationData(tcGlobals, tcConfig: TcConfig, outfile, exportRemappi let useDataFiles = (tcConfig.useOptimizationDataFile || tcGlobals.compilingFslib) && not isIncrementalBuild if useDataFiles then let ccu, modulInfo = data - let bytes = TastPickle.pickleObjWithDanglingCcus isIncrementalBuild outfile tcGlobals ccu Optimizer.p_CcuOptimizationInfo modulInfo + let bytes, _bytesB = TastPickle.pickleObjWithDanglingCcus isIncrementalBuild outfile tcGlobals ccu Optimizer.p_CcuOptimizationInfo modulInfo let optDataFileName = (Filename.chopExtension outfile)+".optdata" File.WriteAllBytes(optDataFileName, bytes) let (ccu, optData) = @@ -471,7 +470,8 @@ let EncodeOptimizationData(tcGlobals, tcConfig: TcConfig, outfile, exportRemappi map2Of2 Optimizer.AbstractOptimizationInfoToEssentials data else data - [ WriteOptimizationData (tcGlobals, outfile, isIncrementalBuild, ccu, optData) ] + let r1, r2 = WriteOptimizationData (tcGlobals, outfile, isIncrementalBuild, ccu, optData) + [ r1; r2 ] else [ ] diff --git a/src/fsharp/fsc/fsc.fsproj b/src/fsharp/fsc/fsc.fsproj index 8ddb082c56a..8ea9e6d8b07 100644 --- a/src/fsharp/fsc/fsc.fsproj +++ b/src/fsharp/fsc/fsc.fsproj @@ -29,7 +29,12 @@ - + + + + + + diff --git a/src/fsharp/fsi/console.fs b/src/fsharp/fsi/console.fs index aa57916df52..3ad356e523d 100644 --- a/src/fsharp/fsi/console.fs +++ b/src/fsharp/fsi/console.fs @@ -6,6 +6,7 @@ open System open System.Text open System.Collections.Generic open Internal.Utilities +open FSharp.Compiler.AbstractIL.Internal.Library /// System.Console.ReadKey appears to return an ANSI character (not the expected the unicode character). /// When this fix flag is true, this byte is converted to a char using the System.Console.InputEncoding. @@ -14,8 +15,7 @@ open Internal.Utilities module internal ConsoleOptions = let readKeyFixup (c:char) = -#if FX_NO_SERVERCODEPAGES -#else +#if !FX_NO_SERVERCODEPAGES // Assumes the c:char is actually a byte in the System.Console.InputEncoding. // Convert it to a Unicode char through the encoding. if 0 <= int c && int c <= 255 then @@ -42,19 +42,26 @@ type internal History() = if current >= 0 && current < list.Count then list.[current] else String.Empty member x.Clear() = list.Clear(); current <- -1 - member x.Add line = - match line with - | null | "" -> () - | _ -> list.Add(line) - member x.AddLast line = - match line with +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + member x.Add (line: string) = +#else + member x.Add (line: string?) = +#endif + match line with | null | "" -> () - | _ -> list.Add(line); current <- list.Count + | NonNull line -> list.Add(line) - // Dead code - // member x.First() = current <- 0; x.Current - // member x.Last() = current <- list.Count - 1; x.Current +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + member x.AddLast (line: string) = +#else + member x.AddLast (line: string?) = +#endif + match line with + | null | "" -> () + | NonNull line -> + list.Add(line) + current <- list.Count member x.Previous() = if (list.Count > 0) then diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 4660b2e4817..728bc1e891e 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -333,9 +333,10 @@ type internal FsiValuePrinter(fsi: FsiEvaluationSessionHostConfig, g: TcGlobals, match obj with | null -> None | _ when aty.IsAssignableFrom(obj.GetType()) -> - match printer obj with + let text = printer obj + match box text with | null -> None - | s -> Some (wordL (TaggedTextOps.tagText s)) + | _ -> Some (wordL (TaggedTextOps.tagText text)) | _ -> None) | Choice2Of2 (aty: System.Type, converter) -> @@ -1584,8 +1585,11 @@ module internal MagicAssemblyResolution = { new System.IDisposable with member x.Dispose() = () } #else - let ResolveAssembly (ctok, m, tcConfigB, tcImports: TcImports, fsiDynamicCompiler: FsiDynamicCompiler, fsiConsoleOutput: FsiConsoleOutput, fullAssemName:string) = - +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let ResolveAssembly (ctok, m, tcConfigB, tcImports: TcImports, fsiDynamicCompiler: FsiDynamicCompiler, fsiConsoleOutput: FsiConsoleOutput, fullAssemName:string) : Assembly = +#else + let ResolveAssembly (ctok, m, tcConfigB, tcImports: TcImports, fsiDynamicCompiler: FsiDynamicCompiler, fsiConsoleOutput: FsiConsoleOutput, fullAssemName:string) : Assembly? = +#endif try // Grab the name of the assembly let tcConfig = TcConfig.Create(tcConfigB,validate=false) @@ -1705,17 +1709,25 @@ type internal FsiStdinLexerProvider let initialLightSyntaxStatus = tcConfigB.light <> Some false LightSyntaxStatus (initialLightSyntaxStatus, false (* no warnings *)) - let LexbufFromLineReader (fsiStdinSyphon: FsiStdinSyphon) readf = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let LexbufFromLineReader (fsiStdinSyphon: FsiStdinSyphon) (readf: unit -> string) = +#else + let LexbufFromLineReader (fsiStdinSyphon: FsiStdinSyphon) (readf: unit -> string?) = +#endif UnicodeLexing.FunctionAsLexbuf (fun (buf: char[], start, len) -> //fprintf fsiConsoleOutput.Out "Calling ReadLine\n" let inputOption = try Some(readf()) with :? EndOfStreamException -> None - inputOption |> Option.iter (fun t -> fsiStdinSyphon.Add (t + "\n")) + inputOption |> Option.iter (fun t -> fsiStdinSyphon.Add ((match t with null -> "" | NonNull t -> t) + "\n")) match inputOption with | Some(null) | None -> if !progress then fprintfn fsiConsoleOutput.Out "End of file from TextReader.ReadLine" 0 - | Some (input:string) -> +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + | Some input -> +#else + | Some (NonNull input) -> +#endif let input = input + "\n" let ninput = input.Length if ninput > len then fprintf fsiConsoleOutput.Error "%s" (FSIstrings.SR.fsiLineTooLong()) @@ -1729,11 +1741,18 @@ type internal FsiStdinLexerProvider // Reading stdin as a lex stream //---------------------------------------------------------------------------- +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let removeZeroCharsFromString (str:string) = (* bug://4466 *) - if str<>null && str.Contains("\000") then - System.String(str |> Seq.filter (fun c -> c<>'\000') |> Seq.toArray) - else - str +#else + let removeZeroCharsFromString (str:string?) : string? = (* bug://4466 *) +#endif + match str with + | null -> str + | NonNull str -> + if str.Contains("\000") then + System.String(str |> Seq.filter (fun c -> c<>'\000') |> Seq.toArray) + else + str let CreateLexerForLexBuffer (sourceFileName, lexbuf, errorLogger) = diff --git a/src/fsharp/fsi/fsi.fsproj b/src/fsharp/fsi/fsi.fsproj index a7bafddfded..2979715141a 100644 --- a/src/fsharp/fsi/fsi.fsproj +++ b/src/fsharp/fsi/fsi.fsproj @@ -9,6 +9,7 @@ .exe $(NoWarn);45;55;62;75;1204 true + $(OtherFlags) --checknulls $(OtherFlags) --warnon:1182 --maxerrors:20 --extraoptimizationloops:1 fsi.res true @@ -26,12 +27,17 @@ - - - + + + + + + + + - + diff --git a/src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj b/src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj index dbe31f6ec2a..96117f719f4 100644 --- a/src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj +++ b/src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj @@ -26,10 +26,15 @@ - - - - + + + + + + + + + diff --git a/src/fsharp/import.fs b/src/fsharp/import.fs index dbe4296e0fd..6ad93908ce9 100644 --- a/src/fsharp/import.fs +++ b/src/fsharp/import.fs @@ -31,7 +31,11 @@ type AssemblyLoader = /// Get a flag indicating if an assembly is a provided assembly, plus the /// table of information recording remappings from type names in the provided assembly to type /// names in the statically linked, embedded assembly. +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE abstract GetProvidedAssemblyInfo : CompilationThreadToken * range * Tainted -> bool * ProvidedAssemblyStaticLinkingMap option +#else + abstract GetProvidedAssemblyInfo : CompilationThreadToken * range * Tainted -> bool * ProvidedAssemblyStaticLinkingMap option +#endif /// Record a root for a [] type to help guide static linking & type relocation abstract RecordGeneratedTypeRoot : ProviderGeneratedType -> unit @@ -147,8 +151,20 @@ let CanImportILTypeRef (env: ImportMap) m (tref: ILTypeRef) = /// /// Prefer the F# abbreviation for some built-in types, e.g. 'string' rather than /// 'System.String', since we prefer the F# abbreviation to the .NET equivalents. -let ImportTyconRefApp (env: ImportMap) tcref tyargs = - env.g.improveType tcref tyargs +let ImportTyconRefApp (env: ImportMap) tcref tyargs nullness = + env.g.improveType tcref tyargs nullness + +let ImportNullness (g: TcGlobals) = + if g.langFeatureNullness && g.assumeNullOnImport then + KnownWithNull + else + KnownAmbivalentToNull + +let ImportNullnessForTyconRef (g: TcGlobals) (m: range) (tcref: TyconRef) = + if g.langFeatureNullness && g.assumeNullOnImport && TyconRefNullIsExtraValueOld g m tcref then + KnownWithNull + else + KnownAmbivalentToNull /// Import an IL type as an F# type. let rec ImportILType (env: ImportMap) m tinst ty = @@ -159,24 +175,36 @@ let rec ImportILType (env: ImportMap) m tinst ty = | ILType.Array(bounds, ty) -> let n = bounds.Rank let elementType = ImportILType env m tinst ty - mkArrayTy env.g n elementType m + let nullness = ImportNullness env.g + mkArrayTy env.g n nullness elementType m | ILType.Boxed tspec | ILType.Value tspec -> let tcref = ImportILTypeRef env m tspec.TypeRef let inst = tspec.GenericArgs |> List.map (ImportILType env m tinst) - ImportTyconRefApp env tcref inst + let nullness = ImportNullnessForTyconRef env.g m tcref + ImportTyconRefApp env tcref inst nullness | ILType.Byref ty -> mkByrefTy env.g (ImportILType env m tinst ty) + | ILType.Ptr ILType.Void when env.g.voidptr_tcr.CanDeref -> mkVoidPtrTy env.g + | ILType.Ptr ty -> mkNativePtrTy env.g (ImportILType env m tinst ty) + | ILType.FunctionPointer _ -> env.g.nativeint_ty (* failwith "cannot import this kind of type (ptr, fptr)" *) + | ILType.Modified(_, _, ty) -> // All custom modifiers are ignored ImportILType env m tinst ty + | ILType.TypeVar u16 -> - try List.item (int u16) tinst - with _ -> - error(Error(FSComp.SR.impNotEnoughTypeParamsInScopeWhileImporting(), m)) + let ty = + try + List.item (int u16) tinst + with _ -> + error(Error(FSComp.SR.impNotEnoughTypeParamsInScopeWhileImporting(), m)) + let nullness = ImportNullness env.g + let tyWithNullness = addNullnessToTy nullness ty + tyWithNullness let rec CanImportILType (env: ImportMap) m ty = match ty with @@ -253,7 +281,8 @@ let rec ImportProvidedType (env: ImportMap) (m: range) (* (tinst: TypeInst) *) ( let g = env.g if st.PUntaint((fun st -> st.IsArray), m) then let elemTy = (ImportProvidedType env m (* tinst *) (st.PApply((fun st -> st.GetElementType()), m))) - mkArrayTy g (st.PUntaint((fun st -> st.GetArrayRank()), m)) elemTy m + let nullness = ImportNullness env.g + mkArrayTy g (st.PUntaint((fun st -> st.GetArrayRank()), m)) nullness elemTy m elif st.PUntaint((fun st -> st.IsByRef), m) then let elemTy = (ImportProvidedType env m (* tinst *) (st.PApply((fun st -> st.GetElementType()), m))) mkByrefTy g elemTy @@ -295,12 +324,12 @@ let rec ImportProvidedType (env: ImportMap) (m: range) (* (tinst: TypeInst) *) ( if tp.Kind = TyparKind.Measure then let rec conv ty = match ty with - | TType_app (tcref, [t1;t2]) when tyconRefEq g tcref g.measureproduct_tcr -> Measure.Prod (conv t1, conv t2) - | TType_app (tcref, [t1]) when tyconRefEq g tcref g.measureinverse_tcr -> Measure.Inv (conv t1) - | TType_app (tcref, []) when tyconRefEq g tcref g.measureone_tcr -> Measure.One - | TType_app (tcref, []) when tcref.TypeOrMeasureKind = TyparKind.Measure -> Measure.Con tcref - | TType_app (tcref, _) -> - errorR(Error(FSComp.SR.impInvalidMeasureArgument1(tcref.CompiledName, tp.Name), m)) + | TType_app (tcref,[t1;t2], _) when tyconRefEq g tcref g.measureproduct_tcr -> Measure.Prod (conv t1, conv t2) + | TType_app (tcref,[t1], _) when tyconRefEq g tcref g.measureinverse_tcr -> Measure.Inv (conv t1) + | TType_app (tcref,[], _) when tyconRefEq g tcref g.measureone_tcr -> Measure.One + | TType_app (tcref,[], _) when tcref.TypeOrMeasureKind = TyparKind.Measure -> Measure.Con tcref + | TType_app (tcref, _, _) -> + errorR(Error(FSComp.SR.impInvalidMeasureArgument1(tcref.CompiledName, tp.Name),m)) Measure.One | _ -> errorR(Error(FSComp.SR.impInvalidMeasureArgument2(tp.Name), m)) @@ -310,22 +339,24 @@ let rec ImportProvidedType (env: ImportMap) (m: range) (* (tinst: TypeInst) *) ( else genericArg) - ImportTyconRefApp env tcref genericArgs + let nullness = ImportNullnessForTyconRef env.g m tcref + + ImportTyconRefApp env tcref genericArgs nullness /// Import a provided method reference as an Abstract IL method reference let ImportProvidedMethodBaseAsILMethodRef (env: ImportMap) (m: range) (mbase: Tainted) = - let tref = ExtensionTyping.GetILTypeRefOfProvidedType (mbase.PApply((fun mbase -> mbase.DeclaringType), m), m) + let tref = ExtensionTyping.GetILTypeRefOfProvidedType (mbase.PApply((fun mbase -> nonNull mbase.DeclaringType), m), m) let mbase = // Find the formal member corresponding to the called member match mbase.OfType() with | Some minfo when - minfo.PUntaint((fun minfo -> minfo.IsGenericMethod|| minfo.DeclaringType.IsGenericType), m) -> - let declaringType = minfo.PApply((fun minfo -> minfo.DeclaringType), m) + minfo.PUntaint((fun minfo -> minfo.IsGenericMethod|| (nonNull minfo.DeclaringType).IsGenericType), m) -> + let declaringType = minfo.PApply((fun minfo -> nonNull minfo.DeclaringType), m) let declaringGenericTypeDefn = if declaringType.PUntaint((fun t -> t.IsGenericType), m) then - declaringType.PApply((fun declaringType -> declaringType.GetGenericTypeDefinition()), m) + declaringType.PApply((fun t -> t.GetGenericTypeDefinition()), m) else declaringType let methods = declaringGenericTypeDefn.PApplyArray((fun x -> x.GetMethods()), "GetMethods", m) @@ -339,8 +370,8 @@ let ImportProvidedMethodBaseAsILMethodRef (env: ImportMap) (m: range) (mbase: Ta error(NumberedError(FSComp.SR.etIncorrectProvidedMethod(ExtensionTyping.DisplayNameOfTypeProvider(minfo.TypeProvider, m), methodName, metadataToken, typeName), m)) | _ -> match mbase.OfType() with - | Some cinfo when cinfo.PUntaint((fun x -> x.DeclaringType.IsGenericType), m) -> - let declaringType = cinfo.PApply((fun x -> x.DeclaringType), m) + | Some cinfo when cinfo.PUntaint((fun x -> (nonNull x.DeclaringType).IsGenericType), m) -> + let declaringType = cinfo.PApply((fun x -> nonNull x.DeclaringType), m) let declaringGenericTypeDefn = declaringType.PApply((fun x -> x.GetGenericTypeDefinition()), m) // We have to find the uninstantiated formal signature corresponding to this instantiated constructor. // Annoyingly System.Reflection doesn't give us a MetadataToken to compare on, so we have to look by doing diff --git a/src/fsharp/import.fsi b/src/fsharp/import.fsi index 1070bd302ae..9b95f2b53d8 100644 --- a/src/fsharp/import.fsi +++ b/src/fsharp/import.fsi @@ -25,7 +25,11 @@ type AssemblyLoader = /// Get a flag indicating if an assembly is a provided assembly, plus the /// table of information recording remappings from type names in the provided assembly to type /// names in the statically linked, embedded assembly. +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE abstract GetProvidedAssemblyInfo : CompilationThreadToken * range * Tainted -> bool * ProvidedAssemblyStaticLinkingMap option +#else + abstract GetProvidedAssemblyInfo : CompilationThreadToken * range * Tainted -> bool * ProvidedAssemblyStaticLinkingMap option +#endif /// Record a root for a [] type to help guide static linking & type relocation abstract RecordGeneratedTypeRoot : ProviderGeneratedType -> unit diff --git a/src/fsharp/infos.fs b/src/fsharp/infos.fs index dd6f8b0e3f3..45e51c4dd27 100755 --- a/src/fsharp/infos.fs +++ b/src/fsharp/infos.fs @@ -49,25 +49,29 @@ let GetSuperTypeOfType g amap m ty = let ty = stripTyEqnsAndMeasureEqns g ty #endif - match metadataOfTy g ty with + let resBeforeNull = + match metadataOfTy g ty with #if !NO_EXTENSIONTYPING - | ProvidedTypeMetadata info -> + | ProvidedTypeMetadata info -> let st = info.ProvidedType - let superOpt = st.PApplyOption((fun st -> match st.BaseType with null -> None | t -> Some t), m) - match superOpt with + let superOpt = st.PApplyOption((fun st -> match st.BaseType with null -> None | t -> Some (nonNull t)), m) + match superOpt with | None -> None | Some super -> Some(Import.ImportProvidedType amap m super) #endif - | ILTypeMetadata (TILObjectReprData(scoref, _, tdef)) -> + | ILTypeMetadata (TILObjectReprData(scoref,_,tdef)) -> let tinst = argsOfAppTy g ty match tdef.Extends with | None -> None - | Some ilty -> Some (ImportILType scoref amap m tinst ilty) + | Some ilty -> + let superTy = ImportILType scoref amap m tinst ilty + Some superTy - | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> - if isFSharpObjModelTy g ty || isExnDeclTy g ty then + | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> + if isFSharpObjModelTy g ty || isExnDeclTy g ty then let tcref = tcrefOfAppTy g ty - Some (instType (mkInstForAppTy g ty) (superOfTycon g tcref.Deref)) + let superTy = instType (mkInstForAppTy g ty) (superOfTycon g tcref.Deref) + Some superTy elif isArrayTy g ty then Some g.system_Array_ty elif isRefTy g ty && not (isObjTy g ty) then @@ -85,15 +89,23 @@ let GetSuperTypeOfType g amap m ty = Some g.obj_ty else None + match resBeforeNull with + | Some superTy -> + let nullness = nullnessOfTy g ty + let superTyWithNull = addNullnessToTy nullness superTy + Some superTyWithNull + | None -> + None /// Make a type for System.Collections.Generic.IList -let mkSystemCollectionsGenericIListTy (g: TcGlobals) ty = TType_app(g.tcref_System_Collections_Generic_IList, [ty]) +let mkSystemCollectionsGenericIListTy (g: TcGlobals) ty = + TType_app(g.tcref_System_Collections_Generic_IList, [ty], g.knownWithoutNull) + [] /// Indicates whether we can skip interface types that lie outside the reference set type SkipUnrefInterfaces = Yes | No - /// Collect the set of immediate declared interface types for an F# type, but do not /// traverse the type hierarchy to collect further interfaces. let rec GetImmediateInterfacesOfType skipUnref g amap m ty = @@ -117,6 +129,7 @@ let rec GetImmediateInterfacesOfType skipUnref g amap m ty = #if !NO_EXTENSIONTYPING | ProvidedTypeMetadata info -> [ for ity in info.ProvidedType.PApplyArray((fun st -> st.GetInterfaces()), "GetInterfaces", m) do + // TODO NULLNESS: the nullness of ty should propagate to each of these yield Import.ImportProvidedType amap m ity ] #endif | ILTypeMetadata (TILObjectReprData(scoref, _, tdef)) -> @@ -124,12 +137,13 @@ let rec GetImmediateInterfacesOfType skipUnref g amap m ty = // ImportILType may fail for an interface if the assembly load set is incomplete and the interface // comes from another assembly. In this case we simply skip the interface: // if we don't skip it, then compilation will just fail here, and if type checking - // succeeds with fewer non-dereferencable interfaces reported then it would have - // succeeded with more reported. There are pathological corner cases where this - // doesn't apply: e.g. for mscorlib interfaces like IComparable, but we can always - // assume those are present. - tdef.Implements |> List.choose (fun ity -> - if skipUnref = SkipUnrefInterfaces.No || CanImportILType scoref amap m ity then + // succeeds with fewer non-dereferencable interfaces reported then it would have + // succeeded with more reported. There are pathological corner cases where this + // doesn't apply: e.g. for mscorlib interfaces like IComparable, but we can always + // assume those are present. + // TODO NULLNESS: the nullness of ty should propagate to each of these + tdef.Implements |> List.choose (fun ity -> + if skipUnref = SkipUnrefInterfaces.No || CanImportILType scoref amap m ity then Some (ImportILType scoref amap m tinst ity) else None) @@ -191,10 +205,11 @@ let private FoldHierarchyOfTypeAux followInterfaces allowMultiIntfInst skipUnref | TyparConstraint.IsEnum _ | TyparConstraint.IsDelegate _ | TyparConstraint.SupportsNull _ - | TyparConstraint.IsNonNullableStruct _ - | TyparConstraint.IsUnmanaged _ - | TyparConstraint.IsReferenceType _ - | TyparConstraint.SimpleChoice _ + | TyparConstraint.NotSupportsNull _ + | TyparConstraint.IsNonNullableStruct _ + | TyparConstraint.IsUnmanaged _ + | TyparConstraint.IsReferenceType _ + | TyparConstraint.SimpleChoice _ | TyparConstraint.RequiresDefaultConstructor _ -> vacc | TyparConstraint.CoercesTo(cty, _) -> loop (ndeep + 1) cty vacc) @@ -319,7 +334,9 @@ let CopyTyparConstraints m tprefInst (tporig: Typar) = TyparConstraint.IsEnum (instType tprefInst uty, m) | TyparConstraint.SupportsComparison _ -> TyparConstraint.SupportsComparison m - | TyparConstraint.SupportsEquality _ -> + | TyparConstraint.NotSupportsNull _ -> + TyparConstraint.NotSupportsNull m + | TyparConstraint.SupportsEquality _ -> TyparConstraint.SupportsEquality m | TyparConstraint.IsDelegate(aty, bty, _) -> TyparConstraint.IsDelegate (instType tprefInst aty, instType tprefInst bty, m) @@ -402,9 +419,9 @@ type ValRef with #if !NO_EXTENSIONTYPING /// Get the return type of a provided method, where 'void' is returned as 'None' let GetCompiledReturnTyOfProvidedMethodInfo amap m (mi: Tainted) = - let returnType = - if mi.PUntaint((fun mi -> mi.IsConstructor), m) then - mi.PApply((fun mi -> mi.DeclaringType), m) + let returnType = + if mi.PUntaint((fun mi -> mi.IsConstructor), m) then + mi.PApply((fun mi -> nonNull mi.DeclaringType), m) else mi.Coerce(m).PApply((fun mi -> mi.ReturnType), m) let ty = Import.ImportProvidedType amap m returnType if isVoidTy amap.g ty then None else Some ty @@ -638,10 +655,17 @@ let OptionalArgInfoOfProvidedParameter (amap: Import.ImportMap) m (provParam : T NotOptional /// Compute the ILFieldInit for the given provided constant value for a provided enum type. -let GetAndSanityCheckProviderMethod m (mi: Tainted<'T :> ProvidedMemberInfo>) (get : 'T -> ProvidedMethodInfo) err = - match mi.PApply((fun mi -> (get mi :> ProvidedMethodBase)), m) with - | Tainted.Null -> error(Error(err(mi.PUntaint((fun mi -> mi.Name), m), mi.PUntaint((fun mi -> mi.DeclaringType.Name), m)), m)) - | meth -> meth +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE +let GetAndSanityCheckProviderMethod m (mi: Tainted<'T :> ProvidedMemberInfo>) (get : 'T -> ProvidedMethodInfo) err = + match mi.PApply((fun mi -> (get mi :> ProvidedMethodBase)),m) with + | Tainted.Null -> error(Error(err(mi.PUntaint((fun mi -> mi.Name),m),mi.PUntaint((fun mi -> mi.DeclaringType.Name), m)), m)) + | Tainted.NonNull meth -> meth +#else +let GetAndSanityCheckProviderMethod m (mi: Tainted<'T :> ProvidedMemberInfo>) (get : 'T -> ProvidedMethodInfo?) err = + match mi.PApply((fun mi -> (get mi :> ProvidedMethodBase?)),m) with + | Tainted.Null -> error(Error(err(mi.PUntaint((fun mi -> mi.Name),m),mi.PUntaint((fun mi -> (nonNull mi.DeclaringType).Name), m)), m)) // TODO NULLNESS: type isntantiation should not be needed + | Tainted.NonNull meth -> meth +#endif /// Try to get an arbitrary ProvidedMethodInfo associated with a property. let ArbitraryMethodInfoOfPropertyInfo (pi: Tainted) m = @@ -649,8 +673,8 @@ let ArbitraryMethodInfoOfPropertyInfo (pi: Tainted) m = GetAndSanityCheckProviderMethod m pi (fun pi -> pi.GetGetMethod()) FSComp.SR.etPropertyCanReadButHasNoGetter elif pi.PUntaint((fun pi -> pi.CanWrite), m) then GetAndSanityCheckProviderMethod m pi (fun pi -> pi.GetSetMethod()) FSComp.SR.etPropertyCanWriteButHasNoSetter - else - error(Error(FSComp.SR.etPropertyNeedsCanWriteOrCanRead(pi.PUntaint((fun mi -> mi.Name), m), pi.PUntaint((fun mi -> mi.DeclaringType.Name), m)), m)) + else + error(Error(FSComp.SR.etPropertyNeedsCanWriteOrCanRead(pi.PUntaint((fun mi -> mi.Name), m), pi.PUntaint((fun mi -> (nonNull mi.DeclaringType).Name), m)), m)) #endif @@ -897,8 +921,8 @@ type MethInfo = | FSMeth(_, ty, _, _) -> ty | DefaultStructCtor(_, ty) -> ty #if !NO_EXTENSIONTYPING - | ProvidedMeth(amap, mi, _, m) -> - Import.ImportProvidedType amap m (mi.PApply((fun mi -> mi.DeclaringType), m)) + | ProvidedMeth(amap, mi, _, m) -> + Import.ImportProvidedType amap m (mi.PApply((fun mi -> nonNull mi.DeclaringType), m)) #endif /// Get the enclosing type of the method info, using a nominal type for tuple types @@ -1346,8 +1370,8 @@ type MethInfo = else [] | DefaultStructCtor _ -> [] #if !NO_EXTENSIONTYPING - | ProvidedMeth(amap, mi, _, m) -> - if x.IsInstance then [ Import.ImportProvidedType amap m (mi.PApply((fun mi -> mi.DeclaringType), m)) ] // find the type of the 'this' argument + | ProvidedMeth(amap, mi, _, m) -> + if x.IsInstance then [ Import.ImportProvidedType amap m (mi.PApply((fun mi -> nonNull mi.DeclaringType), m)) ] // find the type of the 'this' argument else [] #endif @@ -1509,8 +1533,8 @@ type MethInfo = let _, formalMethTyparTys = FixupNewTypars m formalEnclosingTypars formalEnclosingTyparTys x.FormalMethodTypars formalMethTypars let formalRetTy, formalParams = match x with - | ILMeth(_, ilminfo, _) -> - let ftinfo = ILTypeInfo.FromType g (TType_app(tcref, formalEnclosingTyparTys)) + | ILMeth(_, ilminfo, _) -> + let ftinfo = ILTypeInfo.FromType g (TType_app(tcref, formalEnclosingTyparTys, g.knownWithoutNull)) let formalRetTy = ImportReturnTypeFromMetadata amap m ilminfo.RawMetadata.Return.Type ilminfo.RawMetadata.Return.CustomAttrs ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys let formalParams = [ [ for p in ilminfo.RawMetadata.Parameters do @@ -1524,9 +1548,9 @@ type MethInfo = let formalRetTy = x.GetCompiledReturnTy(amap, m, formalMethTyparTys) // GENERIC TYPE PROVIDERS: formal types should be generated here, not the actual types // For non-generic type providers there is no difference - let formalParams = - [ [ for p in mi.PApplyArray((fun mi -> mi.GetParameters()), "GetParameters", m) do - let paramName = p.PUntaint((fun p -> match p.Name with null -> None | s -> Some s), m) + let formalParams = + [ [ for p in mi.PApplyArray((fun mi -> mi.GetParameters()), "GetParameters", m) do + let paramName = p.PUntaint((fun p -> match p.Name with "" -> None | s -> Some s), m) let paramType = Import.ImportProvidedType amap m (p.PApply((fun p -> p.ParameterType), m)) let isIn, isOut, isOptional = p.PUntaint((fun p -> p.IsIn, p.IsOut, p.IsOptional), m) yield TSlotParam(paramName, paramType, isIn, isOut, isOptional, []) ] ] @@ -1554,12 +1578,12 @@ type MethInfo = [ [for p in mi.PApplyArray((fun mi -> mi.GetParameters()), "GetParameters", m) do let pname = match p.PUntaint((fun p -> p.Name), m) with - | null -> None + | "" -> None | name -> Some (mkSynId m name) let pty = match p.PApply((fun p -> p.ParameterType), m) with | Tainted.Null -> amap.g.unit_ty - | parameterType -> Import.ImportProvidedType amap m parameterType + | Tainted.NonNull parameterType -> Import.ImportProvidedType amap m parameterType yield ParamNameAndType(pname, pty) ] ] #endif @@ -1616,7 +1640,7 @@ type ILFieldInfo = match x with | ILFieldInfo(tinfo, _) -> tinfo.ToType #if !NO_EXTENSIONTYPING - | ProvidedField(amap, fi, m) -> (Import.ImportProvidedType amap m (fi.PApply((fun fi -> fi.DeclaringType), m))) + | ProvidedField(amap, fi, m) -> (Import.ImportProvidedType amap m (fi.PApply((fun fi -> nonNull fi.DeclaringType), m))) #endif member x.ApparentEnclosingAppType = x.ApparentEnclosingType @@ -1637,7 +1661,7 @@ type ILFieldInfo = match x with | ILFieldInfo(tinfo, _) -> tinfo.ILTypeRef #if !NO_EXTENSIONTYPING - | ProvidedField(amap, fi, m) -> (Import.ImportProvidedTypeAsILType amap m (fi.PApply((fun fi -> fi.DeclaringType), m))).TypeRef + | ProvidedField(amap, fi, m) -> (Import.ImportProvidedTypeAsILType amap m (fi.PApply((fun fi -> nonNull fi.DeclaringType), m))).TypeRef #endif /// Get the scope used to interpret IL metadata @@ -1769,8 +1793,9 @@ type RecdFieldInfo = /// Get the (instantiated) type of the field in an F#-declared record, class or struct type member x.FieldType = actualTyOfRecdFieldRef x.RecdFieldRef x.TypeInst - /// Get the enclosing (declaring) type of the field in an F#-declared record, class or struct type - member x.DeclaringType = TType_app (x.RecdFieldRef.TyconRef, x.TypeInst) + /// Get the enclosing (declaring) type of the field in an F#-declared record, class or struct type + member x.DeclaringType = TType_app (x.RecdFieldRef.TyconRef, x.TypeInst, KnownWithoutNull) // TODO NULLNESS - qualify this + override x.ToString() = x.TyconRef.ToString() + "::" + x.Name @@ -1904,8 +1929,8 @@ type PropInfo = | ILProp ilpinfo -> ilpinfo.ILTypeInfo.ToType | FSProp(_, ty, _, _) -> ty #if !NO_EXTENSIONTYPING - | ProvidedProp(amap, pi, m) -> - Import.ImportProvidedType amap m (pi.PApply((fun pi -> pi.DeclaringType), m)) + | ProvidedProp(amap, pi, m) -> + Import.ImportProvidedType amap m (pi.PApply((fun pi -> nonNull pi.DeclaringType), m)) #endif /// Get the enclosing type of the method info, using a nominal type for tuple types @@ -2153,7 +2178,7 @@ type PropInfo = #if !NO_EXTENSIONTYPING | ProvidedProp (_, pi, m) -> [ for p in pi.PApplyArray((fun pi -> pi.GetIndexParameters()), "GetIndexParameters", m) do - let paramName = p.PUntaint((fun p -> match p.Name with null -> None | s -> Some (mkSynId m s)), m) + let paramName = p.PUntaint((fun p -> match p.Name with "" -> None | s -> Some (mkSynId m s)), m) let paramType = Import.ImportProvidedType amap m (p.PApply((fun p -> p.ParameterType), m)) yield ParamNameAndType(paramName, paramType) ] #endif @@ -2320,7 +2345,7 @@ type EventInfo = | ILEvent ileinfo -> ileinfo.ApparentEnclosingType | FSEvent (_, p, _, _) -> p.ApparentEnclosingType #if !NO_EXTENSIONTYPING - | ProvidedEvent (amap, ei, m) -> Import.ImportProvidedType amap m (ei.PApply((fun ei -> ei.DeclaringType), m)) + | ProvidedEvent (amap, ei, m) -> Import.ImportProvidedType amap m (ei.PApply((fun ei -> nonNull ei.DeclaringType), m)) #endif /// Get the enclosing type of the method info, using a nominal type for tuple types member x.ApparentEnclosingAppType = diff --git a/src/fsharp/lex.fsl b/src/fsharp/lex.fsl index 0af96d71c9a..c2be0f64dd9 100644 --- a/src/fsharp/lex.fsl +++ b/src/fsharp/lex.fsl @@ -75,9 +75,7 @@ let parseOctalUInt64 (s:string) p l = parse p 0UL let removeUnderscores (s:string) = - match s with - | null -> null - | s -> s.Replace("_", "") + s.Replace("_", "") let parseInt32 (s:string) = let s = removeUnderscores s diff --git a/src/fsharp/lexhelp.fs b/src/fsharp/lexhelp.fs index e966678486e..9a65485c0be 100644 --- a/src/fsharp/lexhelp.fs +++ b/src/fsharp/lexhelp.fs @@ -285,6 +285,8 @@ module Keywords = FSHARP, "__token_ODO" ,ODO FSHARP, "__token_OLET" ,OLET(true) FSHARP, "__token_constraint",CONSTRAINT + FSHARP, "__hacknull",HACKNULL + FSHARP, "__ambivalent",AMBIVALENT ] (*------- reserved keywords which are ml-compatibility ids *) @ List.map (fun s -> (FSHARP,s,RESERVED)) diff --git a/src/fsharp/lib.fs b/src/fsharp/lib.fs index f121639005f..2a7f2b4a167 100755 --- a/src/fsharp/lib.fs +++ b/src/fsharp/lib.fs @@ -21,7 +21,12 @@ let condition s = let GetEnvInteger e dflt = match System.Environment.GetEnvironmentVariable(e) with null -> dflt | t -> try int t with _ -> dflt -let dispose (x:System.IDisposable) = match x with null -> () | x -> x.Dispose() +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE +let dispose (x:System.IDisposable) = +#else +let dispose (x:System.IDisposable?) = +#endif + match x with null -> () | NonNull x -> x.Dispose() type SaveAndRestoreConsoleEncoding () = let savedOut = System.Console.Out @@ -114,10 +119,9 @@ module Check = /// Throw System.ArgumentNullException() if argument is null. let ArgumentNotNull arg argname = - match box(arg) with + match box arg with | null -> raise (new System.ArgumentNullException(argname)) | _ -> () - /// Throw System.ArgumentNullException() if array argument is null. /// Throw System.ArgumentOutOfRangeException() is array argument is empty. @@ -369,22 +373,23 @@ type Graph<'Data, 'Id when 'Id : comparison and 'Id : equality> // with care. //---------------------------------------------------------------------------- -// The following DEBUG code does not currently compile. -//#if DEBUG -//type 'T NonNullSlot = 'T option -//let nullableSlotEmpty() = None -//let nullableSlotFull(x) = Some x +//#if BUILDING_WITH_LKG +type NonNullSlot<'T when 'T : not struct> = 'T //#else -type NonNullSlot<'T> = 'T -let nullableSlotEmpty() = Unchecked.defaultof<'T> -let nullableSlotFull x = x +//type NonNullSlot<'T when (* 'T : not null and *) 'T : not struct> = 'T? //#endif +let nullableSlotEmpty() : NonNullSlot<'T> = Unchecked.defaultof<_> +let nullableSlotFull (x: 'T) : NonNullSlot<'T> = x //--------------------------------------------------------------------------- // Caches, mainly for free variables //--------------------------------------------------------------------------- -type cache<'T> = { mutable cacheVal: 'T NonNullSlot } +//#if BUILDING_WITH_LKG +type cache<'T when 'T : not struct> = { mutable cacheVal: NonNullSlot<'T> } +//#else +//type cache<'T when 'T : (* not null and *) 'T : not struct> = { mutable cacheVal: NonNullSlot<'T> } +//#endif let newCache() = { cacheVal = nullableSlotEmpty() } let inline cached cache resf = @@ -458,10 +463,15 @@ module internal AsyncUtil = // Continuations that Async.FromContinuations provide do QUWI/SynchContext.Post, // so the order is not overly relevant but still. List.rev savedConts) - let postOrQueue (sc:SynchronizationContext, cont) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let postOrQueue (sc: SynchronizationContext, cont) = +#else + let postOrQueue (sc: SynchronizationContext?, cont) = +#endif match sc with - | null -> ThreadPool.QueueUserWorkItem(fun _ -> cont res) |> ignore - | sc -> sc.Post((fun _ -> cont res), state=null) + | null -> ThreadPool.QueueUserWorkItem(fun _ -> cont res) |> ignore + | NonNull sc -> + sc.Post((fun _ -> cont res), state=null) // Run continuations outside the lock match grabbedConts with diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 453e5c56342..b8896d2dce6 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -203,6 +203,7 @@ let rangeOfLongIdent(lid:LongIdent) = %token GREATER_RBRACK STRUCT SIG %token STATIC MEMBER CLASS ABSTRACT OVERRIDE DEFAULT CONSTRUCTOR INHERIT %token EXTERN VOID PUBLIC PRIVATE INTERNAL GLOBAL +%token HACKNULL AMBIVALENT /* for parser 'escape hatch' out of expression context without consuming the 'recover' token */ %token TYPE_COMING_SOON TYPE_IS_HERE MODULE_COMING_SOON MODULE_IS_HERE @@ -2205,6 +2206,10 @@ typeConstraint: | typar COLON NULL { WhereTyparSupportsNull($1,lhs parseState) } + | typar COLON IDENT NULL + { if $3 <> "not" then reportParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedIdentifier($3)) + WhereTyparNotSupportsNull($1,lhs parseState) } + | typar COLON LPAREN classMemberSpfn rparen { let tp = $1 WhereTyparSupportsMember([ SynType.Var(tp, tp.Range) ],$4,lhs parseState) } @@ -2538,6 +2543,9 @@ cType: { let m = lhs parseState SynType.App(SynType.LongIdent(LongIdentWithDots([ident("nativeptr",m)],[])),None,[$1],[],None,true,m) } + | cType QMARK + { SynType.WithNull($1, false, lhs parseState) } + | cType AMP { let m = lhs parseState SynType.App(SynType.LongIdent(LongIdentWithDots([ident("byref",m)],[])),None,[$1],[],None,true,m) } @@ -4426,6 +4434,19 @@ appTypeConPower: { $1 } appType: + | appType HACKNULL + { SynType.WithNull($1, false, lhs parseState) } + + | appType AMBIVALENT + { SynType.WithNull($1, true, lhs parseState) } + + | appType QMARK + { SynType.WithNull($1, false, lhs parseState) } + +/* +| appType OR NULL + { SynType.WithNull($1, false lhs parseState) } +*/ | appType arrayTypeSuffix { SynType.Array($2,$1,lhs parseState) } @@ -4558,7 +4579,7 @@ atomType: | NULL { let m = rhs parseState 1 - SynType.StaticConstant(SynConst.String (null, m), m) } + SynType.StaticConstantNull(m) } | CONST atomicExpr { let e,_ = $2 diff --git a/src/fsharp/service/IncrementalBuild.fs b/src/fsharp/service/IncrementalBuild.fs index 69d416f9921..d2148bc8289 100755 --- a/src/fsharp/service/IncrementalBuild.fs +++ b/src/fsharp/service/IncrementalBuild.fs @@ -1182,9 +1182,22 @@ type RawFSharpAssemblyDataBackedByLanguageService (tcConfig, tcGlobals, tcState: let sigData = let _sigDataAttributes, sigDataResources = Driver.EncodeInterfaceData(tcConfig, tcGlobals, exportRemapping, generatedCcu, outfile, true) - [ for r in sigDataResources do - let ccuName = GetSignatureDataResourceName r - yield (ccuName, (fun () -> r.GetBytes())) ] + let sigDataReaders = + [ for iresource in sigDataResources do + if IsSignatureDataResource iresource then + let ccuName = GetSignatureDataResourceName iresource + let readerA = fun () -> iresource.GetBytes() + let readerB = + sigDataResources |> List.tryPick (fun iresourceB -> + if IsSignatureDataResourceB iresourceB then + let ccuNameB = GetSignatureDataResourceName iresourceB + if ccuName = ccuNameB then + Some (fun () -> iresourceB.GetBytes() ) + else None + else None) + yield (ccuName, (readerA, readerB)) ] + + sigDataReaders let autoOpenAttrs = topAttrs.assemblyAttrs |> List.choose (List.singleton >> TryFindFSharpStringAttribute tcGlobals tcGlobals.attrib_AutoOpenAttribute) diff --git a/src/fsharp/service/QuickParse.fs b/src/fsharp/service/QuickParse.fs index b431f2557b4..f8c3e4be8ac 100644 --- a/src/fsharp/service/QuickParse.fs +++ b/src/fsharp/service/QuickParse.fs @@ -68,8 +68,15 @@ module QuickParse = | true, _, true when name.Length > 2 -> isValidStrippedName (name.Substring(1, name.Length - 2)) 0 | _ -> false +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let GetCompleteIdentifierIslandImpl (lineStr: string) (index: int) : (string * int * bool) option = - if index < 0 || isNull lineStr || index >= lineStr.Length then None +#else + let GetCompleteIdentifierIslandImpl (lineStr: string?) (index: int) : (string * int * bool) option = +#endif + match lineStr with + | null -> None + | NonNull lineStr -> + if index < 0 || index >= lineStr.Length then None else let fixup = match () with @@ -176,9 +183,15 @@ module QuickParse = let private defaultName = [], "" /// Get the partial long name of the identifier to the left of index. +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let GetPartialLongName(lineStr: string, index: int) = - if isNull lineStr then defaultName - elif index < 0 then defaultName +#else + let GetPartialLongName(lineStr: string?, index: int) = +#endif + match lineStr with + | null -> defaultName + | NonNull lineStr -> + if index < 0 then defaultName elif index >= lineStr.Length then defaultName else let IsIdentifierPartCharacter pos = IsIdentifierPartCharacter lineStr.[pos] @@ -215,9 +228,15 @@ module QuickParse = /// Get the partial long name of the identifier to the left of index. /// For example, for `System.DateTime.Now` it returns PartialLongName ([|"System"; "DateTime"|], "Now", Some 32), where "32" pos of the last dot. +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let GetPartialLongNameEx(lineStr: string, index: int) : PartialLongName = - if isNull lineStr then PartialLongName.Empty(index) - elif index < 0 then PartialLongName.Empty(index) +#else + let GetPartialLongNameEx(lineStr: string?, index: int) : PartialLongName = +#endif + match lineStr with + | null -> PartialLongName.Empty(index) + | NonNull lineStr -> + if index < 0 then PartialLongName.Empty(index) elif index >= lineStr.Length then PartialLongName.Empty(index) else let IsIdentifierPartCharacter pos = IsIdentifierPartCharacter lineStr.[pos] diff --git a/src/fsharp/service/QuickParse.fsi b/src/fsharp/service/QuickParse.fsi index 5f78dbefd2b..db87cc1121c 100644 --- a/src/fsharp/service/QuickParse.fsi +++ b/src/fsharp/service/QuickParse.fsi @@ -69,14 +69,26 @@ module public QuickParse = /// a call to `DeclItemsForNamesAtPosition` for intellisense. This will /// allow us to use find the correct qualified items rather than resorting /// to the more expensive and less accurate environment lookup. - val GetCompleteIdentifierIsland : tolerateJustAfter: bool -> tokenText: string -> index: int -> (string * int * bool) option +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + val GetCompleteIdentifierIsland : tolerateJustAfter: bool -> lineStr: string -> index: int -> (string * int * bool) option +#else + val GetCompleteIdentifierIsland : tolerateJustAfter: bool -> lineStr: string? -> index: int -> (string * int * bool) option +#endif /// Get the partial long name of the identifier to the left of index. +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE val GetPartialLongName : lineStr: string * index: int -> (string list * string) +#else + val GetPartialLongName : lineStr: string? * index: int -> (string list * string) +#endif /// Get the partial long name of the identifier to the left of index. /// For example, for `System.DateTime.Now` it returns PartialLongName ([|"System"; "DateTime"|], "Now", Some 32), where "32" pos of the last dot. +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE val GetPartialLongNameEx : lineStr: string * index: int -> PartialLongName +#else + val GetPartialLongNameEx : lineStr: string? * index: int -> PartialLongName +#endif /// Tests whether the user is typing something like "member x." or "override (*comment*) x." val TestMemberOrOverrideDeclaration : tokens: FSharpTokenInfo[] -> bool \ No newline at end of file diff --git a/src/fsharp/service/ServiceAssemblyContent.fs b/src/fsharp/service/ServiceAssemblyContent.fs index 67a7cc7e8d0..082bc1d050c 100644 --- a/src/fsharp/service/ServiceAssemblyContent.fs +++ b/src/fsharp/service/ServiceAssemblyContent.fs @@ -541,11 +541,13 @@ module ParsedInput = List.iter walkAttribute attrs walkTypar typar - and walkTypeConstraint = function + and walkTypeConstraint cx = + match cx with | SynTypeConstraint.WhereTyparIsValueType (t, _) | SynTypeConstraint.WhereTyparIsReferenceType (t, _) | SynTypeConstraint.WhereTyparIsUnmanaged (t, _) | SynTypeConstraint.WhereTyparSupportsNull (t, _) + | SynTypeConstraint.WhereTyparNotSupportsNull (t, _) | SynTypeConstraint.WhereTyparIsComparable (t, _) | SynTypeConstraint.WhereTyparIsEquatable (t, _) -> walkTypar t | SynTypeConstraint.WhereTyparDefaultsToType (t, ty, _) @@ -554,8 +556,9 @@ module ParsedInput = | SynTypeConstraint.WhereTyparIsDelegate (t, ts, _) -> walkTypar t; List.iter walkType ts | SynTypeConstraint.WhereTyparSupportsMember (ts, sign, _) -> List.iter walkType ts; walkMemberSig sign - and walkPat = function - | SynPat.Tuple (_,pats, _) + and walkPat pat = + match pat with + | SynPat.Tuple (_, pats, _) | SynPat.ArrayOrList (_, pats, _) | SynPat.Ands (pats, _) -> List.iter walkPat pats | SynPat.Named (pat, ident, _, _, _) -> @@ -590,11 +593,13 @@ module ParsedInput = and walkInterfaceImpl (InterfaceImpl(_, bindings, _)) = List.iter walkBinding bindings - and walkIndexerArg = function + and walkIndexerArg arg = + match arg with | SynIndexerArg.One e -> walkExpr e | SynIndexerArg.Two (e1, e2) -> List.iter walkExpr [e1; e2] - and walkType = function + and walkType ty = + match ty with | SynType.Array (_, t, _) | SynType.HashConstraint (t, _) | SynType.MeasurePower (t, _, _) -> walkType t @@ -613,13 +618,15 @@ module ParsedInput = walkExpr e2 e1 |> Option.iter walkExpr - and walkSimplePats = function + and walkSimplePats spats = + match spats with | SynSimplePats.SimplePats (pats, _) -> List.iter walkSimplePat pats | SynSimplePats.Typed (pats, ty, _) -> walkSimplePats pats walkType ty - and walkExpr = function + and walkExpr expr = + match expr with | SynExpr.Paren (e, _, _, _) | SynExpr.Quote (_, _, e, _, _) | SynExpr.Typed (e, _, _) @@ -715,7 +722,8 @@ module ParsedInput = | SynExpr.Const (SynConst.Measure(_, m), _) -> walkMeasure m | _ -> () - and walkMeasure = function + and walkMeasure synMeasure = + match synMeasure with | SynMeasure.Product (m1, m2, _) | SynMeasure.Divide (m1, m2, _) -> walkMeasure m1; walkMeasure m2 | SynMeasure.Named (longIdent, _) -> addLongIdent longIdent @@ -725,7 +733,8 @@ module ParsedInput = | SynMeasure.One | SynMeasure.Anon _ -> () - and walkSimplePat = function + and walkSimplePat spat = + match spat with | SynSimplePat.Attrib (pat, attrs, _) -> walkSimplePat pat List.iter walkAttribute attrs diff --git a/src/fsharp/service/ServiceDeclarationLists.fs b/src/fsharp/service/ServiceDeclarationLists.fs index b706a3835a9..f3ebac1296d 100644 --- a/src/fsharp/service/ServiceDeclarationLists.fs +++ b/src/fsharp/service/ServiceDeclarationLists.fs @@ -180,7 +180,7 @@ module internal DescriptionListsImpl = |> Array.map (fun sp -> let ty = Import.ImportProvidedType amap m (sp.PApply((fun x -> x.ParameterType), m)) let spKind = NicePrint.prettyLayoutOfType denv ty - let spName = sp.PUntaint((fun sp -> sp.Name), m) + let spName = sp.PUntaint((fun sp -> nonNull sp.Name), m) let spOpt = sp.PUntaint((fun sp -> sp.IsOptional), m) FSharpMethodGroupItemParameter( name = spName, @@ -255,7 +255,7 @@ module internal DescriptionListsImpl = match ucinfo.UnionCase.RecdFields with | [f] -> [PrettyParamOfUnionCaseField g denv NicePrint.isGeneratedUnionCaseField -1 f] | fs -> fs |> List.mapi (PrettyParamOfUnionCaseField g denv NicePrint.isGeneratedUnionCaseField) - let rty = generalizedTyconRef ucinfo.TyconRef + let rty = generalizedTyOfTyconRef g ucinfo.TyconRef let rtyL = NicePrint.layoutType denv rty prettyParams, rtyL @@ -576,10 +576,10 @@ type FSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[], isForT items |> List.map (fun x -> match x.Item with - | Item.Types (_, (TType_app(tcref, _) :: _)) -> { x with MinorPriority = 1 + tcref.TyparsNoRange.Length } + | Item.Types (_, (TType_app(tcref, _, _) :: _)) -> { x with MinorPriority = 1 + tcref.TyparsNoRange.Length } // Put delegate ctors after types, sorted by #typars. RemoveDuplicateItems will remove FakeInterfaceCtor and DelegateCtor if an earlier type is also reported with this name - | Item.FakeInterfaceCtor (TType_app(tcref, _)) - | Item.DelegateCtor (TType_app(tcref, _)) -> { x with MinorPriority = 1000 + tcref.TyparsNoRange.Length } + | Item.FakeInterfaceCtor (TType_app(tcref,_,_)) + | Item.DelegateCtor (TType_app(tcref,_,_)) -> { x with MinorPriority = 1000 + tcref.TyparsNoRange.Length } // Put type ctors after types, sorted by #typars. RemoveDuplicateItems will remove DefaultStructCtors if a type is also reported with this name | Item.CtorGroup (_, (cinfo :: _)) -> { x with MinorPriority = 1000 + 10 * cinfo.DeclaringTyconRef.TyparsNoRange.Length } | Item.MethodGroup(_, minfo :: _, _) -> { x with IsOwnMember = tyconRefOptEq x.Type minfo.DeclaringTyconRef } diff --git a/src/fsharp/service/ServiceLexing.fs b/src/fsharp/service/ServiceLexing.fs index a03c1deeffb..6def02b50da 100644 --- a/src/fsharp/service/ServiceLexing.fs +++ b/src/fsharp/service/ServiceLexing.fs @@ -269,15 +269,15 @@ module internal TokenClassifications = | IF | THEN | ELSE | DO | DONE | LET(_) | IN (*| NAMESPACE*) | CONST | HIGH_PRECEDENCE_PAREN_APP | FIXED | HIGH_PRECEDENCE_BRACK_APP - | TYPE_COMING_SOON | TYPE_IS_HERE | MODULE_COMING_SOON | MODULE_IS_HERE -> - (FSharpTokenColorKind.Keyword, FSharpTokenCharKind.Keyword, FSharpTokenTriggerClass.None) - - | BEGIN -> - (FSharpTokenColorKind.Keyword, FSharpTokenCharKind.Keyword, FSharpTokenTriggerClass.None) - - | END -> - (FSharpTokenColorKind.Keyword, FSharpTokenCharKind.Keyword, FSharpTokenTriggerClass.None) - + | HACKNULL | AMBIVALENT + | TYPE_COMING_SOON | TYPE_IS_HERE | MODULE_COMING_SOON | MODULE_IS_HERE + -> (FSharpTokenColorKind.Keyword, FSharpTokenCharKind.Keyword, FSharpTokenTriggerClass.None) + + | BEGIN + -> (FSharpTokenColorKind.Keyword, FSharpTokenCharKind.Keyword, FSharpTokenTriggerClass.None) + + | END + -> (FSharpTokenColorKind.Keyword, FSharpTokenCharKind.Keyword, FSharpTokenTriggerClass.None) | HASH_LIGHT _ | HASH_LINE _ | HASH_IF _ diff --git a/src/fsharp/service/ServiceParamInfoLocations.fs b/src/fsharp/service/ServiceParamInfoLocations.fs index 8ab5122f900..745c42d063e 100755 --- a/src/fsharp/service/ServiceParamInfoLocations.fs +++ b/src/fsharp/service/ServiceParamInfoLocations.fs @@ -33,7 +33,10 @@ module internal NoteworthyParamInfoLocationsImpl = let isStaticArg a = match a with - | SynType.StaticConstant _ | SynType.StaticConstantExpr _ | SynType.StaticConstantNamed _ -> true + | SynType.StaticConstant _ + | SynType.StaticConstantNull _ + | SynType.StaticConstantExpr _ + | SynType.StaticConstantNamed _ -> true | SynType.LongIdent _ -> true // NOTE: this is not a static constant, but it is a prefix of incomplete code, e.g. "TP<42, Arg3" is a prefix of "TP<42, Arg3=6>" and Arg3 shows up as a LongId | _ -> false diff --git a/src/fsharp/service/ServiceUntypedParse.fs b/src/fsharp/service/ServiceUntypedParse.fs index 84197fc608c..fa82282ae62 100755 --- a/src/fsharp/service/ServiceUntypedParse.fs +++ b/src/fsharp/service/ServiceUntypedParse.fs @@ -743,6 +743,7 @@ module UntypedParseImpl = | SynTypeConstraint.WhereTyparIsReferenceType(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparIsUnmanaged(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparSupportsNull (t, _) -> walkTypar t + | SynTypeConstraint.WhereTyparNotSupportsNull (t, _) -> walkTypar t | SynTypeConstraint.WhereTyparIsComparable(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparIsEquatable(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparSubtypeOfType(t, ty, _) -> walkTypar t |> Option.orElse (walkType ty) diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index ea4de105c7f..3ae1da8f93f 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -310,7 +310,7 @@ type TypeCheckInfo let ad = match vref.BaseOrThisInfo, ad with | ValBaseOrThisInfo.NormalVal, AccessibleFrom(paths, Some tcref) -> - let tcref = generalizedTyconRef tcref + let tcref = generalizedTyOfTyconRef g tcref // check that type of value is the same or subtype of tcref // yes - allow access to protected members // no - strip ability to access protected members @@ -962,10 +962,10 @@ type TypeCheckInfo items |> List.sortBy (fun d -> let n = match d.Item with - | Item.Types (_,(TType_app(tcref,_) :: _)) -> 1 + tcref.TyparsNoRange.Length + | Item.Types (_,(TType_app(tcref,_,_) :: _)) -> 1 + tcref.TyparsNoRange.Length // Put delegate ctors after types, sorted by #typars. RemoveDuplicateItems will remove FakeInterfaceCtor and DelegateCtor if an earlier type is also reported with this name - | Item.FakeInterfaceCtor (TType_app(tcref,_)) - | Item.DelegateCtor (TType_app(tcref,_)) -> 1000 + tcref.TyparsNoRange.Length + | Item.FakeInterfaceCtor (TType_app(tcref,_,_)) + | Item.DelegateCtor (TType_app(tcref,_,_)) -> 1000 + tcref.TyparsNoRange.Length // Put type ctors after types, sorted by #typars. RemoveDuplicateItems will remove DefaultStructCtors if a type is also reported with this name | Item.CtorGroup (_, (cinfo :: _)) -> 1000 + 10 * cinfo.DeclaringTyconRef.TyparsNoRange.Length | _ -> 0 @@ -979,11 +979,11 @@ type TypeCheckInfo let items = items |> List.groupBy (fun d -> match d.Item with - | Item.Types (_,(TType_app(tcref,_) :: _)) + | Item.Types (_,(TType_app(tcref,_,_) :: _)) | Item.ExnCase tcref -> tcref.LogicalName | Item.UnqualifiedType(tcref :: _) - | Item.FakeInterfaceCtor (TType_app(tcref,_)) - | Item.DelegateCtor (TType_app(tcref,_)) -> tcref.CompiledName + | Item.FakeInterfaceCtor (TType_app(tcref,_,_)) + | Item.DelegateCtor (TType_app(tcref,_,_)) -> tcref.CompiledName | Item.CtorGroup (_, (cinfo :: _)) -> cinfo.ApparentEnclosingTyconRef.CompiledName | _ -> d.Item.DisplayName) @@ -1207,7 +1207,7 @@ type TypeCheckInfo //Item.Value(vref) None - | Item.Types (_, TType_app (tr, _) :: _) when tr.IsLocalRef && tr.IsTypeAbbrev -> None + | Item.Types (_, TType_app (tr, _, _) :: _) when tr.IsLocalRef && tr.IsTypeAbbrev -> None | Item.Types (_, [ AppTy g (tr, _) ]) when not tr.IsLocalRef -> match tr.TypeReprInfo, tr.PublicPath with @@ -1281,7 +1281,7 @@ type TypeCheckInfo let (|OptionalArgumentAttribute|_|) ttype = match ttype with - | TType.TType_app(tref, _) when tref.Stamp = g.attrib_OptionalArgumentAttribute.TyconRef.Stamp -> Some() + | TType.TType_app(tref, _, _) when tref.Stamp = g.attrib_OptionalArgumentAttribute.TyconRef.Stamp -> Some() | _ -> None let (|KeywordIntrinsicValue|_|) (vref: ValRef) = @@ -1315,7 +1315,7 @@ type TypeCheckInfo protectAssemblyExplorationNoReraise false false (fun () -> Infos.ExistsHeadTypeInEntireHierarchy g amap range0 ty g.tcref_System_IDisposable) let isStructTyconRef (tyconRef: TyconRef) = - let ty = generalizedTyconRef tyconRef + let ty = generalizedTyOfTyconRef g tyconRef let underlyingTy = stripTyEqnsAndMeasureEqns g ty isStructTy g underlyingTy @@ -1367,7 +1367,7 @@ type TypeCheckInfo Some (m, SemanticClassificationType.Interface) | CNR(_, Item.Types(_, types), LegitTypeOccurence, _, _, _, m) when types |> List.exists (isStructTy g) -> Some (m, SemanticClassificationType.ValueType) - | CNR(_, Item.Types(_, TType_app(tyconRef, TType_measure _ :: _) :: _), LegitTypeOccurence, _, _, _, m) when isStructTyconRef tyconRef -> + | CNR(_, Item.Types(_, TType_app(tyconRef, (TType_measure _ :: _), _) :: _), LegitTypeOccurence, _, _, _, m) when isStructTyconRef tyconRef -> Some (m, SemanticClassificationType.ValueType) | CNR(_, Item.Types(_, types), LegitTypeOccurence, _, _, _, m) when types |> List.exists isDisposableTy -> Some (m, SemanticClassificationType.Disposable) @@ -1656,9 +1656,11 @@ module internal Parser = // If there was a loadClosure, replay the errors and warnings from resolution, excluding parsing loadClosure.LoadClosureRootFileDiagnostics |> List.iter diagnosticSink - let fileOfBackgroundError err = (match GetRangeOfDiagnostic (fst err) with Some m-> m.FileName | None -> null) + let fileOfBackgroundError err = match GetRangeOfDiagnostic (fst err) with Some m-> Some m.FileName | None -> None let sameFile file hashLoadInFile = - (0 = String.Compare(hashLoadInFile, file, StringComparison.OrdinalIgnoreCase)) + match file with + | None -> false + | Some file -> (0 = String.Compare(hashLoadInFile, file, StringComparison.OrdinalIgnoreCase)) // walk the list of #loads and keep the ones for this file. let hashLoadsInFile = @@ -3232,7 +3234,7 @@ type FSharpChecker(legacyReferenceResolver, projectCacheSize, keepAssemblyConten member ic.GetParsingOptionsFromCommandLineArgs(initialSourceFiles, argv, ?isInteractive) = let isInteractive = defaultArg isInteractive false use errorScope = new ErrorScope() - let tcConfigBuilder = TcConfigBuilder.Initial + let tcConfigBuilder = TcConfigBuilder.Initial(legacyReferenceResolver) // Apply command-line arguments and collect more source files if they are in the arguments let sourceFilesNew = ApplyCommandLineArgs(tcConfigBuilder, initialSourceFiles, argv) diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs index e09e1d4df30..ec8b09fe12b 100644 --- a/src/fsharp/symbols/Exprs.fs +++ b/src/fsharp/symbols/Exprs.fs @@ -282,7 +282,7 @@ module FSharpExprConvert = let (|TTypeConvOp|_|) (cenv: SymbolEnv) ty = let g = cenv.g match ty with - | TType_app (tcref,_) -> + | TType_app (tcref,_, _) -> match tcref with | _ when tyconRefEq g tcref g.sbyte_tcr -> Some mkCallToSByteOperator | _ when tyconRefEq g tcref g.byte_tcr -> Some mkCallToByteOperator @@ -473,12 +473,13 @@ module FSharpExprConvert = ConvObjectModelCallLinear cenv env (false, v, [], tyargs, List.concat untupledCurriedArgs) contf2 and ConvExprPrim (cenv: SymbolEnv) (env: ExprTranslationEnv) expr = + let g = cenv.g // Eliminate integer 'for' loops - let expr = DetectAndOptimizeForExpression cenv.g OptimizeIntRangesOnly expr + let expr = DetectAndOptimizeForExpression g OptimizeIntRangesOnly expr // Eliminate subsumption coercions for functions. This must be done post-typechecking because we need // complete inference types. - let expr = NormalizeAndAdjustPossibleSubsumptionExprs cenv.g expr + let expr = NormalizeAndAdjustPossibleSubsumptionExprs g expr // Remove TExpr_ref nodes let expr = stripExpr expr @@ -497,7 +498,7 @@ module FSharpExprConvert = | Expr.Sequential _ -> ConvExprPrimLinear cenv env expr (fun e -> e) - | ModuleValueOrMemberUse cenv.g (vref, vFlags, _f, _fty, tyargs, curriedArgs) when (* (nonNil tyargs || nonNil curriedArgs) && *) vref.IsMemberOrModuleBinding -> + | ModuleValueOrMemberUse g (vref, vFlags, _f, _fty, tyargs, curriedArgs) when (* (nonNil tyargs || nonNil curriedArgs) && *) vref.IsMemberOrModuleBinding -> // Process applications of top-level values in a tail-recursive way ConvModuleValueOrMemberUseLinear cenv env (expr, vref, vFlags, tyargs, curriedArgs) (fun e -> e) @@ -520,7 +521,7 @@ module FSharpExprConvert = E.LetRec(bindsR, bodyR) | Expr.Lambda (_, _, _, vs, b, _, _) -> - let v, b = MultiLambdaToTupledLambda cenv.g vs b + let v, b = MultiLambdaToTupledLambda g vs b let vR = ConvVal cenv v let bR = ConvExpr cenv (env.BindVal v) b E.Lambda(vR, bR) @@ -533,8 +534,8 @@ module FSharpExprConvert = let env = env.BindTypars (Seq.zip tps gps |> Seq.toList) E.TypeLambda(gps, ConvExpr cenv env b) - | Expr.Obj (_, ty, _, _, [TObjExprMethod(TSlotSig(_, ctyp, _, _, _, _), _, tps, [tmvs], e, _) as tmethod], _, m) when isDelegateTy cenv.g ty -> - let f = mkLambdas m tps tmvs (e, GetFSharpViewOfReturnType cenv.g (returnTyOfMethod cenv.g tmethod)) + | Expr.Obj (_, ty, _, _, [TObjExprMethod(TSlotSig(_, ctyp, _, _, _, _), _, tps, [tmvs], e, _) as tmethod], _, m) when isDelegateTy g ty -> + let f = mkLambdas g m tps tmvs (e, GetFSharpViewOfReturnType g (returnTyOfMethod g tmethod)) let fR = ConvExpr cenv env f let tyargR = ConvType cenv ctyp E.NewDelegate(tyargR, fR) @@ -543,7 +544,7 @@ module FSharpExprConvert = ConvExprPrim cenv env x | Expr.TyChoose _ -> - ConvExprPrim cenv env (ChooseTyparSolutionsForFreeChoiceTypars cenv.g cenv.amap expr) + ConvExprPrim cenv env (ChooseTyparSolutionsForFreeChoiceTypars g cenv.amap expr) | Expr.Obj (_lambdaId, ty, _basev, basecall, overrides, iimpls, _m) -> let basecallR = ConvExpr cenv env basecall @@ -575,7 +576,7 @@ module FSharpExprConvert = E.NewAnonRecord(typR, argsR) | TOp.Tuple tupInfo, tyargs, _ -> - let tyR = ConvType cenv (mkAnyTupledTy cenv.g tupInfo tyargs) + let tyR = ConvType cenv (mkAnyTupledTy g tupInfo tyargs) let argsR = ConvExprs cenv env args E.NewTuple(tyR, argsR) @@ -618,8 +619,8 @@ module FSharpExprConvert = E.FSharpFieldGet(Some objR, typR, projR) | TOp.TupleFieldGet (tupInfo, n), tyargs, [e] -> - let tyR = ConvType cenv (mkAnyTupledTy cenv.g tupInfo tyargs) - E.TupleGet(tyR, n, ConvExpr cenv env e) + let tyR = ConvType cenv (mkAnyTupledTy g tupInfo tyargs) + E.TupleGet (tyR, n, ConvExpr cenv env e) | TOp.ILAsm ([ I_ldfld (_, _, fspec) ], _), enclTypeArgs, [obj] -> let typR = ConvILTypeRefApp cenv m fspec.DeclaringTypeRef enclTypeArgs @@ -644,93 +645,93 @@ module FSharpExprConvert = | TOp.ILAsm ([ ], [tty]), _, [arg] -> match tty with | TTypeConvOp cenv convOp -> - let ty = tyOfExpr cenv.g arg - let op = convOp cenv.g m ty arg + let ty = tyOfExpr g arg + let op = convOp g m ty arg ConvExprPrim cenv env op | _ -> ConvExprPrim cenv env arg | TOp.ILAsm ([ I_box _ ], _), [ty], [arg] -> - let op = mkCallBox cenv.g m ty arg + let op = mkCallBox g m ty arg ConvExprPrim cenv env op | TOp.ILAsm ([ I_unbox_any _ ], _), [ty], [arg] -> - let op = mkCallUnbox cenv.g m ty arg + let op = mkCallUnbox g m ty arg ConvExprPrim cenv env op | TOp.ILAsm ([ I_isinst _ ], _), [ty], [arg] -> - let op = mkCallTypeTest cenv.g m ty arg + let op = mkCallTypeTest g m ty arg ConvExprPrim cenv env op | TOp.ILAsm ([ I_call (Normalcall, mspec, None) ], _), _, [arg] when mspec.MethodRef.DeclaringTypeRef.Name = "System.String" && mspec.Name = "GetHashCode" -> - let ty = tyOfExpr cenv.g arg - let op = mkCallHash cenv.g m ty arg + let ty = tyOfExpr g arg + let op = mkCallHash g m ty arg ConvExprPrim cenv env op | TOp.ILCall (_, _, _, _, _, _, _, mref, _, _, _), [], [Expr.Op (TOp.ILAsm ([ I_ldtoken (ILToken.ILType _) ], _), [ty], _, _)] when mref.DeclaringTypeRef.Name = "System.Type" && mref.Name = "GetTypeFromHandle" -> - let op = mkCallTypeOf cenv.g m ty + let op = mkCallTypeOf g m ty ConvExprPrim cenv env op | TOp.ILAsm ([ EI_ilzero _ ], _), [ty], _ -> E.DefaultValue (ConvType cenv ty) | TOp.ILAsm ([ AI_ldnull; AI_cgt_un ], _), _, [arg] -> - let elemTy = tyOfExpr cenv.g arg + let elemTy = tyOfExpr g arg let nullVal = mkNull m elemTy - let op = mkCallNotEqualsOperator cenv.g m elemTy arg nullVal + let op = mkCallNotEqualsOperator g m elemTy arg nullVal ConvExprPrim cenv env op | TOp.ILAsm ([ I_ldlen; AI_conv DT_I4 ], _), _, [arr] -> - let arrayTy = tyOfExpr cenv.g arr - let elemTy = destArrayTy cenv.g arrayTy - let op = mkCallArrayLength cenv.g m elemTy arr + let arrayTy = tyOfExpr g arr + let elemTy = destArrayTy g arrayTy + let op = mkCallArrayLength g m elemTy arr ConvExprPrim cenv env op | TOp.ILAsm ([ I_newarr (ILArrayShape [(Some 0, None)], _)], _), [elemTy], xa -> E.NewArray(ConvType cenv elemTy, ConvExprs cenv env xa) | TOp.ILAsm ([ I_ldelem_any (ILArrayShape [(Some 0, None)], _)], _), [elemTy], [arr; idx1] -> - let op = mkCallArrayGet cenv.g m elemTy arr idx1 + let op = mkCallArrayGet g m elemTy arr idx1 ConvExprPrim cenv env op | TOp.ILAsm ([ I_stelem_any (ILArrayShape [(Some 0, None)], _)], _), [elemTy], [arr; idx1; v] -> - let op = mkCallArraySet cenv.g m elemTy arr idx1 v + let op = mkCallArraySet g m elemTy arr idx1 v ConvExprPrim cenv env op | TOp.ILAsm ([ ILUnaryOp unaryOp ], _), _, [arg] -> - let ty = tyOfExpr cenv.g arg - let op = unaryOp cenv.g m ty arg + let ty = tyOfExpr g arg + let op = unaryOp g m ty arg ConvExprPrim cenv env op | TOp.ILAsm ([ ILBinaryOp binaryOp ], _), _, [arg1;arg2] -> - let ty = tyOfExpr cenv.g arg1 - let op = binaryOp cenv.g m ty arg1 arg2 + let ty = tyOfExpr g arg1 + let op = binaryOp g m ty arg1 arg2 ConvExprPrim cenv env op | TOp.ILAsm ([ ILConvertOp convertOp1; ILConvertOp convertOp2 ], _), _, [arg] -> - let ty1 = tyOfExpr cenv.g arg - let op1 = convertOp1 cenv.g m ty1 arg - let ty2 = tyOfExpr cenv.g op1 - let op2 = convertOp2 cenv.g m ty2 op1 + let ty1 = tyOfExpr g arg + let op1 = convertOp1 g m ty1 arg + let ty2 = tyOfExpr g op1 + let op2 = convertOp2 g m ty2 op1 ConvExprPrim cenv env op2 - | TOp.ILAsm ([ ILConvertOp convertOp ], [TType_app (tcref,_)]), _, [arg] -> - let ty = tyOfExpr cenv.g arg + | TOp.ILAsm ([ ILConvertOp convertOp ], [TType_app (tcref,_, _)]), _, [arg] -> + let ty = tyOfExpr g arg let op = - if tyconRefEq cenv.g tcref cenv.g.char_tcr - then mkCallToCharOperator cenv.g m ty arg - else convertOp cenv.g m ty arg + if tyconRefEq g tcref g.char_tcr + then mkCallToCharOperator g m ty arg + else convertOp g m ty arg ConvExprPrim cenv env op | TOp.ILAsm ([ I_throw ], _), _, [arg1] -> - let raiseExpr = mkCallRaise cenv.g m (tyOfExpr cenv.g expr) arg1 + let raiseExpr = mkCallRaise g m (tyOfExpr g expr) arg1 ConvExprPrim cenv env raiseExpr | TOp.ILAsm (il, _), tyargs, args -> - E.ILAsm(sprintf "%+A" il, ConvTypes cenv tyargs, ConvExprs cenv env args) + E.ILAsm (sprintf "%+A" il, ConvTypes cenv tyargs, ConvExprs cenv env args) | TOp.ExnConstr tcref, tyargs, args -> E.NewRecord(ConvType cenv (mkAppTy tcref tyargs), ConvExprs cenv env args) @@ -753,7 +754,7 @@ module FSharpExprConvert = let fspec = exnc.TrueInstanceFieldsAsList.[i] let fref = mkRecdFieldRef tcref fspec.Name let typR = ConvType cenv (mkAppTy tcref tyargs) - let objR = ConvExpr cenv env (mkCoerceExpr (obj, mkAppTy tcref [], m, cenv.g.exn_ty)) + let objR = ConvExpr cenv env (mkCoerceExpr (obj, mkAppTy tcref [], m, g.exn_ty)) E.FSharpFieldGet(Some objR, typR, ConvRecdFieldRef cenv fref) | TOp.ExnFieldSet (tcref, i), [], [obj;e2] -> @@ -761,18 +762,18 @@ module FSharpExprConvert = let fspec = exnc.TrueInstanceFieldsAsList.[i] let fref = mkRecdFieldRef tcref fspec.Name let typR = ConvType cenv (mkAppTy tcref tyargs) - let objR = ConvExpr cenv env (mkCoerceExpr (obj, mkAppTy tcref [], m, cenv.g.exn_ty)) + let objR = ConvExpr cenv env (mkCoerceExpr (obj, mkAppTy tcref [], m, g.exn_ty)) E.FSharpFieldSet(Some objR, typR, ConvRecdFieldRef cenv fref, ConvExpr cenv env e2) | TOp.Coerce, [tgtTy;srcTy], [x] -> - if typeEquiv cenv.g tgtTy srcTy then + if typeEquiv g tgtTy srcTy then ConvExprPrim cenv env x else E.Coerce(ConvType cenv tgtTy, ConvExpr cenv env x) | TOp.Reraise, [toTy], [] -> // rebuild reraise() and Convert - mkReraiseLibCall cenv.g toTy m |> ConvExprPrim cenv env + mkReraiseLibCall g toTy m |> ConvExprPrim cenv env | TOp.LValueOp (LAddrOf _, vref), [], [] -> E.AddressOf(ConvExpr cenv env (exprForValRef m vref)) @@ -792,16 +793,16 @@ module FSharpExprConvert = | TOp.While _, [], [Expr.Lambda (_, _, _, [_], test, _, _);Expr.Lambda (_, _, _, [_], body, _, _)] -> E.WhileLoop(ConvExpr cenv env test, ConvExpr cenv env body) - | TOp.For (_, dir), [], [Expr.Lambda (_, _, _, [_], lim0, _, _); Expr.Lambda (_, _, _, [_], SimpleArrayLoopUpperBound, lm, _); SimpleArrayLoopBody cenv.g (arr, elemTy, body)] -> + | TOp.For (_, dir), [], [Expr.Lambda (_, _, _, [_], lim0, _, _); Expr.Lambda (_, _, _, [_], SimpleArrayLoopUpperBound, lm, _); SimpleArrayLoopBody g (arr, elemTy, body)] -> let lim1 = - let len = mkCallArrayLength cenv.g lm elemTy arr // Array.length arr - mkCallSubtractionOperator cenv.g lm cenv.g.int32_ty len (mkOne cenv.g lm) // len - 1 + let len = mkCallArrayLength g lm elemTy arr // Array.length arr + mkCallSubtractionOperator g lm g.int32_ty len (mkOne g lm) // len - 1 E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, dir <> FSharpForLoopDown) | TOp.For (_, dir), [], [Expr.Lambda (_, _, _, [_], lim0, _, _); Expr.Lambda (_, _, _, [_], lim1, lm, _); body] -> let lim1 = if dir = CSharpForLoopUp then - mkCallSubtractionOperator cenv.g lm cenv.g.int32_ty lim1 (mkOne cenv.g lm) // len - 1 + mkCallSubtractionOperator g lm g.int32_ty lim1 (mkOne g lm) // len - 1 else lim1 E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, dir <> FSharpForLoopDown) @@ -818,9 +819,9 @@ module FSharpExprConvert = let envh = env.BindVal vh E.TryWith(ConvExpr cenv env e1, vfR, ConvExpr cenv envf ef, vhR, ConvExpr cenv envh eh) - | TOp.Bytes bytes, [], [] -> E.Const(box bytes, ConvType cenv (tyOfExpr cenv.g expr)) + | TOp.Bytes bytes, [], [] -> E.Const(box bytes, ConvType cenv (tyOfExpr g expr)) - | TOp.UInt16s arr, [], [] -> E.Const(box arr, ConvType cenv (tyOfExpr cenv.g expr)) + | TOp.UInt16s arr, [], [] -> E.Const(box arr, ConvType cenv (tyOfExpr g expr)) | TOp.UnionCaseProof _, _, [e] -> ConvExprPrim cenv env e // Note: we erase the union case proof conversions when converting to quotations | TOp.UnionCaseTagGet tycr, tyargs, [arg1] -> @@ -835,7 +836,7 @@ module FSharpExprConvert = E.TraitCall(tysR, nm, memFlags, argtysR, tyargsR, argsR) | TOp.RefAddrGet readonly, [ty], [e] -> - let replExpr = mkRecdFieldGetAddrViaExprAddr(readonly, e, mkRefCellContentsRef cenv.g, [ty], m) + let replExpr = mkRecdFieldGetAddrViaExprAddr(readonly, e, mkRefCellContentsRef g, [ty], m) ConvExprPrim cenv env replExpr | _ -> wfail (sprintf "unhandled construct in AST", m) @@ -874,6 +875,7 @@ module FSharpExprConvert = Some(vR, rhsR), envinner and ConvILCall (cenv: SymbolEnv) env (isNewObj, valUseFlags, ilMethRef, enclTypeArgs, methTypeArgs, callArgs, m) = + let g = cenv.g let isNewObj = (isNewObj || (match valUseFlags with CtorValUsedAsSuperInit | CtorValUsedAsSelfInit -> true | _ -> false)) let methName = ilMethRef.Name let isPropGet = methName.StartsWithOrdinal("get_") @@ -890,7 +892,7 @@ module FSharpExprConvert = let parent = ILTypeRef.Create(e.Scope, e.Enclosing.Tail, e.Enclosing.Head) Import.ImportILTypeRef cenv.amap m parent, Some e.Name - let enclosingType = generalizedTyconRef tcref + let enclosingType = generalizedTyOfTyconRef g tcref let makeCall minfo = ConvObjectModelCallLinear cenv env (isNewObj, minfo, enclTypeArgs, methTypeArgs, callArgs) id @@ -898,7 +900,7 @@ module FSharpExprConvert = let makeFSCall isMember (vr: ValRef) = let memOrVal = if isMember then - let minfo = MethInfo.FSMeth(cenv.g, enclosingType, vr, None) + let minfo = MethInfo.FSMeth(g, enclosingType, vr, None) FSharpMemberOrFunctionOrValue(cenv, minfo) else FSharpMemberOrFunctionOrValue(cenv, vr) @@ -1053,12 +1055,12 @@ module FSharpExprConvert = let argtys = [ ilMethRef.ArgTypes |> List.map (ImportILTypeFromMetadata cenv.amap m scoref tinst1 tinst2) ] let rty = match ImportReturnTypeFromMetadata cenv.amap m ilMethRef.ReturnType emptyILCustomAttrs scoref tinst1 tinst2 with - | None -> if isCtor then enclosingType else cenv.g.unit_ty + | None -> if isCtor then enclosingType else g.unit_ty | Some ty -> ty let linkageType = - let ty = mkIteratedFunTy (List.map (mkRefTupledTy cenv.g) argtys) rty - let ty = if isStatic then ty else mkFunTy enclosingType ty + let ty = mkIteratedFunTy g (List.map (mkRefTupledTy g) argtys) rty + let ty = if isStatic then ty else mkFunTy g enclosingType ty mkForallTyIfNeeded (typars1 @ typars2) ty let argCount = List.sum (List.map List.length argtys) + (if isStatic then 0 else 1) diff --git a/src/fsharp/symbols/SymbolHelpers.fs b/src/fsharp/symbols/SymbolHelpers.fs index 0547f759df2..ea1781ddb42 100644 --- a/src/fsharp/symbols/SymbolHelpers.fs +++ b/src/fsharp/symbols/SymbolHelpers.fs @@ -476,7 +476,7 @@ module internal SymbolHelpers = // Generalize to get a formal signature let formalTypars = tcref.Typars m let formalTypeInst = generalizeTypars formalTypars - let ty = TType_app(tcref, formalTypeInst) + let ty = TType_app(tcref, formalTypeInst, KnownAmbivalentToNull) if isILAppTy g ty then let formalTypeInfo = ILTypeInfo.FromType g ty Some(nlref.Ccu.FileName, formalTypars, formalTypeInfo) @@ -613,7 +613,7 @@ module internal SymbolHelpers = | Item.RecdField rfinfo -> mkXmlComment (GetXmlDocSigOfRecdFieldInfo rfinfo) | Item.NewDef _ -> FSharpXmlDoc.None | Item.ILField finfo -> mkXmlComment (GetXmlDocSigOfILFieldInfo infoReader m finfo) - | Item.Types(_, ((TType_app(tcref, _)) :: _)) -> mkXmlComment (GetXmlDocSigOfEntityRef infoReader m tcref) + | Item.Types(_, ((TType_app(tcref, _, _)) :: _)) -> mkXmlComment (GetXmlDocSigOfEntityRef infoReader m tcref) | Item.CustomOperation (_, _, Some minfo) -> mkXmlComment (GetXmlDocSigOfMethInfo infoReader m minfo) | Item.TypeVar _ -> FSharpXmlDoc.None | Item.ModuleOrNamespaces(modref :: _) -> mkXmlComment (GetXmlDocSigOfEntityRef infoReader m modref) @@ -771,8 +771,8 @@ module internal SymbolHelpers = | Item.UnqualifiedType tcRefs1, Item.UnqualifiedType tcRefs2 -> List.zip tcRefs1 tcRefs2 |> List.forall (fun (tcRef1, tcRef2) -> tyconRefEq g tcRef1 tcRef2) - | Item.Types(_, [TType.TType_app(tcRef1, _)]), Item.UnqualifiedType([tcRef2]) -> tyconRefEq g tcRef1 tcRef2 - | Item.UnqualifiedType([tcRef1]), Item.Types(_, [TType.TType_app(tcRef2, _)]) -> tyconRefEq g tcRef1 tcRef2 + | Item.Types(_, [TType.TType_app(tcRef1, _, _)]), Item.UnqualifiedType([tcRef2]) -> tyconRefEq g tcRef1 tcRef2 + | Item.UnqualifiedType([tcRef1]), Item.Types(_, [TType.TType_app(tcRef2, _, _)]) -> tyconRefEq g tcRef1 tcRef2 | _ -> false) member x.GetHashCode item = @@ -845,7 +845,7 @@ module internal SymbolHelpers = isAppTy g ty && g.suppressed_types |> List.exists (fun supp -> - let generalizedSupp = generalizedTyconRef supp + let generalizedSupp = generalizedTyOfTyconRef g supp // check the display name is precisely the one we're suppressing isAppTy g generalizedSupp && it = supp.DisplayName && // check if they are the same logical type (after removing all abbreviations) @@ -945,7 +945,7 @@ module internal SymbolHelpers = | Item.MethodGroup(_, minfo :: _, _) -> GetXmlCommentForMethInfoItem infoReader m item minfo - | Item.Types(_, ((TType_app(tcref, _)) :: _)) -> + | Item.Types (_, ((TType_app (tcref, _, _)):: _)) -> GetXmlCommentForItemAux (if tyconRefUsesLocalXmlDoc g.compilingFslib tcref || tcref.XmlDoc.NonEmpty then Some tcref.XmlDoc else None) infoReader m item | Item.ModuleOrNamespaces((modref :: _) as modrefs) -> @@ -984,9 +984,9 @@ module internal SymbolHelpers = let g = infoReader.g let amap = infoReader.amap match item with - | Item.Types(_, ((TType_app(tcref, _)) :: _)) + | Item.Types (_, ((TType_app (tcref, _, _)) :: _)) | Item.UnqualifiedType(tcref :: _) -> - let ty = generalizedTyconRef tcref + let ty = generalizedTyOfTyconRef g tcref Infos.ExistsHeadTypeInEntireHierarchy g amap range0 ty g.tcref_System_Attribute | _ -> false with _ -> false @@ -1011,7 +1011,7 @@ module internal SymbolHelpers = // Union tags (constructors) | Item.UnionCase(ucinfo, _) -> let uc = ucinfo.UnionCase - let rty = generalizedTyconRef ucinfo.TyconRef + let rty = generalizedTyOfTyconRef g ucinfo.TyconRef let recd = uc.RecdFields let layout = wordL (tagText (FSComp.SR.typeInfoUnionCase())) ^^ @@ -1169,7 +1169,7 @@ module internal SymbolHelpers = FSharpStructuredToolTipElement.Single(layout, xml) // Types. - | Item.Types(_, ((TType_app(tcref, _)) :: _)) + | Item.Types (_, ((TType_app (tcref, _, _)) :: _)) | Item.UnqualifiedType (tcref :: _) -> let denv = { denv with shortTypeNames = true } let layout = NicePrint.layoutTycon denv infoReader AccessibleFromSomewhere m (* width *) tcref.Deref @@ -1362,7 +1362,7 @@ module internal SymbolHelpers = | Item.UnqualifiedType (tcref :: _) | Item.ExnCase tcref -> // strip off any abbreviation - match generalizedTyconRef tcref with + match generalizedTyOfTyconRef g tcref with | AppTy g (tcref, _) -> Some (ticksAndArgCountTextOfTyconRef tcref) | _ -> None diff --git a/src/fsharp/symbols/Symbols.fs b/src/fsharp/symbols/Symbols.fs index 50368c3ca2f..4c3fdfa2532 100644 --- a/src/fsharp/symbols/Symbols.fs +++ b/src/fsharp/symbols/Symbols.fs @@ -544,33 +544,36 @@ and FSharpEntity(cenv: SymbolEnv, entity:EntityRef) = member x.DeclaredInterfaces = if isUnresolved() then makeReadOnlyCollection [] else + let ty = generalizedTyOfTyconRef cenv.g entity ErrorLogger.protectAssemblyExploration [] (fun () -> - [ for ty in GetImmediateInterfacesOfType SkipUnrefInterfaces.Yes cenv.g cenv.amap range0 (generalizedTyconRef entity) do - yield FSharpType(cenv, ty) ]) + [ for ity in GetImmediateInterfacesOfType SkipUnrefInterfaces.Yes cenv.g cenv.amap range0 ty do + yield FSharpType(cenv, ity) ]) |> makeReadOnlyCollection member x.AllInterfaces = if isUnresolved() then makeReadOnlyCollection [] else + let ty = generalizedTyOfTyconRef cenv.g entity ErrorLogger.protectAssemblyExploration [] (fun () -> - [ for ty in AllInterfacesOfType cenv.g cenv.amap range0 AllowMultiIntfInstantiations.Yes (generalizedTyconRef entity) do - yield FSharpType(cenv, ty) ]) + [ for ity in AllInterfacesOfType cenv.g cenv.amap range0 AllowMultiIntfInstantiations.Yes ty do + yield FSharpType(cenv, ity) ]) |> makeReadOnlyCollection member x.IsAttributeType = if isUnresolved() then false else - let ty = generalizedTyconRef entity + let ty = generalizedTyOfTyconRef cenv.g entity ErrorLogger.protectAssemblyExploration false <| fun () -> - Infos.ExistsHeadTypeInEntireHierarchy cenv.g cenv.amap range0 ty cenv.g.tcref_System_Attribute + Infos.ExistsHeadTypeInEntireHierarchy cenv.g cenv.amap range0 ty cenv.g.tcref_System_Attribute member x.IsDisposableType = if isUnresolved() then false else - let ty = generalizedTyconRef entity + let ty = generalizedTyOfTyconRef cenv.g entity ErrorLogger.protectAssemblyExploration false <| fun () -> - Infos.ExistsHeadTypeInEntireHierarchy cenv.g cenv.amap range0 ty cenv.g.tcref_System_IDisposable + Infos.ExistsHeadTypeInEntireHierarchy cenv.g cenv.amap range0 ty cenv.g.tcref_System_IDisposable member x.BaseType = checkIsResolved() - GetSuperTypeOfType cenv.g cenv.amap range0 (generalizedTyconRef entity) + let ty = generalizedTyOfTyconRef cenv.g entity + GetSuperTypeOfType cenv.g cenv.amap range0 ty |> Option.map (fun ty -> FSharpType(cenv, ty)) member __.UsesPrefixDisplay = @@ -584,7 +587,7 @@ and FSharpEntity(cenv: SymbolEnv, entity:EntityRef) = member x.MembersFunctionsAndValues = if isUnresolved() then makeReadOnlyCollection[] else protect <| fun () -> - ([ let _, entityTy = generalizeTyconRef entity + ([ let entityTy = generalizedTyOfTyconRef cenv.g entity let createMember (minfo: MethInfo) = if minfo.IsConstructor then FSharpMemberOrFunctionOrValue(cenv, C minfo, Item.CtorGroup (minfo.DisplayName, [minfo])) else FSharpMemberOrFunctionOrValue(cenv, M minfo, Item.MethodGroup (minfo.DisplayName, [minfo], None)) @@ -615,10 +618,10 @@ and FSharpEntity(cenv: SymbolEnv, entity:EntityRef) = yield FSharpMemberOrFunctionOrValue(cenv, V vref, Item.Value vref) match v.MemberInfo.Value.MemberFlags.MemberKind, v.ApparentEnclosingEntity with | MemberKind.PropertyGet, Parent p -> - let pinfo = FSProp(cenv.g, generalizedTyconRef p, Some vref, None) + let pinfo = FSProp(cenv.g, generalizedTyOfTyconRef cenv.g p, Some vref, None) yield FSharpMemberOrFunctionOrValue(cenv, P pinfo, Item.Property (pinfo.PropertyName, [pinfo])) | MemberKind.PropertySet, Parent p -> - let pinfo = FSProp(cenv.g, generalizedTyconRef p, None, Some vref) + let pinfo = FSProp(cenv.g, generalizedTyOfTyconRef cenv.g p, None, Some vref) yield FSharpMemberOrFunctionOrValue(cenv, P pinfo, Item.Property (pinfo.PropertyName, [pinfo])) | _ -> () @@ -670,7 +673,7 @@ and FSharpEntity(cenv: SymbolEnv, entity:EntityRef) = let (TILObjectReprData(_scoref, _enc, tdef)) = entity.ILTyconInfo let formalTypars = entity.Typars(range.Zero) let formalTypeInst = generalizeTypars formalTypars - let ty = TType_app(entity, formalTypeInst) + let ty = TType_app(entity, formalTypeInst, cenv.g.knownWithoutNull) let formalTypeInfo = ILTypeInfo.FromType cenv.g ty tdef.Fields.AsList |> List.map (fun tdef -> let ilFieldInfo = ILFieldInfo(formalTypeInfo, tdef) @@ -1313,6 +1316,11 @@ and FSharpGenericParameterConstraint(cenv, cx: TyparConstraint) = | TyparConstraint.SupportsComparison _ -> true | _ -> false + member __.IsNotSupportsNullConstraint = + match cx with + | TyparConstraint.NotSupportsNull _ -> true + | _ -> false + member __.IsEqualityConstraint = match cx with | TyparConstraint.SupportsEquality _ -> true @@ -1470,7 +1478,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = | M m | C m -> let rty = m.GetFSharpReturnTy(cenv.amap, range0, m.FormalMethodInst) let argtysl = m.GetParamTypes(cenv.amap, range0, m.FormalMethodInst) - mkIteratedFunTy (List.map (mkRefTupledTy cenv.g) argtysl) rty + mkIteratedFunTy cenv.g (List.map (mkRefTupledTy cenv.g) argtysl) rty | V v -> v.TauType FSharpType(cenv, ty) @@ -1604,9 +1612,9 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = match d with | M m when m.LogicalName.StartsWithOrdinal("add_") -> let eventName = m.LogicalName.[4..] - let entityTy = generalizedTyconRef m.DeclaringTyconRef + let entityTy = generalizedTyOfTyconRef cenv.g m.DeclaringTyconRef not (isNil (cenv.infoReader.GetImmediateIntrinsicEventsOfType (Some eventName, AccessibleFromSomeFSharpCode, range0, entityTy))) || - let declaringTy = generalizedTyconRef m.DeclaringTyconRef + let declaringTy = generalizedTyOfTyconRef cenv.g m.DeclaringTyconRef match GetImmediateIntrinsicPropInfosOfType (Some eventName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy with | pinfo :: _ -> pinfo.IsFSharpEventProperty | _ -> false @@ -1618,9 +1626,9 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = match d with | M m when m.LogicalName.StartsWithOrdinal("remove_") -> let eventName = m.LogicalName.[7..] - let entityTy = generalizedTyconRef m.DeclaringTyconRef + let entityTy = generalizedTyOfTyconRef cenv.g m.DeclaringTyconRef not (isNil (cenv.infoReader.GetImmediateIntrinsicEventsOfType (Some eventName, AccessibleFromSomeFSharpCode, range0, entityTy))) || - let declaringTy = generalizedTyconRef m.DeclaringTyconRef + let declaringTy = generalizedTyOfTyconRef cenv.g m.DeclaringTyconRef match GetImmediateIntrinsicPropInfosOfType (Some eventName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy with | pinfo :: _ -> pinfo.IsFSharpEventProperty | _ -> false @@ -1645,7 +1653,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = match d with | M m when m.LogicalName.StartsWithOrdinal("get_") -> let propName = PrettyNaming.ChopPropertyName(m.LogicalName) - let declaringTy = generalizedTyconRef m.DeclaringTyconRef + let declaringTy = generalizedTyOfTyconRef cenv.g m.DeclaringTyconRef not (isNil (GetImmediateIntrinsicPropInfosOfType (Some propName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy)) | V v -> v.IsPropertyGetterMethod | _ -> false @@ -1656,7 +1664,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = // Look for a matching property with the right name. | M m when m.LogicalName.StartsWithOrdinal("set_") -> let propName = PrettyNaming.ChopPropertyName(m.LogicalName) - let declaringTy = generalizedTyconRef m.DeclaringTyconRef + let declaringTy = generalizedTyOfTyconRef cenv.g m.DeclaringTyconRef not (isNil (GetImmediateIntrinsicPropInfosOfType (Some propName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy)) | V v -> v.IsPropertySetterMethod | _ -> false @@ -2023,7 +2031,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = | M m | C m -> let rty = m.GetFSharpReturnTy(cenv.amap, range0, m.FormalMethodInst) let argtysl = m.GetParamTypes(cenv.amap, range0, m.FormalMethodInst) - mkIteratedFunTy (List.map (mkRefTupledTy cenv.g) argtysl) rty + mkIteratedFunTy cenv.g (List.map (mkRefTupledTy cenv.g) argtysl) rty | V v -> v.TauType NicePrint.prettyLayoutOfTypeNoCx (denv.Contents cenv.g) ty @@ -2033,7 +2041,7 @@ and FSharpType(cenv, ty:TType) = let isUnresolved() = ErrorLogger.protectAssemblyExploration true <| fun () -> match stripTyparEqns ty with - | TType_app (tcref, _) -> FSharpEntity(cenv, tcref).IsUnresolved + | TType_app (tcref, _, _) -> FSharpEntity(cenv, tcref).IsUnresolved | TType_measure (Measure.Con tcref) -> FSharpEntity(cenv, tcref).IsUnresolved | TType_measure (Measure.Prod _) -> FSharpEntity(cenv, cenv.g.measureproduct_tcr).IsUnresolved | TType_measure Measure.One -> FSharpEntity(cenv, cenv.g.measureone_tcr).IsUnresolved @@ -2073,20 +2081,37 @@ and FSharpType(cenv, ty:TType) = member __.TypeDefinition = protect <| fun () -> match stripTyparEqns ty with - | TType_app (tcref, _) -> FSharpEntity(cenv, tcref) + | TType_app (tcref, _, _) -> FSharpEntity(cenv, tcref) | TType_measure (Measure.Con tcref) -> FSharpEntity(cenv, tcref) | TType_measure (Measure.Prod _) -> FSharpEntity(cenv, cenv.g.measureproduct_tcr) | TType_measure Measure.One -> FSharpEntity(cenv, cenv.g.measureone_tcr) | TType_measure (Measure.Inv _) -> FSharpEntity(cenv, cenv.g.measureinverse_tcr) | _ -> invalidOp "not a named type" + member __.HasNullAnnotation = + protect <| fun () -> + match stripTyparEqns ty with + | TType_var (_, nullness) + | TType_app (_, _, nullness) + | TType_fun(_, _, nullness) -> match nullness.Evaluate() with NullnessInfo.WithNull -> true | _ -> false + | TType_tuple (_, _) -> false + | _ -> false + + member __.IsNullAmbivalent = + protect <| fun () -> + match stripTyparEqns ty with + | TType_app (_, _, nullness) + | TType_fun(_, _, nullness) -> match nullness.Evaluate() with NullnessInfo.AmbivalentToNull -> true | _ -> false + | TType_tuple (_, _) -> false + | _ -> false + member __.GenericArguments = protect <| fun () -> match stripTyparEqns ty with | TType_anon (_, tyargs) - | TType_app (_, tyargs) + | TType_app (_, tyargs, _) | TType_tuple (_, tyargs) -> (tyargs |> List.map (fun ty -> FSharpType(cenv, ty)) |> makeReadOnlyCollection) - | TType_fun(d, r) -> [| FSharpType(cenv, d); FSharpType(cenv, r) |] |> makeReadOnlyCollection + | TType_fun(d, r, _nullness) -> [| FSharpType(cenv, d); FSharpType(cenv, r) |] |> makeReadOnlyCollection | TType_measure (Measure.Con _) -> [| |] |> makeReadOnlyCollection | TType_measure (Measure.Prod (t1, t2)) -> [| FSharpType(cenv, TType_measure t1); FSharpType(cenv, TType_measure t2) |] |> makeReadOnlyCollection | TType_measure Measure.One -> [| |] |> makeReadOnlyCollection @@ -2138,7 +2163,8 @@ and FSharpType(cenv, ty:TType) = member __.GenericParameter = protect <| fun () -> match stripTyparEqns ty with - | TType_var tp + | TType_var (tp, _nullness) -> + FSharpGenericParameter (cenv, tp) | TType_measure (Measure.Var tp) -> FSharpGenericParameter (cenv, tp) | _ -> invalidOp "not a generic parameter type" @@ -2176,11 +2202,11 @@ and FSharpType(cenv, ty:TType) = let ty = stripTyEqnsWrtErasure EraseNone cenv.g ty match ty with | TType_forall _ -> 10000 - | TType_var tp -> 10100 + int32 tp.Stamp - | TType_app (tc1, b1) -> 10200 + int32 tc1.Stamp + List.sumBy hashType b1 + | TType_var (tp, _nullness) -> 10100 + int32 tp.Stamp + | TType_app (tc1, b1, _) -> 10200 + int32 tc1.Stamp + List.sumBy hashType b1 | TType_ucase _ -> 10300 // shouldn't occur in symbols | TType_tuple (_, l1) -> 10400 + List.sumBy hashType l1 - | TType_fun (dty, rty) -> 10500 + hashType dty + hashType rty + | TType_fun (dty, rty, _nullness) -> 10500 + hashType dty + hashType rty | TType_measure _ -> 10600 | TType_anon (_,l1) -> 10800 + List.sumBy hashType l1 hashType ty diff --git a/src/fsharp/symbols/Symbols.fsi b/src/fsharp/symbols/Symbols.fsi index bd5e0b188d5..96a21461a26 100644 --- a/src/fsharp/symbols/Symbols.fsi +++ b/src/fsharp/symbols/Symbols.fsi @@ -940,7 +940,13 @@ and [] public FSharpType = /// Get the type definition for a type member TypeDefinition : FSharpEntity - + + /// Indicates this type is known to have a null annotation + member HasNullAnnotation: bool + + /// Indicates this type is assumed to support the null value + member IsNullAmbivalent: bool + /// Get the generic arguments for a tuple type, a function type or a type constructed using a named entity member GenericArguments : IList diff --git a/src/fsharp/tainted.fs b/src/fsharp/tainted.fs index ebdc96c746a..a67942a0b3e 100644 --- a/src/fsharp/tainted.fs +++ b/src/fsharp/tainted.fs @@ -126,12 +126,15 @@ type internal Tainted<'T> (context : TaintedContext, value : 'T) = let u = this.Protect (fun x -> f (x,context.TypeProvider)) range Tainted(context, u) - member this.PApplyArray(f,methodName,range:range) = - let a = this.Protect f range + member this.PApplyArray(f, methodName, range:range) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let a : 'U[] = this.Protect f range +#else + let a : 'U[]? = this.Protect f range +#endif match a with - | null -> raise <| TypeProviderError(FSComp.SR.etProviderReturnedNull(methodName), this.TypeProviderDesignation, range) - | _ -> a |> Array.map (fun u -> Tainted(context,u)) - + | null -> raise <| TypeProviderError(FSComp.SR.etProviderReturnedNull(methodName), this.TypeProviderDesignation, range) + | NonNull a -> a |> Array.map (fun u -> Tainted(context,u)) member this.PApplyOption(f,range:range) = let a = this.Protect f range @@ -140,7 +143,9 @@ type internal Tainted<'T> (context : TaintedContext, value : 'T) = | Some x -> Some (Tainted(context,x)) member this.PUntaint(f,range:range) = this.Protect f range + member this.PUntaintNoFailure f = this.PUntaint(f, range0) + /// Access the target object directly. Use with extreme caution. member this.AccessObjectDirectly = value @@ -157,8 +162,14 @@ type internal Tainted<'T> (context : TaintedContext, value : 'T) = Tainted(context, this.Protect(fun value -> box value :?> 'U) range) module internal Tainted = - let (|Null|_|) (p:Tainted<'T>) = - if p.PUntaintNoFailure(fun p -> match p with null -> true | _ -> false) then Some() else None + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let (|Null|NonNull|) (p:Tainted<'T>) : Choice> when 'T : null and 'T : not struct = + if p.PUntaintNoFailure isNull then Null else NonNull (p.PApplyNoFailure id) +#else + let (|Null|NonNull|) (p:Tainted<'T?>) : Choice> when 'T : not null = + if p.PUntaintNoFailure isNull then Null else NonNull (p.PApplyNoFailure nonNull) +#endif let Eq (p:Tainted<'T>) (v:'T) = p.PUntaintNoFailure((fun pv -> pv = v)) diff --git a/src/fsharp/tainted.fsi b/src/fsharp/tainted.fsi index c5220feb6cf..36030e3d551 100644 --- a/src/fsharp/tainted.fsi +++ b/src/fsharp/tainted.fsi @@ -72,7 +72,11 @@ type internal Tainted<'T> = member PApplyWithProvider : ('T * ITypeProvider -> 'U) * range:range -> Tainted<'U> /// Apply an operation that returns an array. Unwrap array. Any exception will be attributed to the type provider with an error located at the given range. String is method name of thing-returning-array, to diagnostically attribute if it is null +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE member PApplyArray : ('T -> 'U[]) * string * range:range -> Tainted<'U>[] +#else + member PApplyArray : ('T -> 'U[]?) * string * range:range -> Tainted<'U>[] +#endif /// Apply an operation that returns an option. Unwrap option. Any exception will be attributed to the type provider with an error located at the given range member PApplyOption : ('T -> 'U option) * range:range -> Tainted<'U> option @@ -96,7 +100,12 @@ type internal Tainted<'T> = module internal Tainted = /// Test whether the tainted value is null - val (|Null|_|) : Tainted<'T> -> unit option when 'T : null +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + val (|Null|NonNull|) : Tainted<'T> -> Choice> when 'T : null and 'T : not struct +#else + val (|Null|NonNull|) : Tainted<'T?> -> Choice> when 'T : not null and 'T : not struct +#endif + /// Test whether the tainted value equals given value. /// Failure in call to equality operation will be blamed on type provider of first operand diff --git a/src/fsharp/tast.fs b/src/fsharp/tast.fs index 98a8710afb0..7bd776fce8e 100644 --- a/src/fsharp/tast.fs +++ b/src/fsharp/tast.fs @@ -509,7 +509,7 @@ let ComputeDefinitionLocationOfProvidedItem (p: Tainted<#IProvidedCustomAttribut let attrs = p.PUntaintNoFailure(fun x -> x.GetDefinitionLocationAttribute(p.TypeProvider.PUntaintNoFailure id)) match attrs with | None | Some (null, _, _) -> None - | Some (filePath, line, column) -> + | Some (NonNull filePath, line, column) -> // Coordinates from type provider are 1-based for lines and columns // Coordinates internally in the F# compiler are 1-based for lines and 0-based for columns let pos = Range.mkPos line (max 0 (column - 1)) @@ -1995,7 +1995,7 @@ and Construct = let lazyBaseTy = LazyWithContext.Create ((fun (m, objTy) -> - let baseSystemTy = st.PApplyOption((fun st -> match st.BaseType with null -> None | ty -> Some ty), m) + let baseSystemTy = st.PApplyOption((fun st -> match st.BaseType with null -> None | ty -> Some (nonNull ty)), m) match baseSystemTy with | None -> objTy | Some t -> importProvidedType t), @@ -2010,6 +2010,8 @@ and Construct = let baseType = st.BaseType match baseType with | null -> false + | NonNull x -> + match x with | x when x.IsGenericType -> false | x when x.DeclaringType <> null -> false | x -> x.FullName = "System.Delegate" || x.FullName = "System.MulticastDelegate"), m)) @@ -2277,14 +2279,18 @@ and | None -> () /// Links a previously unlinked type variable to the given data. Only used during unpickling of F# metadata. - member x.AsType = - let ty = x.typar_astype - match box ty with - | null -> - let ty2 = TType_var x - x.typar_astype <- ty2 - ty2 - | _ -> ty + member x.AsType nullness = + match nullness with + | Nullness.Known NullnessInfo.AmbivalentToNull -> + let ty = x.typar_astype + match box ty with + | null -> + let ty2 = TType_var (x, Nullness.Known NullnessInfo.AmbivalentToNull) + x.typar_astype <- ty2 + ty2 + | _ -> ty + | _ -> + TType_var (x, nullness) /// Indicates if a type variable has been linked. Only used during unpickling of F# metadata. member x.IsLinked = x.typar_stamp <> -1L @@ -2333,6 +2339,9 @@ and /// Indicates a constraint that a type has a 'null' value | SupportsNull of range + /// Indicates a constraint that a type doesn't support nullness + | NotSupportsNull of range + /// Indicates a constraint that a type has a member with the given signature | MayResolveMember of TraitConstraintInfo * range @@ -3119,7 +3128,7 @@ and let rec tryResolveNestedTypeOf(parentEntity: Entity, resolutionEnvironment, st: Tainted, i) = match st.PApply((fun st -> st.GetNestedType path.[i]), m) with | Tainted.Null -> ValueNone - | st -> + | Tainted.NonNull st -> let newEntity = Construct.NewProvidedTycon(resolutionEnvironment, st, ccu.ImportProvidedType, false, m) parentEntity.ModuleOrNamespaceType.AddProvidedTypeEntity newEntity if i = path.Length-1 then ValueSome newEntity @@ -3149,13 +3158,16 @@ and assert (j >= 0) assert (j <= path.Length - 1) let matched = - [ for resolver in resolvers do - let moduleOrNamespace = if j = 0 then null else path.[0..j-1] + [ for resolver in resolvers do + let moduleOrNamespace = if j = 0 then [| |] else path.[0..j-1] let typename = path.[j] let resolution = ExtensionTyping.TryLinkProvidedType(resolver, moduleOrNamespace, typename, m) match resolution with - | None | Some (Tainted.Null) -> () - | Some st -> yield (resolver, st) ] + | None -> () + | Some st -> + match st with + | Tainted.Null -> () + | Tainted.NonNull st -> yield (resolver, st) ] match matched with | [(_, st)] -> // 'entity' is at position i in the dereference chain. We resolved to position 'j'. @@ -3950,6 +3962,63 @@ and override x.ToString() = x.FieldName +and Nullness = + | Known of NullnessInfo + | Variable of NullnessVar + + member n.Evaluate() = + match n with + | Known info -> info + | Variable v -> v.Evaluate() + + member n.TryEvaluate() = + match n with + | Known info -> ValueSome info + | Variable v -> v.TryEvaluate() + + override n.ToString() = match n.Evaluate() with NullnessInfo.WithNull -> "?" | NullnessInfo.WithoutNull -> "" | NullnessInfo.AmbivalentToNull -> "%" + +// Note, nullness variables are only created if the nullness checking feature is on +and NullnessVar() = + let mutable solution: Nullness option = None + + member nv.Evaluate() = + match solution with + | None -> NullnessInfo.WithoutNull + | Some soln -> soln.Evaluate() + + member nv.TryEvaluate() = + match solution with + | None -> ValueNone + | Some soln -> soln.TryEvaluate() + + member nv.IsSolved = solution.IsSome + + member nv.Set(nullness) = + assert (not nv.IsSolved) + solution <- Some nullness + + member nv.Unset() = + assert nv.IsSolved + solution <- None + + member nv.Solution = + assert nv.IsSolved + solution.Value + +and + [] + NullnessInfo = + + /// we know that there is an extra null value in the type + | WithNull + + /// we know that there is no extra null value in the type + | WithoutNull + + /// we know we don't care + | AmbivalentToNull + and /// The algebra of types [] @@ -3960,10 +4029,10 @@ and /// Indicates the type is a universal type, only used for types of values and members | TType_forall of Typars * TType - /// TType_app(tyconRef, typeInstantiation). + /// TType_app(tyconRef, typeInstantiation, nullness). /// /// Indicates the type is built from a named type and a number of type arguments - | TType_app of TyconRef * TypeInst + | TType_app of TyconRef * TypeInst * Nullness /// TType_anon /// @@ -3975,10 +4044,10 @@ and /// Indicates the type is a tuple type. elementTypes must be of length 2 or greater. | TType_tuple of TupInfo * TTypes - /// TType_fun(domainType, rangeType). + /// TType_fun(domainType, rangeType, nullness). /// /// Indicates the type is a function type - | TType_fun of TType * TType + | TType_fun of TType * TType * Nullness /// TType_ucase(unionCaseRef, typeInstantiation) /// @@ -3988,22 +4057,23 @@ and | TType_ucase of UnionCaseRef * TypeInst /// Indicates the type is a variable type, whether declared, generalized or an inference type parameter - | TType_var of Typar + | TType_var of Typar * Nullness /// Indicates the type is a unit-of-measure expression being used as an argument to a type or member | TType_measure of Measure + /// For now, used only as a discriminant in error message. /// See https://github.com/Microsoft/visualfsharp/issues/2561 member x.GetAssemblyName() = match x with - | TType_forall (_tps, ty) -> ty.GetAssemblyName() - | TType_app (tcref, _tinst) -> tcref.CompilationPath.ILScopeRef.QualifiedName - | TType_tuple (_tupInfo, _tinst) -> "" + | TType_forall (_tps, ty) -> ty.GetAssemblyName() + | TType_app (tcref, _tinst, _) -> tcref.CompilationPath.ILScopeRef.QualifiedName + | TType_tuple _ -> "" | TType_anon (anonInfo, _tinst) -> defaultArg anonInfo.Assembly.QualifiedName "" - | TType_fun (_d, _r) -> "" - | TType_measure _ms -> "" - | TType_var tp -> tp.Solution |> function Some sln -> sln.GetAssemblyName() | None -> "" + | TType_fun _ -> "" + | TType_measure _ -> "" + | TType_var (tp, _nullness) -> tp.Solution |> function Some sln -> sln.GetAssemblyName() | None -> "" | TType_ucase (_uc, _tinst) -> let (TILObjectReprData(scope, _nesting, _definition)) = _uc.Tycon.ILTyconInfo scope.QualifiedName @@ -4013,21 +4083,21 @@ and override x.ToString() = match x with - | TType_forall (_tps, ty) -> "forall ... " + ty.ToString() - | TType_app (tcref, tinst) -> tcref.DisplayName + (match tinst with [] -> "" | tys -> "<" + String.concat "," (List.map string tys) + ">") + | TType_forall (_tps, ty) -> "forall ... " + ty.ToString() + | TType_app (tcref, tinst, nullness) -> tcref.DisplayName + (match tinst with [] -> "" | tys -> "<" + String.concat "," (List.map string tys) + ">") + nullness.ToString() | TType_tuple (tupInfo, tinst) -> (match tupInfo with | TupInfo.Const false -> "" | TupInfo.Const true -> "struct ") - + String.concat "," (List.map string tinst) + + String.concat "," (List.map string tinst) + ")" + | TType_fun (d,r,nullness) -> "(" + string d + " -> " + string r + ")" + nullness.ToString() | TType_anon (anonInfo, tinst) -> (match anonInfo.TupInfo with | TupInfo.Const false -> "" | TupInfo.Const true -> "struct ") + "{|" + String.concat "," (Seq.map2 (fun nm ty -> nm + " " + string ty + ";") anonInfo.SortedNames tinst) + ")" + "|}" - | TType_fun (d, r) -> "(" + string d + " -> " + string r + ")" | TType_ucase (uc, tinst) -> "ucase " + uc.CaseName + (match tinst with [] -> "" | tys -> "<" + String.concat "," (List.map string tys) + ">") - | TType_var tp -> + | TType_var (tp, _nullness) -> match tp.Solution with | None -> tp.DisplayName | Some _ -> tp.DisplayName + " (solved)" @@ -4078,7 +4148,7 @@ and [] AnonRecdTypeInfo = x.Stamp <- d.Stamp x.SortedNames <- sortedNames - member x.IsLinked = (match x.SortedIds with null -> true | _ -> false) + member x.IsLinked = (match box x.SortedIds with null -> true | _ -> false) and [] TupInfo = /// Some constant, e.g. true or false for tupInfo @@ -4194,8 +4264,12 @@ and CcuReference = string // ILAssemblyRef and [] CcuThunk = - { mutable target: CcuData - + { +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + mutable target: CcuData +#else + mutable target: CcuData? +#endif /// ccu.orphanfixup is true when a reference is missing in the transitive closure of static references that /// may potentially be required for the metadata of referenced DLLs. It is set to true if the "loader" /// used in the F# metadata-deserializer or the .NET metadata reader returns a failing value (e.g. None). @@ -4205,12 +4279,23 @@ and name: CcuReference } +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE member ccu.Deref = - if isNull (ccu.target :> obj) || ccu.orphanfixup then + if isNull (box ccu.target) || ccu.orphanfixup then raise(UnresolvedReferenceNoRange ccu.name) ccu.target + + member ccu.IsUnresolvedReference = isNull (box ccu.target) || ccu.orphanfixup +#else + member ccu.Deref = + match ccu.target with + | null -> raise(UnresolvedReferenceNoRange ccu.name) + | _ when ccu.orphanfixup -> raise(UnresolvedReferenceNoRange ccu.name) + | NonNull tg -> tg + + member ccu.IsUnresolvedReference = isNull ccu.target || ccu.orphanfixup +#endif - member ccu.IsUnresolvedReference = isNull (ccu.target :> obj) || ccu.orphanfixup /// Ensure the ccu is derefable in advance. Supply a path to attach to any resulting error message. member ccu.EnsureDerefable(requiringPath: string[]) = @@ -5181,7 +5266,7 @@ and /// non-generic types. and [] - CompiledTypeRepr = + CompiledTypeRepr = /// An AbstractIL type representation that is just the name of a type. /// @@ -5356,9 +5441,16 @@ let ccuOfTyconRef eref = // Type parameters and inference unknowns //------------------------------------------------------------------------- -let mkTyparTy (tp: Typar) = + +let NewNullnessVar() = Nullness.Variable (NullnessVar()) // we don't known (and if we never find out then it's non-null) + +let KnownAmbivalentToNull = Nullness.Known NullnessInfo.AmbivalentToNull +let KnownWithNull = Nullness.Known NullnessInfo.WithNull +let KnownWithoutNull = Nullness.Known NullnessInfo.WithoutNull + +let mkTyparTy (tp:Typar) = match tp.Kind with - | TyparKind.Type -> tp.AsType + | TyparKind.Type -> tp.AsType KnownWithoutNull // TODO NULLNESS: check various callers | TyparKind.Measure -> TType_measure (Measure.Var tp) let copyTypar (tp: Typar) = @@ -5398,9 +5490,49 @@ let rec stripUnitEqnsAux canShortcut unt = | Measure.Var r when r.IsSolved -> stripUnitEqnsAux canShortcut (tryShortcutSolvedUnitPar canShortcut r) | _ -> unt -let rec stripTyparEqnsAux canShortcut ty = +let combineNullness (nullnessOrig: Nullness) (nullnessNew: Nullness) = + match nullnessOrig.Evaluate() with + | NullnessInfo.WithoutNull -> nullnessNew + | NullnessInfo.AmbivalentToNull -> nullnessOrig + | NullnessInfo.WithNull -> + match nullnessNew.Evaluate() with + | NullnessInfo.WithoutNull -> nullnessOrig + | NullnessInfo.AmbivalentToNull -> nullnessNew + | NullnessInfo.WithNull -> nullnessOrig + +let tryAddNullnessToTy nullnessNew (ty:TType) = + match ty with + | TType_var (tp, nullnessOrig) -> + // TODO NULLNESS: make this avoid allocation if no change + Some (TType_var (tp, combineNullness nullnessOrig nullnessNew)) + | TType_app (tcr, tinst, nullnessOrig) -> + // TODO NULLNESS: make this avoid allocation if no change + Some (TType_app (tcr, tinst, combineNullness nullnessOrig nullnessNew)) + | TType_ucase _ -> None // TODO NULLNESS + | TType_tuple _ -> None // TODO NULLNESS + | TType_anon _ -> None // TODO NULLNESS + | TType_fun (d, r, nullnessOrig) -> + // TODO NULLNESS: make this avoid allocation if no change + Some (TType_fun (d, r, combineNullness nullnessOrig nullnessNew)) + | TType_forall _ -> None + | TType_measure _ -> None + +let addNullnessToTy (nullness: Nullness) (ty:TType) = + match nullness.Evaluate() with + | NullnessInfo.WithoutNull -> ty + | _ -> + match ty with + | TType_var (tp, nullnessOrig) -> TType_var (tp, combineNullness nullnessOrig nullness) + | TType_app (tcr, tinst, nullnessOrig) -> TType_app (tcr, tinst, combineNullness nullnessOrig nullness) + | TType_fun (d, r, nullnessOrig) -> TType_fun (d, r, combineNullness nullnessOrig nullness) + //| TType_ucase _ -> None // TODO NULLNESS + //| TType_tuple _ -> None // TODO NULLNESS + //| TType_anon _ -> None // TODO NULLNESS + | _ -> ty + +let rec stripTyparEqnsAux nullness0 canShortcut ty = match ty with - | TType_var r -> + | TType_var (r, nullness) -> match r.Solution with | Some soln -> if canShortcut then @@ -5409,22 +5541,36 @@ let rec stripTyparEqnsAux canShortcut ty = // This is only because IterType likes to walk _all_ the constraints _everywhere_ in a type, including // those attached to _solved_ type variables. In an ideal world this would never be needed - see the notes // on IterType. - | TType_var r2 when r2.Constraints.IsEmpty -> - match r2.Solution with - | None -> () - | Some _ as soln2 -> - r.typar_solution <- soln2 + | TType_var (r2, nullness2) when r2.Constraints.IsEmpty -> + match nullness2.Evaluate() with + | NullnessInfo.WithoutNull -> + match r2.Solution with + | None -> () + | Some _ as soln2 -> + r.typar_solution <- soln2 + | _ -> () | _ -> () - stripTyparEqnsAux canShortcut soln + stripTyparEqnsAux (combineNullness nullness0 nullness) canShortcut soln | None -> - ty + addNullnessToTy nullness0 ty | TType_measure unt -> TType_measure (stripUnitEqnsAux canShortcut unt) | _ -> ty -let stripTyparEqns ty = stripTyparEqnsAux false ty +let stripTyparEqns ty = stripTyparEqnsAux KnownWithoutNull false ty let stripUnitEqns unt = stripUnitEqnsAux false unt +let replaceNullnessOfTy nullness (ty:TType) = + match stripTyparEqns ty with + | TType_var (tp, _nullnessOrig) -> TType_var (tp, nullness) + | TType_app (tcr, tinst, _nullnessOrig) -> TType_app (tcr, tinst, nullness) + | TType_fun (d, r, _nullnessOrig) -> TType_fun (d, r, nullness) + //| TType_ucase _ -> None // TODO NULLNESS + //| TType_tuple _ -> None // TODOTODO NULLNESS + //| TType_anon _ -> None // TODO NULLNESS + | sty -> sty + + //--------------------------------------------------------------------------- // These make local/non-local references to values according to whether // the item is globally stable ("published") or not. @@ -5895,5 +6041,5 @@ let FSharpSignatureDataResourceName = "FSharpSignatureData." let FSharpOptimizationDataResourceName2 = "FSharpOptimizationInfo." let FSharpSignatureDataResourceName2 = "FSharpSignatureInfo." - - +let FSharpOptimizationDataResourceNameB = "FSharpOptimizationDataB." +let FSharpSignatureDataResourceNameB = "FSharpSignatureDataB." diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 23ea06f75a8..74838d22bb7 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -7067,6 +7067,11 @@ pole anonymního záznamu + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. Výjimka {0} nemá žádné pole s názvem {1}. @@ -7082,6 +7087,31 @@ Konstruktor nemá žádné pole s názvem {0}. + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' Dva typy anonymních záznamů jsou z různých sestavení: {0} a {1}. @@ -7127,6 +7157,36 @@ Vstupem výrazu pro kopírování a aktualizaci, který vytvoří anonymní záznam, musí být anonymní záznam nebo záznam. + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. Parametr {0} má neplatný typ {1}. To nepovolují pravidla Common IL. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 7c13cf3c311..85d42e27dd9 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -7067,6 +7067,11 @@ Feld für anonyme Datensätze + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. Die Ausnahme "{0}" enthält kein Feld namens "{1}". @@ -7082,6 +7087,31 @@ Der Konstruktor hat kein Feld namens "{0}". + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' Zwei anonyme Datensatztypen stammen aus verschiedenen Assemblys: "{0}" und "{1}". @@ -7127,6 +7157,36 @@ Die Eingabe in einen Ausdruck für das Kopieren und Aktualisieren, der einen anonymen Datensatz erstellt, muss entweder ein anonymer Datensatz oder ein Datensatz sein. + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. Der Parameter "{0}" weist einen ungültigen Typ "{1}" auf. Dies ist gemäß den Regeln von Common IL unzulässig. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index f3c85065ce9..89fbd7679f4 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -7067,6 +7067,11 @@ campo de registro anónimo + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. La excepción "{0}" no tiene un campo denominado "{1}". @@ -7082,6 +7087,31 @@ El constructor no tiene un campo denominado "{0}". + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' Dos tipos de registro anónimos provienen de diferentes ensamblados "{0}" y "{1}" @@ -7127,6 +7157,36 @@ La entrada a una expresión de copia y actualización que crea un registro anónimo debe ser un registro anónimo o un registro + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. El parámetro "{0}" tiene un tipo no válido "{1}". Esto no está permitido por las reglas de Common IL. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index f7a5bc43329..edcd633a1a0 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -7067,6 +7067,11 @@ champ d'enregistrement anonyme + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. L'exception '{0}' n'a pas pas de champ nommé '{1}'. @@ -7082,6 +7087,31 @@ Le constructeur n'a pas de champ nommé '{0}'. + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' Deux types d'enregistrement anonyme proviennent d'assemblys différents '{0}' et '{1}' @@ -7127,6 +7157,36 @@ L'entrée d'une expression de copie et mise à jour qui crée un enregistrement anonyme doit être un enregistrement anonyme ou un enregistrement + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. Le paramètre « {0} » a un type non valide (« {1} »), ce qui n'est pas autorisé par les règles de Common IL. diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 8e4eccbd9cd..66f97dd8b44 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -7067,6 +7067,11 @@ campo del record anonimo + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. L'eccezione '{0}' non include un campo denominato '{1}'. @@ -7082,6 +7087,31 @@ Il costruttore non include un campo denominato '{0}'. + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' Due tipi di record anonimo provengono da assembly diversi, '{0}' e '{1}' @@ -7127,6 +7157,36 @@ Il valore di input di un'espressione di copia e aggiornamento che crea un record anonimo deve essere un record anonimo o un record + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. Il parametro '{0}' contiene un tipo non valido '{1}'. Questo comportamento non è consentito dalle regole di Common IL. diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index b49ebd63d94..ae94612f0eb 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -7069,6 +7069,11 @@ 匿名レコード フィールド + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. 例外 '{0}' には '{1}' という名前のフィールドはありません。 @@ -7084,6 +7089,31 @@ コンストラクターには '{0}' という名前のフィールドはありません + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' 2 つの匿名レコードの種類は、'{0}' と '{1}' の異なるアセンブリからのものです @@ -7129,6 +7159,36 @@ 匿名レコードを作成する copy-and-update 式への入力には匿名レコードまたはレコードを 1 つ含める必要があります + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. パラメーター '{0}' には無効な型 '{1}' が指定されています。これは Common IL の規則では許可されていません。 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 4f106b57958..03abc0f1dd9 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -7067,6 +7067,11 @@ 무명 레코드 필드 + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. '{0}' 예외에 '{1}'(이)라는 필드가 없습니다. @@ -7082,6 +7087,31 @@ 생성자에 '{0}'(이)라는 필드가 없습니다. + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' 두 무명 레코드 형식은 서로 다른 어셈블리 '{0}' 및 '{1}'에서 가져왔습니다. @@ -7127,6 +7157,36 @@ 무명 레코드를 만드는 복사 및 업데이트 식의 입력은 무명 레코드이거나 레코드여야 합니다. + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. '{0}' 매개 변수에 잘못된 형식 '{1}'이(가) 있습니다. 이 형식은 공통 IL의 규칙에서 허용하지 않습니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 15ac9b912c6..ed1d19c9b03 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -7067,6 +7067,11 @@ pole rekordu anonimowego + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. Wyjątek „{0}” nie ma pola o nazwie „{1}”. @@ -7082,6 +7087,31 @@ Konstruktor nie ma pola o nazwie „{0}”. + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' Dwa typy rekordów anonimowych pochodzą z różnych zestawów: „{0}” i „{1}” @@ -7127,6 +7157,36 @@ Dane wejściowe wyrażenia kopiowania i aktualizowania, które tworzy rekord anonimowy, muszą być rekordem lub rekordem anonimowym + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. Parametr „{0}” ma nieprawidłowy typ „{1}”. Nie jest to dozwolone przez reguły języka Common IL. diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 1d50b7356cf..d5c6c6ffb5d 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -7067,6 +7067,11 @@ campo de registro anônimo + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. A exceção '{0}' não tem um campo nomeado '{1}'. @@ -7082,6 +7087,31 @@ O construtor não tem um campo nomeado '{0}'. + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' Dois tipos de registro anônimos são de diferentes assemblies '{0}' e '{1}' @@ -7127,6 +7157,36 @@ A entrada para uma expressão de copiar-e-atualizar que cria um registro anônimo deve ser um registro ou um registro anônimo + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. O parâmetro '{0}' tem um tipo inválido '{1}'. Isso não é permitido pelas regras do IL comum. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 5e54c71aa4d..53b08c3fce3 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -7067,6 +7067,11 @@ поле анонимной записи + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. Исключение "{0}" не содержит поля с именем "{1}". @@ -7082,6 +7087,31 @@ Конструктор не содержит поля с именем '{0}'. + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' Два типа анонимных записей принадлежат различным сборкам '{0}' и '{1}' @@ -7127,6 +7157,36 @@ Входные данные для выражения копирования и обновления, создающего анонимную запись, должны представлять собой анонимную или обычную запись + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. Параметр "{0}" имеет недопустимый тип "{1}". Это не допускается правилами общего промежуточного языка. diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index c3f580ec6b4..ab0b3d20617 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -7067,6 +7067,11 @@ anonim kayıt alanı + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. '{0}' özel durumunun '{1}' adlı bir alanı yok. @@ -7082,6 +7087,31 @@ Oluşturucunun '{0}' adlı bir alanı yok. + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' İki anonim kayıt türü, birbirinden farklı olan '{0}' ve '{1}' derlemelerinden @@ -7127,6 +7157,36 @@ Anonim kayıt oluşturan bir copy-and-update ifadesinin girişi anonim bir kayıt ya da bir kayıt olmalıdır + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. '{0}' parametresi geçersiz '{1}' türünde. Ortak IL kuralları uyarınca buna izin verilmez. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index 99e41ca6b93..ebde4f86d6d 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -7067,6 +7067,11 @@ 匿名记录字段 + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. 异常“{0}”没有名为“{1}”的字段。 @@ -7082,6 +7087,31 @@ 构造函数没有名为“{0}”的字段。 + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' 两个匿名记录类型来自不同的程序集“{0}”和“{1}” @@ -7127,6 +7157,36 @@ 创建匿名记录的“复制和更新”表达式的输入必须是匿名记录或记录 + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. 参数 "{0}" 的类型 "{1}" 无效。通用 IL 的规则不允许使用此类型。 diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 70b7a400f45..a8a2013dbf7 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -7067,6 +7067,11 @@ 匿名記錄欄位 + + The type '{0}' does not support a nullness qualitification. + The type '{0}' does not support a nullness qualitification. + + The exception '{0}' does not have a field named '{1}'. 例外狀況 '{0}' 沒有名為 '{1}' 的欄位。 @@ -7082,6 +7087,31 @@ 建構函式沒有名為 '{0}' 的欄位。 + + Enable nullness declarations and checks + Enable nullness declarations and checks + + + + The /checknulls language feature is not enabled + The /checknulls language feature is not enabled + + + + Specify the language version + Specify the language version + + + + The type '{0}' has 'null' as an extra value but a constraint does not permit this + The type '{0}' has 'null' as an extra value but a constraint does not permit this + + + + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + The type '{0}' has 'null' as a true representation value but a constraint does not permit this + + Two anonymous record types are from different assemblies '{0}' and '{1}' 有兩個匿名的記錄類型來自不同的組件 '{0}' 和 '{1}' @@ -7127,6 +7157,36 @@ 對於會建立匿名記錄的複製並更新運算式,必須輸入匿名記錄或記錄 + + This language feature is not enabled, use /langversion:5.0 or greater to enable it + This language feature is not enabled, use /langversion:5.0 or greater to enable it + + + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + + + The constraints 'delegate' and 'comparison' are inconsistent + The constraints 'delegate' and 'comparison' are inconsistent + + + + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + Nullness warning. The default constructor of a struct type is required but one of the fields of struct type is non-nullable. + + + + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + Nullness warning. The 'DefaultValue' attribute is used but the type (or one of its fields if a struct) is non-nullable. + + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. 參數 '{0}' 的類型 '{1}' 無效。Common IL 的規則不允許此狀況。 diff --git a/src/fsharp/xlf/FSStrings.cs.xlf b/src/fsharp/xlf/FSStrings.cs.xlf index e75473b43c4..f0819397c17 100644 --- a/src/fsharp/xlf/FSStrings.cs.xlf +++ b/src/fsharp/xlf/FSStrings.cs.xlf @@ -1627,6 +1627,26 @@ symbol |} + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.de.xlf b/src/fsharp/xlf/FSStrings.de.xlf index 7e39e99b0a7..6d16284e685 100644 --- a/src/fsharp/xlf/FSStrings.de.xlf +++ b/src/fsharp/xlf/FSStrings.de.xlf @@ -1627,6 +1627,26 @@ Symbol "|}" + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.es.xlf b/src/fsharp/xlf/FSStrings.es.xlf index 0c4041f9b9d..fcfbc5f1698 100644 --- a/src/fsharp/xlf/FSStrings.es.xlf +++ b/src/fsharp/xlf/FSStrings.es.xlf @@ -1627,6 +1627,26 @@ símbolo "|}" + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.fr.xlf b/src/fsharp/xlf/FSStrings.fr.xlf index 76dacd3c0fc..1f178cab924 100644 --- a/src/fsharp/xlf/FSStrings.fr.xlf +++ b/src/fsharp/xlf/FSStrings.fr.xlf @@ -1627,6 +1627,26 @@ symbole '|}' + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.it.xlf b/src/fsharp/xlf/FSStrings.it.xlf index 11890ea9243..7cdc460d097 100644 --- a/src/fsharp/xlf/FSStrings.it.xlf +++ b/src/fsharp/xlf/FSStrings.it.xlf @@ -1627,6 +1627,26 @@ simbolo '|}' + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.ja.xlf b/src/fsharp/xlf/FSStrings.ja.xlf index eb91f5fb4fc..57dfe497608 100644 --- a/src/fsharp/xlf/FSStrings.ja.xlf +++ b/src/fsharp/xlf/FSStrings.ja.xlf @@ -1627,6 +1627,26 @@ シンボル '|}' + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.ko.xlf b/src/fsharp/xlf/FSStrings.ko.xlf index f99c95b5242..a4af775893d 100644 --- a/src/fsharp/xlf/FSStrings.ko.xlf +++ b/src/fsharp/xlf/FSStrings.ko.xlf @@ -1627,6 +1627,26 @@ 기호 '|}' + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.pl.xlf b/src/fsharp/xlf/FSStrings.pl.xlf index 346dc962602..d0fefafaec1 100644 --- a/src/fsharp/xlf/FSStrings.pl.xlf +++ b/src/fsharp/xlf/FSStrings.pl.xlf @@ -1627,6 +1627,26 @@ symbol „|}” + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.pt-BR.xlf b/src/fsharp/xlf/FSStrings.pt-BR.xlf index 3c2a5f22963..32ca85f5275 100644 --- a/src/fsharp/xlf/FSStrings.pt-BR.xlf +++ b/src/fsharp/xlf/FSStrings.pt-BR.xlf @@ -1627,6 +1627,26 @@ símbolo '|}' + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.ru.xlf b/src/fsharp/xlf/FSStrings.ru.xlf index cd7d4e5e29c..9717bceff53 100644 --- a/src/fsharp/xlf/FSStrings.ru.xlf +++ b/src/fsharp/xlf/FSStrings.ru.xlf @@ -1627,6 +1627,26 @@ Обозначение '|}' + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.tr.xlf b/src/fsharp/xlf/FSStrings.tr.xlf index f4cba2f1216..c93f3e27324 100644 --- a/src/fsharp/xlf/FSStrings.tr.xlf +++ b/src/fsharp/xlf/FSStrings.tr.xlf @@ -1627,6 +1627,26 @@ sembol '|}' + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.zh-Hans.xlf b/src/fsharp/xlf/FSStrings.zh-Hans.xlf index 506c6ad1150..6adb7fbb130 100644 --- a/src/fsharp/xlf/FSStrings.zh-Hans.xlf +++ b/src/fsharp/xlf/FSStrings.zh-Hans.xlf @@ -1627,6 +1627,26 @@ 符号 "|}" + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSStrings.zh-Hant.xlf b/src/fsharp/xlf/FSStrings.zh-Hant.xlf index c895858a67f..52128f93ecc 100644 --- a/src/fsharp/xlf/FSStrings.zh-Hant.xlf +++ b/src/fsharp/xlf/FSStrings.zh-Hant.xlf @@ -1627,6 +1627,26 @@ 符號 '|}' + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability '{2}' and '{3}'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability '{2}' and '{3}'. + + + + Nullness warning: The type '{0}' does not support nullness. + Nullness warning: The type '{0}' does not support nullness. + + + + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + Nullness warning: The type '{0}' supports a null value but a constraint requires the type to be non-null. + + \ No newline at end of file diff --git a/src/scripts/scriptlib.fsx b/src/scripts/scriptlib.fsx index f5f9276c492..ce9ac2e3cc8 100644 --- a/src/scripts/scriptlib.fsx +++ b/src/scripts/scriptlib.fsx @@ -108,12 +108,8 @@ module Scripting = processInfo.UseShellExecute <- false processInfo.WorkingDirectory <- workDir -#if !NET46 - ignore envs // work out what to do about this -#else envs |> Map.iter (fun k v -> processInfo.EnvironmentVariables.[k] <- v) -#endif let p = new Process() p.EnableRaisingEvents <- true diff --git a/src/utils/CompilerLocationUtils.fs b/src/utils/CompilerLocationUtils.fs index 84a0dfbfd4b..11b85bae7de 100644 --- a/src/utils/CompilerLocationUtils.fs +++ b/src/utils/CompilerLocationUtils.fs @@ -105,8 +105,11 @@ module internal FSharpEnvironment = let mutable uType = REG_SZ; let mutable cbData = maxDataLength; +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE let res = RegQueryValueExW(hkey, null, 0u, &uType, pathResult, &cbData); - +#else + let res = RegQueryValueExW(hkey, nonNull null, 0u, &uType, pathResult, &cbData); // TODO use of nonNull should not be required +#endif if (res = 0u && cbData > 0 && cbData <= maxDataLength) then Marshal.PtrToStringUni(pathResult, (cbData - 2)/2); else diff --git a/src/utils/reshapedmsbuild.fs b/src/utils/reshapedmsbuild.fs index 75859f44765..34da14cade2 100644 --- a/src/utils/reshapedmsbuild.fs +++ b/src/utils/reshapedmsbuild.fs @@ -367,7 +367,11 @@ module internal ToolLocationHelper = // } // Doesn't need to be virtual @@@@@ +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE abstract member GetPathToDotNetFramework: DotNetFrameworkArchitecture -> string +#else + abstract member GetPathToDotNetFramework: DotNetFrameworkArchitecture -> string? +#endif default this.GetPathToDotNetFramework arch = match this.pathsToDotNetFramework.TryGetValue arch with | true, x -> x diff --git a/src/utils/reshapedreflection.fs b/src/utils/reshapedreflection.fs index 0b143951dda..e0022e35e30 100644 --- a/src/utils/reshapedreflection.fs +++ b/src/utils/reshapedreflection.fs @@ -43,7 +43,13 @@ module internal ReflectionAdapters = let publicFlags = BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static - let commit (results : _[]) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let inline (|NonNull|) x = match x with null -> raise (NullReferenceException()) | v -> v + + let commit<'T when 'T : null> (results : 'T[]) : 'T = +#else + let commit<'T when 'T : not null> (results : 'T[]) : 'T? = +#endif match results with | [||] -> null | [| m |] -> m @@ -53,11 +59,22 @@ module internal ReflectionAdapters = (not (isNull (box accessor))) && (accessor.IsPublic || nonPublic) type System.Type with + member this.GetTypeInfo() = IntrospectionExtensions.GetTypeInfo(this) + member this.GetRuntimeProperties() = RuntimeReflectionExtensions.GetRuntimeProperties(this) + member this.GetRuntimeEvents() = RuntimeReflectionExtensions.GetRuntimeEvents(this) + member this.Attributes = this.GetTypeInfo().Attributes - member this.GetCustomAttributes(attrTy, inherits) : obj[] = downcast box(CustomAttributeExtensions.GetCustomAttributes(this.GetTypeInfo(), attrTy, inherits) |> Seq.toArray) + +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + member this.GetCustomAttributes(attrTy, inherits) : obj[] = +#else + member this.GetCustomAttributes(attrTy, inherits) : obj[]? = +#endif + unbox(box(CustomAttributeExtensions.GetCustomAttributes(this.GetTypeInfo(), attrTy, inherits) |> Seq.toArray)) + member this.GetNestedType (name, bindingFlags) = // MSDN: http://msdn.microsoft.com/en-us/library/0dcb3ad5.aspx // The following BindingFlags filter flags can be used to define which nested types to include in the search: @@ -76,8 +93,13 @@ module internal ReflectionAdapters = ) |> Option.map (fun ti -> ti.AsType()) defaultArg nestedTyOpt null + // use different sources based on Declared flag - member this.GetMethods(bindingFlags) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + member this.GetMethods(bindingFlags) : MethodInfo[] = +#else + member this.GetMethods(bindingFlags) : MethodInfo[]? = +#endif (if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredMethods else this.GetRuntimeMethods()) |> Seq.filter (fun m -> isAcceptable bindingFlags m.IsStatic m.IsPublic) |> Seq.toArray @@ -113,33 +135,45 @@ module internal ReflectionAdapters = let bindingFlags = defaultArg bindingFlags publicFlags this.GetEvents(bindingFlags) |> Array.filter (fun ei -> ei.Name = name) - |> commit + |> commit member this.GetConstructor(bindingFlags, _binder, argsT:Type[], _parameterModifiers) = this.GetConstructor(bindingFlags,argsT) - member this.GetMethod(name, ?bindingFlags) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + member this.GetMethod(name, ?bindingFlags) : MethodInfo = +#else + member this.GetMethod(name, ?bindingFlags) : MethodInfo? = +#endif let bindingFlags = defaultArg bindingFlags publicFlags this.GetMethods(bindingFlags) |> Array.filter(fun m -> m.Name = name) - |> commit + |> commit member this.GetMethod(name, _bindingFlags, _binder, argsT:Type[], _parameterModifiers) = this.GetMethod(name, argsT) // use different sources based on Declared flag - member this.GetProperty(name, bindingFlags) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + member this.GetProperty(name, bindingFlags) : PropertyInfo = +#else + member this.GetProperty(name, bindingFlags) : PropertyInfo? = +#endif this.GetProperties(bindingFlags) |> Array.filter (fun pi -> pi.Name = name) - |> commit + |> commit - member this.GetMethod(methodName, args:Type[], ?bindingFlags) = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + member this.GetMethod(methodName, args:Type[], ?bindingFlags) : MethodInfo = +#else + member this.GetMethod(methodName, args:Type[], ?bindingFlags) : MethodInfo? = +#endif let bindingFlags = defaultArg bindingFlags publicFlags let compareSequences parms args = Seq.compareWith (fun parm arg -> if parm <> arg then 1 else 0) parms args this.GetMethods(bindingFlags) |> Array.filter(fun m -> m.Name = methodName && (compareSequences (m.GetParameters() |> Seq.map(fun x -> x.ParameterType)) args) = 0) - |> commit + |> commit member this.GetNestedTypes(?bindingFlags) = let bindingFlags = defaultArg bindingFlags publicFlags @@ -193,7 +227,7 @@ module internal ReflectionAdapters = ) ) |> Seq.toArray - |> commit + |> commit member this.GetConstructor(parameterTypes : Type[]) = this.GetConstructor(BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Instance, parameterTypes) @@ -219,7 +253,7 @@ module internal ReflectionAdapters = member this.GetField(name, bindingFlags) = this.GetFields(bindingFlags) |> Array.filter (fun fi -> fi.Name = name) - |> commit + |> commit member this.GetField(name) = RuntimeReflectionExtensions.GetRuntimeField(this, name) @@ -234,7 +268,7 @@ module internal ReflectionAdapters = (parameterTypes, parameters) ||> Array.forall2 (fun ty pi -> pi.ParameterType.Equals ty) ) ) - |> commit + |> commit static member GetTypeCode(ty : Type) = if typeof.Equals ty then TypeCode.Int32 @@ -351,10 +385,14 @@ module internal ReflectionAdapters = type System.Object with member this.GetPropertyValue(propName) = - this.GetType().GetProperty(propName, BindingFlags.Public).GetValue(this, null) + match this.GetType().GetProperty(propName, BindingFlags.Public) with + | null -> failwith "GetPropertyValue" + | NonNull p -> p.GetValue(this, null) member this.SetPropertyValue(propName, propValue) = - this.GetType().GetProperty(propName, BindingFlags.Public).SetValue(this, propValue, null) + match this.GetType().GetProperty(propName, BindingFlags.Public) with + | null -> failwith "SetPropertyValue" + | NonNull p -> p.SetValue(this, propValue, null) member this.GetMethod(methodName, argTypes) = this.GetType().GetMethod(methodName, argTypes, BindingFlags.Public) @@ -368,7 +406,7 @@ module internal ReflectionAdapters = let s = this.FullyQualifiedName s.GetHashCode() -#if COMPILER // This part includes global state in globalLoadContext. Only include this support "once", i.e. when compiling FSharp.Compiler.Private.dll, FSharp.Compiler.Service.dll, fsc-proto.exe +#if COMPILER // This part includes global state in globalLoadContext. Only include this support "once", i.e. when compiling FSharp.Compiler.Private.dll, FSharp.Compiler.Service.dll type CustomAssemblyResolver() = inherit System.Runtime.Loader.AssemblyLoadContext() diff --git a/src/utils/sformat.fs b/src/utils/sformat.fs index b490283f674..26bbd473efa 100644 --- a/src/utils/sformat.fs +++ b/src/utils/sformat.fs @@ -118,6 +118,11 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl abstract MaxRows : int module TaggedTextOps = +#if BUILDING_WITH_LKG || BUILD_FROM_SOURCE + let inline (|NonNull|) x = match x with null -> raise (NullReferenceException()) | v -> v + let inline nonNull<'T> (x: 'T) = x +#endif + let tag tag text = { new TaggedText with member x.Tag = tag @@ -466,7 +471,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // analysis of null values. let GetValueInfo bindingFlags (x : 'a, ty : Type) (* x could be null *) = - let obj = (box x) + let obj = box x match obj with | null -> let isNullaryUnion = @@ -802,11 +807,12 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl let getProperty (ty: Type) (obj: obj) name = #if FX_RESHAPED_REFLECTION let prop = ty.GetProperty(name, (BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic)) - if not (isNull prop) then prop.GetValue(obj,[||]) - // Others raise MissingMethodException - else + match prop with + | null -> let msg = System.String.Concat([| "Method '"; ty.FullName; "."; name; "' not found." |]) raise (System.MissingMethodException(msg)) + | NonNull prop -> + prop.GetValue(obj,[||]) #else ty.InvokeMember(name, (BindingFlags.GetProperty ||| BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic), null, obj, [| |],CultureInfo.InvariantCulture) #endif @@ -910,10 +916,10 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // Try the StructuredFormatDisplayAttribute extensibility attribute match ty.GetCustomAttributes (typeof, true) with | null | [| |] -> None - | res -> + | NonNull res -> let attr = (res.[0] :?> StructuredFormatDisplayAttribute) let txt = attr.Value - if isNull txt || txt.Length <= 1 then + if isNull (box txt) || txt.Length <= 1 then None else let messageRegexPattern = @"^(?
.*?)(?.*?)(?.*)$"
diff --git a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs
index 45974519909..634f29228b7 100644
--- a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs
+++ b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs
@@ -149,7 +149,6 @@ namespace ProviderImplementation.ProvidedTypes
         /// Internal code of .NET expects the obj[] returned by GetCustomAttributes to be an Attribute[] even in the case of empty arrays
         let emptyAttributes = (([| |]: Attribute[]) |> box |> unbox)
 
-        let nonNull str x = if isNull x then failwithf "Null in '%s', stacktrace = '%s'" str Environment.StackTrace else x
         let nonNone str x = match x with None -> failwithf "No value has been specified for '%s', stacktrace = '%s'" str Environment.StackTrace | Some v -> v
         let patchOption v f = match v with None -> f() | Some _ -> failwithf "Already patched, stacktrace = '%s'" Environment.StackTrace 
 
diff --git a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs
index 84d05f43e32..4739f6975ed 100644
--- a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs
+++ b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs
@@ -93,21 +93,21 @@ module TypeProviderDesignTimeComponentLoading =
     let ``check tooling paths for type provider design time component loading`` () =
         let expected =
           [
-#if NET472 // only available on net472
-            Path.Combine("typeproviders", "fsharp41", "net461")
-            Path.Combine("tools", "fsharp41", "net461")
-            Path.Combine("typeproviders", "fsharp41", "net452")
-            Path.Combine("tools", "fsharp41", "net452")
-            Path.Combine("typeproviders", "fsharp41", "net451")
-            Path.Combine("tools", "fsharp41", "net451")
-            Path.Combine("typeproviders", "fsharp41", "net45")
-            Path.Combine("tools", "fsharp41", "net45")
-#else // only available on netcoreapp2.0
-            Path.Combine("typeproviders", "fsharp41", "netcoreapp2.0")
-            Path.Combine("tools", "fsharp41", "netcoreapp2.0")
-#endif // available in both
-            Path.Combine("typeproviders", "fsharp41", "netstandard2.0")
-            Path.Combine("tools", "fsharp41", "netstandard2.0")
+#if NET472
+            // only searched when executing on .NET Framework
+            for tfm in ["net471"; "net47"; "net462"; "net461"; "net452"; "net451"; "net45"] do
+                yield Path.Combine("typeproviders", "fsharp41", tfm)
+                yield Path.Combine("tools", "fsharp41", tfm)
+#else
+            // only searched when executing on .NET Core
+            for tfm in ["netcoreapp2.1"; "netcoreapp2.0"] do
+                yield Path.Combine("typeproviders", "fsharp41", tfm)
+                yield Path.Combine("tools", "fsharp41", tfm)
+#endif
+            // always searched
+            for tfm in ["netstandard2.0"] do
+                yield Path.Combine("typeproviders", "fsharp41", tfm)
+                yield Path.Combine("tools", "fsharp41", tfm)
           ]
         let actual = FSharp.Compiler.ExtensionTyping.toolingCompatiblePaths()
         printfn "actual = %A" actual
diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs
index 0434153fbb6..8b4eda351a5 100644
--- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs
+++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs
@@ -112,7 +112,7 @@ type BigIntType() =
 #endif
         
         // Null
-        Assert.IsFalse(a.Equals(null))
+        Assert.IsFalse(a.Equals(null:obj)) // TODO NULLNESS - this type annoation was needed to resolve overloading, even with /checknulls off
 
 #if CROSS_PLATFORM_COMPILER // see https://bugzilla.xamarin.com/show_bug.cgi?id=22591
 #else
diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs
index 3fb4395cd69..12f0ac5d7c1 100644
--- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs
+++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs
@@ -131,7 +131,7 @@ type OptionModule() =
     member this.OfToObj() =
         Assert.IsTrue( Option.toObj (Some "3") = "3")
         Assert.IsTrue( Option.toObj (Some "") = "")
-        Assert.IsTrue( Option.toObj (Some null) = null)
+        Assert.IsTrue( Option.toObj (Some null) = null) // TODO NULLNESS: this type annotation should not be needed 
         Assert.IsTrue( Option.toObj None = null)     
      
         Assert.IsTrue( Option.ofObj "3" = Some "3")
@@ -360,7 +360,7 @@ type ValueOptionTests() =
     member this.OfToObj() =
         Assert.IsTrue(ValueOption.toObj (ValueSome "3") = "3")
         Assert.IsTrue(ValueOption.toObj (ValueSome "") = "")
-        Assert.IsTrue(ValueOption.toObj (ValueSome null) = null)
+        Assert.IsTrue(ValueOption.toObj (ValueSome null) = null)  // TODO NULLNESS: this type annotation should not be needed
         Assert.IsTrue(ValueOption.toObj ValueNone = null)     
      
         Assert.IsTrue(ValueOption.ofObj "3" = ValueSome "3")
diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs
index 9de6db290bd..47258eb7a60 100644
--- a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs
+++ b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs
@@ -2675,6 +2675,20 @@ Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object)
 Microsoft.FSharp.Core.Operators: Boolean Equals(System.Object)
 Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T)
 Microsoft.FSharp.Core.Operators: Boolean Not(Boolean)
+Microsoft.FSharp.Core.Operators: Boolean IsNullV[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullMatchPattern[T](T)
+Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullValueMatchPattern[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: System.Nullable`1[T] NullV[T]()
+Microsoft.FSharp.Core.Operators: System.Nullable`1[T] WithNullV[T](T)
+Microsoft.FSharp.Core.Operators: T DefaultIfNone[T](T, Microsoft.FSharp.Core.FSharpOption`1[T])
+Microsoft.FSharp.Core.Operators: T DefaultIfNullV[T](T, System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: T DefaultIfNull[T](T, T)
+Microsoft.FSharp.Core.Operators: T NonNullPattern[T](T)
+Microsoft.FSharp.Core.Operators: T NonNullV[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: T NonNullValuePattern[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: T NonNull[T](T)
+Microsoft.FSharp.Core.Operators: T NullArgCheck[T](System.String, T)
+Microsoft.FSharp.Core.Operators: T WithNull[T](T)
 Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T)
 Microsoft.FSharp.Core.Operators: Boolean op_GreaterThanOrEqual[T](T, T)
 Microsoft.FSharp.Core.Operators: Boolean op_GreaterThan[T](T, T)
diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs
index 16035e67c02..b60143b8ac5 100644
--- a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs
+++ b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs
@@ -2678,6 +2678,20 @@ Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object)
 Microsoft.FSharp.Core.Operators: Boolean Equals(System.Object)
 Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T)
 Microsoft.FSharp.Core.Operators: Boolean Not(Boolean)
+Microsoft.FSharp.Core.Operators: Boolean IsNullV[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullMatchPattern[T](T)
+Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullValueMatchPattern[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: System.Nullable`1[T] NullV[T]()
+Microsoft.FSharp.Core.Operators: System.Nullable`1[T] WithNullV[T](T)
+Microsoft.FSharp.Core.Operators: T DefaultIfNone[T](T, Microsoft.FSharp.Core.FSharpOption`1[T])
+Microsoft.FSharp.Core.Operators: T DefaultIfNullV[T](T, System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: T DefaultIfNull[T](T, T)
+Microsoft.FSharp.Core.Operators: T NonNullPattern[T](T)
+Microsoft.FSharp.Core.Operators: T NonNullV[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: T NonNullValuePattern[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: T NonNull[T](T)
+Microsoft.FSharp.Core.Operators: T NullArgCheck[T](System.String, T)
+Microsoft.FSharp.Core.Operators: T WithNull[T](T)
 Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T)
 Microsoft.FSharp.Core.Operators: Boolean op_GreaterThanOrEqual[T](T, T)
 Microsoft.FSharp.Core.Operators: Boolean op_GreaterThan[T](T, T)
diff --git a/tests/fsharp/core/nullness/test.fsx b/tests/fsharp/core/nullness/test.fsx
new file mode 100644
index 00000000000..74f826baceb
--- /dev/null
+++ b/tests/fsharp/core/nullness/test.fsx
@@ -0,0 +1,412 @@
+#if TESTS_AS_APP
+module Core_nullness
+#endif
+
+#light
+
+let failures = ref []
+
+let report_failure (s : string) = 
+    stderr.Write" NO: "
+    stderr.WriteLine s
+    failures := !failures @ [s]
+
+let test (s : string) b = 
+    stderr.Write(s)
+    if b then stderr.WriteLine " OK"
+    else report_failure (s)
+
+let check s v1 v2 = test s (v1 = v2)
+
+open System
+open System.Runtime.CompilerServices
+
+//let f<'T when 'T : not struct> (x: 'T?) = 1
+
+module Basics = 
+    let x1 : string = null // ** Expected to give a Nullness warning
+    check "ekjnceoiwe1" x1 null
+    let x2 : string? = null // Should not give a Nullness warning
+    check "ekjnceoiwe2" x2 null
+    let x3 : string? = "a" // Should not give a Nullness warning
+    check "ekjnceoiwe3" x3 "a"
+    let x4 : string = "" // Should not give a Nullness warning
+    check "ekjnceoiwe4" x4 ""
+
+    let x5 = nonNull "" // Should not give a Nullness warning
+    check "ekjnceoiwe5" x5 ""
+    let x6 = nonNull "" // **Expected to give a Nullness warning, expected also to give a warning with nullness checking off
+    check "ekjnceoiwe6" x6 ""
+    let x7 = nonNull ""
+    check "ekjnceoiwe7" x7 ""
+    let _x7 : string = x7
+    let x8 = nonNull Array.empty
+    check "ekjnceoiwe8" x8 [| |]
+    let x9 = nonNull [| "" |]
+    check "ekjnceoiwe9" x9 [| "" |]
+    let x10 = nonNullV (Nullable(3))
+    check "ekjnceoiwe10" x10 3
+    let x11 = try nonNullV (Nullable()) with :? System.NullReferenceException -> 10
+    check "ekjnceoiwe11" x11 10
+    let x12 = nullV
+    check "ekjnceoiwe12" x12 (Nullable())
+    let x13 = nullV
+    check "ekjnceoiwe13" x13 (Nullable())
+    let x14 = withNullV 6L
+    check "ekjnceoiwe14" x14 (Nullable(6L))
+    let x15 : string? = withNull x4
+    check "ekjnceoiwe15" x15 ""
+    let x15a : string? = withNull ""
+    check "ekjnceoiwe15a" x15a ""
+    let x15b : string? = withNull x4
+    check "ekjnceoiwe15b" x15b ""
+    let x15c : string? = withNull x4 // **Expected to give a Nullness warning
+    check "ekjnceoiwe15c" x15c ""
+    let x16 : Nullable = withNullV 3
+    check "ekjnceoiwe16" x16 (Nullable(3))
+    
+    let y0 = isNull null // Should not give a Nullness warning (obj)
+    check "ekjnceoiwey0" y0 true
+    let y1 = isNull (null: obj?) // Should not give a Nullness warning
+    check "ekjnceoiwey1" y1 true
+    let y1b = isNull (null: string?) // Should not give a Nullness warning
+    check "ekjnceoiwey1b" y1b true
+    let y2 = isNull "" // **Expected to give a Nullness warning - type instantiation of a nullable type is non-nullable string
+    check "ekjnceoiwey2" y2 false
+    let y9 = isNull "" // **Expected to give a Nullness warning - type instantiation of a nullable type is non-nullable string
+    check "ekjnceoiwey9" y9 false
+    let y10 = isNull "" // Should not give a Nullness warning.
+    check "ekjnceoiwey10" y10 false
+
+module NotNullConstraint =
+    let f3 (x: 'T when 'T : not null) = 1
+    let v1 = f3 1 // Should not give an error
+    check "ekjnceoiwev1" v1 1
+    let v2 = f3 "a" // Should not give an error
+    check "ekjnceoiwev2" v2 1
+    let v3 = f3 (null: obj?) // Expect to give a warning
+    check "ekjnceoiwev3" v3 1
+    let v4 = f3 (null: string?) // Expect to give a warning
+    check "ekjnceoiwev4" v4 1
+#if NEGATIVE
+    f3 (Some 1) // Expect to give an error
+#endif
+
+    let w1 = 1 |> f3 // Should not give an error
+    check "ekjnceoiwew1" w1 1
+    let w2 = "a" |> f3 // Should not give an error
+    check "ekjnceoiwew2" w2 1
+    let w3 = (null: obj?) |> f3 // Expect to give a warning
+    check "ekjnceoiwew3" w3 1
+    let w4 = (null: string?) |> f3 // Expect to give a warning
+    check "ekjnceoiwew4" w4 1
+
+module MemberBasics = 
+    type C() = 
+        member x.P = 1
+        member x.M() = 2
+
+    let c : C? = C()
+    let v1 = c.P  // Expected to give a warning
+    check "ekjnccwwecv1" v1 1
+    let v2 = c.M()  // Expected to give a warning
+    check "ekjnccwwecv2" v2 2
+    let f1 = c.M  // Expected to give a warning
+    check "ekjnccwwecv3" (f1()) 2
+
+module Basics2 = 
+    let f1 () = null
+    // val f : unit -> 'a when 'a : null
+
+    let f2 () : string? = null
+    // val f : unit -> string?
+
+    let f3 () : 'T? = null
+
+    let f4 () : 'T? when 'T : not struct = null
+
+    let f5 () : 'T when 'T : not struct and 'T : null = null
+
+#if NEGATIVE
+    let f6 () : 'T? when 'T : not struct and 'T : null = null // Expected to give an error about inconistent constraints
+#endif
+
+    // Note yet allowed 
+    //let f7 () : 'T? when 'T : struct = null
+    let f7b () : Nullable<'T> = nullV // BUG: Incorrectly gives a warning about System.ValueType with /test:AssumeNullOnImport
+
+    let f8 () : string = null // Expected to give a Nullness warning
+
+type C(s: string) = 
+    member __.Value = s
+
+module InteropBasics =
+    let s0 = String.Concat("a","b") // Expected to infer string? with /test:AssumeNullOnImport
+    check "ekjnccberpos0" s0 "ab"
+    let s1 : string = String.Concat("a","c") // Expected to gives a warning with /test:AssumeNullOnImport
+    check "ekjnccberpos0" s1 "ac"
+    let test1()  = String.Concat("a","d")
+    check "ekjnccberpos0" (test1()) "ad"
+    let test2(s1:string, s2: string)  = String.Concat(s1,s2)
+    let test3()  = String( [| 'a' |] )
+    let test4()  = System.AppDomain.CurrentDomain
+    let test5 : System.AppDomain  = System.AppDomain.CurrentDomain // Expected to gives a warning with /test:AssumeNullOnImport
+
+type KonsoleWithNulls = 
+    static member WriteLine(s: string?) = Console.WriteLine(s)
+    static member WriteLine(fmt: string?, arg1: string?) = Console.WriteLine(fmt, arg1)
+    static member WriteLine(fmt: string?, [] args: obj?[]?) = Console.WriteLine(fmt, args)
+    static member WriteLineC(s: C?) = Console.WriteLine(s.Value)
+    static member WriteLineC(fmt: C?, arg1: C?) = Console.WriteLine(fmt.Value, arg1.Value)
+
+module KonsoleWithNullsModule = 
+    let WriteLine(s: string?) = Console.WriteLine(s)
+    let WriteLine2(fmt: string?, arg1: string?) = Console.WriteLine(fmt, arg1)
+    let WriteLineC(s: C?) = Console.WriteLine(s.Value)
+    let WriteLineC2(fmt: C?, arg1: C?) = Console.WriteLine(fmt.Value, arg1.Value)
+
+module KonsoleWithNullsModule2 = 
+    let WriteLine x = KonsoleWithNullsModule.WriteLine x
+    let WriteLine2 (fmt, arg1) = KonsoleWithNullsModule.WriteLine2(fmt, arg1)
+    let WriteLineC(s) = KonsoleWithNullsModule.WriteLineC(s)
+    let WriteLineC2(fmt, arg1) = KonsoleWithNullsModule.WriteLineC2(fmt, arg1)
+
+type KonsoleNoNulls = 
+    static member WriteLine(s: string) = Console.WriteLine(s)
+    static member WriteLine(fmt: string, arg1: string?) = Console.WriteLine(fmt, arg1)
+    static member WriteLine(fmt: string, [] args: obj[]) = Console.WriteLine(fmt, args)
+    static member WriteLineC(s: C) = Console.WriteLine(s.Value)
+    static member WriteLineC(fmt: C, arg1: C) = Console.WriteLine(fmt.Value, arg1.Value)
+
+module KonsoleNoNullsModule = 
+    let WriteLine(s: string) = Console.WriteLine(s)
+    let WriteLine2(fmt: string, arg1: string) = Console.WriteLine(fmt, arg1)
+    let WriteLineC(s: C) = Console.WriteLine(s.Value)
+    let WriteLineC2(fmt: C, arg1: C) = Console.WriteLine(fmt.Value, arg1.Value)
+
+module KonsoleNoNullsModule2 = 
+    let WriteLine x = KonsoleNoNullsModule.WriteLine x
+    let WriteLine2 (fmt, arg1) = KonsoleNoNullsModule.WriteLine2(fmt, arg1)
+    let WriteLineC(s) = KonsoleNoNullsModule.WriteLineC(s)
+    let WriteLineC2(fmt, arg1) = KonsoleNoNullsModule.WriteLineC2(fmt, arg1)
+
+System.Console.WriteLine("a")
+System.Console.WriteLine("a", (null: obj[])) // Expected to give a Nullness warning
+
+KonsoleWithNulls.WriteLine("Hello world")
+KonsoleWithNulls.WriteLine(null) // WRONG: gives an incorrect Nullness warning for string? and string?
+KonsoleWithNulls.WriteLine("Hello","world")
+KonsoleWithNulls.WriteLine("Hello","world","there") // // WRONG: gives an incorrect Nullness warning for string? and string?
+
+KonsoleNoNulls.WriteLine("Hello world")
+try 
+   KonsoleNoNulls.WriteLine(null)  // Expected to give a Nullness warning
+with :? System.ArgumentNullException -> ()
+KonsoleNoNulls.WriteLine("Hello","world")
+//KonsoleNoNulls.WriteLine("Hello",null) // CHECK ME 
+try 
+    KonsoleNoNulls.WriteLine(null, "World")   // Expected to give a Nullness warning
+with :? System.ArgumentNullException -> ()
+
+KonsoleWithNullsModule.WriteLine("Hello world")
+try 
+    KonsoleWithNullsModule.WriteLine(null) 
+with :? System.ArgumentNullException -> ()
+KonsoleWithNullsModule.WriteLine2("Hello","world") 
+KonsoleWithNullsModule.WriteLine2("Hello",null)
+try
+    KonsoleWithNullsModule.WriteLine2(null,"world")
+with :? System.ArgumentNullException -> ()
+
+KonsoleWithNullsModule2.WriteLine("Hello world")
+try 
+    KonsoleWithNullsModule2.WriteLine(null) 
+with :? System.ArgumentNullException -> ()
+KonsoleWithNullsModule2.WriteLine2("Hello","world")
+KonsoleWithNullsModule2.WriteLine2("Hello",null)
+try 
+    KonsoleWithNullsModule2.WriteLine2(null,"world")
+with :? System.ArgumentNullException -> ()
+
+KonsoleNoNullsModule.WriteLine("Hello world")
+try 
+    KonsoleNoNullsModule.WriteLine(null)  // Expected to give a Nullness warning
+with :? System.ArgumentNullException -> ()
+KonsoleNoNullsModule.WriteLine2("Hello","world")
+KonsoleNoNullsModule.WriteLine2("Hello",null) // Expected to give a Nullness warning
+try 
+    KonsoleNoNullsModule.WriteLine2(null,"world") // Expected to give a Nullness warning
+with :? System.ArgumentNullException -> ()
+
+//-------------------------------------
+
+// Param array cases
+
+KonsoleNoNulls.WriteLine("Hello","world","there")
+KonsoleWithNulls.WriteLine("Hello","world",null)  // Expected to give a Nullness warning 
+KonsoleNoNulls.WriteLine("Hello","world",null)  // Expected to give a Nullness warning
+System.Console.WriteLine("a", (null: obj[]?)) 
+System.Console.WriteLine("a", (null: obj?[]?))
+
+//-------
+// random stuff
+
+let f0 line = 
+    let add (s:string) = ()
+    match line with 
+    | null | "" -> ()
+    | _ -> add line // Exected to give a nullness warning
+
+let f0b line = 
+    let add (s:string) = ()
+    match line with 
+    | null  -> ()
+    | _ -> add (nonNull line) // Exected to give a nullness warning
+
+let add (s:string) = ()
+let f0c line = 
+    add (nonNull "") // WRONG: should not give a nullness warning
+
+let f1 (x: (string __hacknull)) = x;;
+
+//let f2 (x: string or null) = x;;
+let f3 (x: string?) = x
+let f5 x = (x: int)
+//let f4 x = (x: string nullable)
+
+//let f6<'T when 'T : not null> (x: 'T) = x
+//let f6<'T when 'T : not null> (x: 'T) = x
+
+//let f2 (x: string | null) = x;;
+
+//let f2 (_x : string | null) = x;;
+
+//let f2 (x: (string | null)) = x;;
+
+//let f3 x = (x: (string | null))
+
+module NullConstraintTests =
+    type C<'T when 'T : null>() = class end
+
+#if NEGATIVE
+    let f1 (y : C< (int * int) >) = y // This gave an error in F# 4.5 and we expect it to continue to give an error
+
+#endif
+
+#if !NO_CHECKNULLS
+     // This gave an error in F# 4.5.  It now only gives a warning when /checknulls is on which is sort of ok
+     // since we are treating .NET and F# types more symmetrically.
+     //
+     // TODO: However it gives no error or warning at all with /checknulls off in F# 5.0...  That seems bad.
+    let f2 (y : C) = y
+
+    let f3 (y : C) = y // Expect a Nullness warning
+
+    let f4 (y : C) = y // No warning expected 
+
+    let f5 (y : C) = y // No warning expected
+
+    let f6 (y : C?>) = y // No warning expected, lexing/parsing should succeed 
+
+    let f7 (y : C>?) = y // No warning expected, lexing/parsing should succeed
+#endif
+
+
+module DefaultValueTests =
+
+
+    module StructExamples = 
+        []
+        type C1 =
+            []
+            val mutable Whoops : string // expect a warning
+
+        []
+        type C2 =
+            []
+            val mutable Whoops : string // expect no warning
+
+        []
+        type C3 =
+            []
+            val mutable Whoops : string? // expect no warning
+
+#if NEGATIVE
+        []
+        type C4a =
+            []
+            val mutable Whoops : int list // expect a hard error like in F# 4.5
+#endif
+
+        []
+        type C4b =
+            []
+            val mutable Whoops : int list? // expect no warning
+
+#if NEGATIVE
+        []
+        type C5 =
+            []
+            val mutable Whoops : int * int // expect an error like F# 4.5
+
+        []
+        type C6 =
+            []
+            val mutable Whoops : int -> int // expect an error like F# 4.5
+#endif
+
+        []
+        type C7 =
+            []
+            val mutable Whoops : (int -> int)? // expect no warning
+
+    module ClassExamples = 
+        type C1 =
+            []
+            val mutable Whoops : string // expect a warning
+
+        type C2 =
+            []
+            val mutable Whoops : string // expect no warning
+
+        type C3 =
+            []
+            val mutable Whoops : string? // expect no warning
+
+        type C4a =
+            []
+            val mutable Whoops : int list // ** expect a warning
+
+        type C4b =
+            []
+            val mutable Whoops : int list? // expect no warning
+
+    #if NEGATIVE
+        type C5 =
+            []
+            val mutable Whoops : int * int // expect an error like F# 4.5
+
+        type C6 =
+            []
+            val mutable Whoops : int -> int // expect an error like F# 4.5
+    #endif
+
+        type C7 =
+            []
+            val mutable Whoops : (int -> int)? // expect no warning
+
+#if TESTS_AS_APP
+let RUN() = !failures
+#else
+let aa =
+  match !failures with 
+  | [] -> 
+      stdout.WriteLine "Test Passed"
+      System.IO.File.WriteAllText("test.ok","ok")
+      exit 0
+  | _ -> 
+      stdout.WriteLine "Test Failed"
+      exit 1
+#endif
+
+                    
\ No newline at end of file
diff --git a/tests/fsharp/core/syntax/test.fsx b/tests/fsharp/core/syntax/test.fsx
index e26783d7f31..5676a85e50d 100644
--- a/tests/fsharp/core/syntax/test.fsx
+++ b/tests/fsharp/core/syntax/test.fsx
@@ -31,8 +31,8 @@ test "line number test" (__LINE__ = "100")
 test "line number test" (__LINE__ = "102")
 test "line number test" (__SOURCE_FILE__ = "file.fs")
 
-# 29 "original-test-file.fs"
-test "line number test" (__LINE__ = "29")
+# 35 "original-test-file.fs"
+test "line number test" (__LINE__ = "35")
 test "line number test" (__SOURCE_FILE__ = "original-test-file.fs")
 
 
@@ -1441,7 +1441,7 @@ module TypeApplicationDisambiguation =
     let f8 x = xx
     let f9 x = xx
     let f10 x = xx
-    let f13 x = xx
+ //   let f13 x = xx
     let f14 x = xx
     let f16 x = x x>x
     let f17 x = xx
diff --git a/tests/fsharp/regression/literal-value-bug-1/test.il.bsl b/tests/fsharp/regression/literal-value-bug-1/test.il.bsl
index 86655b9a6e7..c2826dff865 100644
--- a/tests/fsharp/regression/literal-value-bug-1/test.il.bsl
+++ b/tests/fsharp/regression/literal-value-bug-1/test.il.bsl
@@ -31,11 +31,21 @@
   // Offset: 0x00000000 Length: 0x00000274
   // WARNING: managed resource file FSharpSignatureData.test created
 }
+.mresource public FSharpSignatureDataB.test
+{
+  // Offset: 0x00000000 Length: 0x00000274
+  // WARNING: managed resource file FSharpSignatureDataB.test created
+}
 .mresource public FSharpOptimizationData.test
 {
   // Offset: 0x00000278 Length: 0x0000006F
   // WARNING: managed resource file FSharpOptimizationData.test created
 }
+.mresource public FSharpOptimizationDataB.test
+{
+  // Offset: 0x00000278 Length: 0x0000006F
+  // WARNING: managed resource file FSharpOptimizationData.test created
+}
 .module test.exe
  // MVID: {5AA663EB-D9C1-2E4E-A745-0383EB63A65A}
 .imagebase 0x00400000
diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs
index 26b257d9449..85c8ba9d1d3 100644
--- a/tests/fsharp/single-test.fs
+++ b/tests/fsharp/single-test.fs
@@ -269,6 +269,7 @@ let singleTestBuildAndRunCore cfg copyFiles p =
                     let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG
                     emitFile projectFileName projectBody
                     use testOkFile = new FileGuard(Path.Combine(directory, "test.ok"))
+                    printfn "executeFsc: cfg.DotNetExe = %s" cfg.DotNetExe
                     exec { cfg with Directory = directory }  cfg.DotNetExe (sprintf "run -f %s" targetFramework)
                     testOkFile.CheckExists()
                 executeFsc compilerType targetFramework
@@ -279,6 +280,7 @@ let singleTestBuildAndRunCore cfg copyFiles p =
                     let projectBody = generateProjectArtifacts pc outputType  targetFramework cfg.BUILD_CONFIG
                     emitFile projectFileName projectBody
                     use testOkFile = new FileGuard(Path.Combine(directory, "test.ok"))
+                    printfn "executeFsi: cfg.DotNetExe = %s" cfg.DotNetExe
                     exec { cfg with Directory = directory }  cfg.DotNetExe "build /t:RunFSharpScript"
                     testOkFile.CheckExists()
                 executeFsi compilerType targetFramework
diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs
index e6ef7520a1c..e21a5143740 100644
--- a/tests/fsharp/tests.fs
+++ b/tests/fsharp/tests.fs
@@ -215,6 +215,69 @@ module CoreTests =
     []
     let ``test int32-FSI_BASIC`` () = singleTestBuildAndRun "core/int32" FSI_BASIC
 
+
+#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
+    []
+    let ``subtype-langversion-50-checknulls`` () =
+        let cfg = testConfig "core/subtype"
+
+        use testOkFile = fileguard cfg "test.ok"
+
+        fsc cfg "%s -o:test-checknulls.exe -g --langversion:5.0 --checknulls" cfg.fsc_flags ["test.fsx"]
+
+        exec cfg ("." ++ "test-checknulls.exe") ""
+
+        testOkFile.CheckExists()
+
+    []
+    let ``subtype-langversion-50-no-checknulls`` () =
+        let cfg = testConfig "core/subtype"
+
+        use testOkFile = fileguard cfg "test.ok"
+
+        fsc cfg "%s -o:test-no-checknulls.exe -g --langversion:5.0 --checknulls-" cfg.fsc_flags ["test.fsx"]
+
+        exec cfg ("." ++ "test-no-checknulls.exe") ""
+
+        testOkFile.CheckExists()
+
+    []
+    let ``subtype-langversion-45`` () =
+        let cfg = testConfig "core/subtype"
+
+        use testOkFile = fileguard cfg "test.ok"
+
+        fsc cfg "%s -o:test-langversion-45.exe -g --langversion:4.5" cfg.fsc_flags ["test.fsx"]
+
+        exec cfg ("." ++ "test-langversion-45.exe") ""
+
+        testOkFile.CheckExists()
+
+    []
+    let nullness_no_checknulls () =
+        let cfg = testConfig "core/nullness"
+
+        use testOkFile = fileguard cfg "test.ok"
+
+        fsc cfg "%s -o:test-no-checknulls.exe -g --define:NO_CHECKNULLS" cfg.fsc_flags ["test.fsx"]
+
+        exec cfg ("." ++ "test-no-checknulls.exe") ""
+
+        testOkFile.CheckExists()
+
+    []
+    let nullness_checknulls () =
+        let cfg = testConfig "core/nullness"
+
+        use testOkFile = fileguard cfg "test.ok"
+
+        fsc cfg "%s -o:test-checknulls.exe -g --checknulls" cfg.fsc_flags ["test.fsx"]
+
+        exec cfg ("." ++ "test-checknulls.exe") ""
+
+        testOkFile.CheckExists()
+#endif
+
     []
     let ``quotes-FSC-BASIC`` () = singleTestBuildAndRun "core/quotes" FSC_BASIC
 
@@ -1104,6 +1167,31 @@ module CoreTests =
     []
     let ``libtest-AS_DLL`` () = singleTestBuildAndRun "core/libtest" AS_DLL
 
+    []
+    let ``libtest-langversion-50-checknulls`` () =
+        let cfg = testConfig "core/libtest"
+
+        use testOkFile = fileguard cfg "test.ok"
+
+        fsc cfg "%s -o:test-checknulls.exe -g --langversion:5.0 --checknulls" cfg.fsc_flags ["test.fsx"]
+
+        exec cfg ("." ++ "test-checknulls.exe") ""
+
+        testOkFile.CheckExists()
+
+ 
+    []
+    let ``libtest-langversion-45`` () =
+        let cfg = testConfig "core/libtest"
+
+        use testOkFile = fileguard cfg "test.ok"
+
+        fsc cfg "%s -o:test-langversion-45.exe -g --langversion:4.5" cfg.fsc_flags ["test.fsx"]
+
+        exec cfg ("." ++ "test-langversion-45.exe") ""
+
+        testOkFile.CheckExists()
+
     []
     let ``no-warn-2003-tests`` () =
         // see https://github.com/Microsoft/visualfsharp/issues/3139
diff --git a/tests/fsharp/typecheck/sigs/neg04.bsl b/tests/fsharp/typecheck/sigs/neg04.bsl
index 058e3226a02..791b2cc2e61 100644
--- a/tests/fsharp/typecheck/sigs/neg04.bsl
+++ b/tests/fsharp/typecheck/sigs/neg04.bsl
@@ -31,7 +31,7 @@ neg04.fs(47,30,47,51): typecheck error FS0001: Type mismatch. Expecting a
     'seq<'a> -> 'f'    
 but given a
     ''g list -> 'h'    
-The type 'seq<'a>' does not match the type ''f list'
+The type ''a list' does not match the type 'seq<'b>'
 
 neg04.fs(47,49,47,51): typecheck error FS0784: This numeric literal requires that a module 'NumericLiteralN' defining functions FromZero, FromOne, FromInt32, FromInt64 and FromString be in scope
 
@@ -39,7 +39,7 @@ neg04.fs(47,30,47,51): typecheck error FS0001: Type mismatch. Expecting a
     'seq<'a> -> 'f'    
 but given a
     ''g list -> 'h'    
-The type 'seq<'a>' does not match the type ''f list'
+The type ''a list' does not match the type 'seq<'c>'
 
 neg04.fs(61,25,61,40): typecheck error FS0001: This expression was expected to have type
     'ClassType1'    
diff --git a/tests/fsharp/typecheck/sigs/neg20.bsl b/tests/fsharp/typecheck/sigs/neg20.bsl
index f9ec6909780..61fae1bba36 100644
--- a/tests/fsharp/typecheck/sigs/neg20.bsl
+++ b/tests/fsharp/typecheck/sigs/neg20.bsl
@@ -135,19 +135,19 @@ neg20.fs(108,12,108,16): typecheck error FS0001: Type mismatch. Expecting a
     'B * B -> 'a'    
 but given a
     'A * A -> Data'    
-The type 'B' does not match the type 'A'
+The type 'A' does not match the type 'B'
 
 neg20.fs(109,12,109,16): typecheck error FS0001: Type mismatch. Expecting a
     'A * B -> 'a'    
 but given a
     'A * A -> Data'    
-The type 'B' does not match the type 'A'
+The type 'A' does not match the type 'B'
 
 neg20.fs(110,12,110,16): typecheck error FS0001: Type mismatch. Expecting a
     'B * A -> 'a'    
 but given a
     'A * A -> Data'    
-The type 'B' does not match the type 'A'
+The type 'A' does not match the type 'B'
 
 neg20.fs(128,19,128,22): typecheck error FS0001: This expression was expected to have type
     'string'    
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.il.bsl
index 3e69ae4967f..a45c4e67570 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly AsyncExpressionSteppingTest1
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000026C
 }
+.mresource public FSharpSignatureDataB.AsyncExpressionSteppingTest1
+{
+  // Offset: 0x00000270 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.AsyncExpressionSteppingTest1
 {
-  // Offset: 0x00000270 Length: 0x000000B1
+  // Offset: 0x00000278 Length: 0x000000B1
+}
+.mresource public FSharpOptimizationDataB.AsyncExpressionSteppingTest1
+{
+  // Offset: 0x00000330 Length: 0x00000000
 }
 .module AsyncExpressionSteppingTest1.dll
-// MVID: {5AF5DDAE-6394-B5D4-A745-0383AEDDF55A}
+// MVID: {5C6C9329-2A83-7E0E-A745-038329936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02880000
+// Image base: 0x01A80000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.il.bsl
index 7bdb6a074c0..b191b2d1dc9 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly AsyncExpressionSteppingTest2
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000026C
 }
+.mresource public FSharpSignatureDataB.AsyncExpressionSteppingTest2
+{
+  // Offset: 0x00000270 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.AsyncExpressionSteppingTest2
 {
-  // Offset: 0x00000270 Length: 0x000000B1
+  // Offset: 0x00000278 Length: 0x000000B1
+}
+.mresource public FSharpOptimizationDataB.AsyncExpressionSteppingTest2
+{
+  // Offset: 0x00000330 Length: 0x00000000
 }
 .module AsyncExpressionSteppingTest2.dll
-// MVID: {5AF5DDAE-6394-D499-A745-0383AEDDF55A}
+// MVID: {5C6C9329-331E-82E3-A745-038329936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x04520000
+// Image base: 0x012E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.il.bsl
index 6dfebd88b1e..b8e13505fef 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly AsyncExpressionSteppingTest3
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000277
 }
+.mresource public FSharpSignatureDataB.AsyncExpressionSteppingTest3
+{
+  // Offset: 0x00000280 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.AsyncExpressionSteppingTest3
 {
-  // Offset: 0x00000280 Length: 0x000000B1
+  // Offset: 0x00000288 Length: 0x000000B1
+}
+.mresource public FSharpOptimizationDataB.AsyncExpressionSteppingTest3
+{
+  // Offset: 0x00000340 Length: 0x00000000
 }
 .module AsyncExpressionSteppingTest3.dll
-// MVID: {5AF5DDAE-6394-F35E-A745-0383AEDDF55A}
+// MVID: {5C6C9329-3BB9-87B8-A745-038329936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x04650000
+// Image base: 0x00570000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.il.bsl
index ce54bd4945d..6b1465a58ae 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly AsyncExpressionSteppingTest4
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000277
 }
+.mresource public FSharpSignatureDataB.AsyncExpressionSteppingTest4
+{
+  // Offset: 0x00000280 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.AsyncExpressionSteppingTest4
 {
-  // Offset: 0x00000280 Length: 0x000000B1
+  // Offset: 0x00000288 Length: 0x000000B1
+}
+.mresource public FSharpOptimizationDataB.AsyncExpressionSteppingTest4
+{
+  // Offset: 0x00000340 Length: 0x00000000
 }
 .module AsyncExpressionSteppingTest4.dll
-// MVID: {5AF5DDAE-6394-6D4B-A745-0383AEDDF55A}
+// MVID: {5C6C9329-A47C-E149-A745-038329936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x028F0000
+// Image base: 0x00680000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.il.bsl
index da554a3adf4..0cb3c79f21e 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly AsyncExpressionSteppingTest5
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x000002B8
 }
+.mresource public FSharpSignatureDataB.AsyncExpressionSteppingTest5
+{
+  // Offset: 0x000002C0 Length: 0x00000006
+}
 .mresource public FSharpOptimizationData.AsyncExpressionSteppingTest5
 {
-  // Offset: 0x000002C0 Length: 0x000000BE
+  // Offset: 0x000002D0 Length: 0x000000BE
+}
+.mresource public FSharpOptimizationDataB.AsyncExpressionSteppingTest5
+{
+  // Offset: 0x00000398 Length: 0x00000000
 }
 .module AsyncExpressionSteppingTest5.dll
-// MVID: {5AF5DDAE-6394-30E8-A745-0383AEDDF55A}
+// MVID: {5C6C9329-A817-7C26-A745-038329936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x04430000
+// Image base: 0x007C0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.il.bsl
index 379ad6bbe7c..9c7cd83cb1d 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly AsyncExpressionSteppingTest6
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x000002A3
 }
+.mresource public FSharpSignatureDataB.AsyncExpressionSteppingTest6
+{
+  // Offset: 0x000002A8 Length: 0x00000008
+}
 .mresource public FSharpOptimizationData.AsyncExpressionSteppingTest6
 {
-  // Offset: 0x000002A8 Length: 0x000000BE
+  // Offset: 0x000002B8 Length: 0x000000BE
+}
+.mresource public FSharpOptimizationDataB.AsyncExpressionSteppingTest6
+{
+  // Offset: 0x00000380 Length: 0x00000000
 }
 .module AsyncExpressionSteppingTest6.dll
-// MVID: {5AF5DDAE-6394-4FAD-A745-0383AEDDF55A}
+// MVID: {5C6C9329-B0B2-80FB-A745-038329936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x04C40000
+// Image base: 0x019B0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Default.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Default.il.bsl
index bbe5b40ba64..19a696361a6 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Default.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Default.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Default
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Default
 {
-  // Offset: 0x00000000 Length: 0x000003FA
+  // Offset: 0x00000000 Length: 0x00000402
+}
+.mresource public FSharpSignatureDataB.Default
+{
+  // Offset: 0x00000408 Length: 0x0000001A
 }
 .mresource public FSharpOptimizationData.Default
 {
-  // Offset: 0x00000400 Length: 0x000000BA
+  // Offset: 0x00000428 Length: 0x000000BA
+}
+.mresource public FSharpOptimizationDataB.Default
+{
+  // Offset: 0x000004E8 Length: 0x00000003
 }
 .module Default.dll
-// MVID: {59B19208-AAA9-67BB-A745-03830892B159}
+// MVID: {5C6C9329-B299-AA6D-A745-038329936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00E30000
+// Image base: 0x01050000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Field.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Field.il.bsl
index 6d4d86af42b..24c19745239 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Field.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Field.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Field
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Field
 {
-  // Offset: 0x00000000 Length: 0x000003F4
+  // Offset: 0x00000000 Length: 0x000003FC
+}
+.mresource public FSharpSignatureDataB.Field
+{
+  // Offset: 0x00000400 Length: 0x0000001A
 }
 .mresource public FSharpOptimizationData.Field
 {
-  // Offset: 0x000003F8 Length: 0x000000B8
+  // Offset: 0x00000420 Length: 0x000000B8
+}
+.mresource public FSharpOptimizationDataB.Field
+{
+  // Offset: 0x000004E0 Length: 0x00000003
 }
 .module Field.dll
-// MVID: {59B19208-96F8-CD6E-A745-03830892B159}
+// MVID: {5C6C9329-94F4-D3EF-A745-038329936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00F60000
+// Image base: 0x014C0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Property.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Property.il.bsl
index eb0160f0a01..3846b7bd5ff 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Property.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/AttributeTargets/Property.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Property
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Property
 {
-  // Offset: 0x00000000 Length: 0x000003FD
+  // Offset: 0x00000000 Length: 0x00000405
+}
+.mresource public FSharpSignatureDataB.Property
+{
+  // Offset: 0x00000410 Length: 0x0000001A
 }
 .mresource public FSharpOptimizationData.Property
 {
-  // Offset: 0x00000408 Length: 0x000000BB
+  // Offset: 0x00000430 Length: 0x000000BB
+}
+.mresource public FSharpOptimizationDataB.Property
+{
+  // Offset: 0x000004F0 Length: 0x00000003
 }
 .module Property.dll
-// MVID: {59B19208-9B5C-7949-A745-03830892B159}
+// MVID: {5C6C9329-845D-34D4-A745-038329936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02E80000
+// Image base: 0x011D0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01.il.bsl
index 5875beb14e4..244b83cbd1f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly CCtorDUWithMember01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.CCtorDUWithMember01
 {
-  // Offset: 0x00000000 Length: 0x00000790
+  // Offset: 0x00000000 Length: 0x00000784
+}
+.mresource public FSharpSignatureDataB.CCtorDUWithMember01
+{
+  // Offset: 0x00000788 Length: 0x00000085
 }
 .mresource public FSharpOptimizationData.CCtorDUWithMember01
 {
-  // Offset: 0x00000798 Length: 0x00000227
+  // Offset: 0x00000818 Length: 0x00000227
+}
+.mresource public FSharpOptimizationDataB.CCtorDUWithMember01
+{
+  // Offset: 0x00000A48 Length: 0x0000002F
 }
 .module CCtorDUWithMember01.exe
-// MVID: {59B1923F-26F1-14EE-A745-03833F92B159}
+// MVID: {5C6C932A-6E31-E300-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00A70000
+// Image base: 0x00360000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02.il.bsl
index f8d32ee78a8..dbd403aa996 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly CCtorDUWithMember02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.CCtorDUWithMember02
 {
-  // Offset: 0x00000000 Length: 0x0000030C
+  // Offset: 0x00000000 Length: 0x00000314
+}
+.mresource public FSharpSignatureDataB.CCtorDUWithMember02
+{
+  // Offset: 0x00000318 Length: 0x00000002
 }
 .mresource public FSharpOptimizationData.CCtorDUWithMember02
 {
-  // Offset: 0x00000310 Length: 0x000000E4
+  // Offset: 0x00000320 Length: 0x000000E4
+}
+.mresource public FSharpOptimizationDataB.CCtorDUWithMember02
+{
+  // Offset: 0x00000408 Length: 0x00000000
 }
 .module CCtorDUWithMember02.exe
-// MVID: {59B1923F-D176-C99D-A745-03833F92B159}
+// MVID: {5C6C932A-8374-E300-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01380000
+// Image base: 0x00DB0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03.il.bsl
index 2ded0bcb8b9..08f3be6d20f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly CCtorDUWithMember03
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.CCtorDUWithMember03
 {
-  // Offset: 0x00000000 Length: 0x0000029D
+  // Offset: 0x00000000 Length: 0x000002A5
+}
+.mresource public FSharpSignatureDataB.CCtorDUWithMember03
+{
+  // Offset: 0x000002B0 Length: 0x00000001
 }
 .mresource public FSharpOptimizationData.CCtorDUWithMember03
 {
-  // Offset: 0x000002A8 Length: 0x000000B2
+  // Offset: 0x000002B8 Length: 0x000000B2
+}
+.mresource public FSharpOptimizationDataB.CCtorDUWithMember03
+{
+  // Offset: 0x00000370 Length: 0x00000000
 }
 .module CCtorDUWithMember03.exe
-// MVID: {59B1923F-C97B-D207-A745-03833F92B159}
+// MVID: {5C6C932A-6633-E300-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x030C0000
+// Image base: 0x00A60000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04.il.bsl
index 4063e241fda..504767919e0 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly CCtorDUWithMember04
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.CCtorDUWithMember04
 {
-  // Offset: 0x00000000 Length: 0x0000029D
+  // Offset: 0x00000000 Length: 0x000002A5
+}
+.mresource public FSharpSignatureDataB.CCtorDUWithMember04
+{
+  // Offset: 0x000002B0 Length: 0x00000001
 }
 .mresource public FSharpOptimizationData.CCtorDUWithMember04
 {
-  // Offset: 0x000002A8 Length: 0x000000B2
+  // Offset: 0x000002B8 Length: 0x000000B2
+}
+.mresource public FSharpOptimizationDataB.CCtorDUWithMember04
+{
+  // Offset: 0x00000370 Length: 0x00000000
 }
 .module CCtorDUWithMember04.exe
-// MVID: {59B1923F-CF28-717B-A745-03833F92B159}
+// MVID: {5C6C932A-7A76-E300-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00AA0000
+// Image base: 0x016D0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd
index 1786d4bc552..0e3c4acf219 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd
@@ -5,5 +5,11 @@ IF NOT ERRORLEVEL 0 exit 1
 
 echo %~dp0..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il"
      %~dp0..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il"
+
+if /i "%TEST_UPDATE_BSL%" == "1" (
+  echo copy /y "%~n1.il" "%~n1.il.bsl"
+  copy /y "%~n1.il" "%~n1.il.bsl"
+)
+
 exit /b %ERRORLEVEL%
 
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.il.bsl
index 0b9f0b91042..2974444b675 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly CompiledNameAttribute01
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000272
 }
+.mresource public FSharpSignatureDataB.CompiledNameAttribute01
+{
+  // Offset: 0x00000278 Length: 0x00000009
+}
 .mresource public FSharpOptimizationData.CompiledNameAttribute01
 {
-  // Offset: 0x00000278 Length: 0x00000086
+  // Offset: 0x00000288 Length: 0x00000086
+}
+.mresource public FSharpOptimizationDataB.CompiledNameAttribute01
+{
+  // Offset: 0x00000318 Length: 0x00000000
 }
 .module CompiledNameAttribute01.exe
-// MVID: {59B1923F-EF5A-FC2A-A745-03833F92B159}
+// MVID: {5C6C932A-F6D9-B06C-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00ED0000
+// Image base: 0x03310000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.il.bsl
index 6adf54e44d5..a84d0cf6e74 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly CompiledNameAttribute02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.CompiledNameAttribute02
 {
-  // Offset: 0x00000000 Length: 0x000002E8
+  // Offset: 0x00000000 Length: 0x000002F0
+}
+.mresource public FSharpSignatureDataB.CompiledNameAttribute02
+{
+  // Offset: 0x000002F8 Length: 0x00000011
 }
 .mresource public FSharpOptimizationData.CompiledNameAttribute02
 {
-  // Offset: 0x000002F0 Length: 0x000000CD
+  // Offset: 0x00000310 Length: 0x000000CD
+}
+.mresource public FSharpOptimizationDataB.CompiledNameAttribute02
+{
+  // Offset: 0x000003E8 Length: 0x00000006
 }
 .module CompiledNameAttribute02.exe
-// MVID: {59B1923F-F755-F3C0-A745-03833F92B159}
+// MVID: {5C6C932A-139A-B06D-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x018A0000
+// Image base: 0x003A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.il.bsl
index 228aa3dd3bb..96b0f19e42d 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly CompiledNameAttribute03
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000027D
 }
+.mresource public FSharpSignatureDataB.CompiledNameAttribute03
+{
+  // Offset: 0x00000288 Length: 0x00000009
+}
 .mresource public FSharpOptimizationData.CompiledNameAttribute03
 {
-  // Offset: 0x00000288 Length: 0x00000086
+  // Offset: 0x00000298 Length: 0x00000086
+}
+.mresource public FSharpOptimizationDataB.CompiledNameAttribute03
+{
+  // Offset: 0x00000328 Length: 0x00000000
 }
 .module CompiledNameAttribute03.exe
-// MVID: {59B1923F-2CE4-60B9-A745-03833F92B159}
+// MVID: {5C6C932A-0FDB-B06D-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x03120000
+// Image base: 0x00B30000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04.il.bsl
index 6007efcdfb7..1258b54de0b 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly CompiledNameAttribute04
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.CompiledNameAttribute04
 {
-  // Offset: 0x00000000 Length: 0x00000CE9
+  // Offset: 0x00000000 Length: 0x00000CDD
+}
+.mresource public FSharpSignatureDataB.CompiledNameAttribute04
+{
+  // Offset: 0x00000CE8 Length: 0x00000110
 }
 .mresource public FSharpOptimizationData.CompiledNameAttribute04
 {
-  // Offset: 0x00000CF0 Length: 0x000002CB
+  // Offset: 0x00000E00 Length: 0x000002CB
+}
+.mresource public FSharpOptimizationDataB.CompiledNameAttribute04
+{
+  // Offset: 0x000010D0 Length: 0x0000004E
 }
 .module CompiledNameAttribute04.exe
-// MVID: {59B1923F-34DF-584F-A745-03833F92B159}
+// MVID: {5C6C932A-0A9C-B06D-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01680000
+// Image base: 0x011F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr01.il.bsl
index 056640724cf..05a83321a9f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly extern ComputationExprLibrary
 {
@@ -33,20 +33,28 @@
 }
 .mresource public FSharpSignatureData.ComputationExpr01
 {
-  // Offset: 0x00000000 Length: 0x000001F8
+  // Offset: 0x00000000 Length: 0x0000021A
+}
+.mresource public FSharpSignatureDataB.ComputationExpr01
+{
+  // Offset: 0x00000220 Length: 0x00000002
 }
 .mresource public FSharpOptimizationData.ComputationExpr01
 {
-  // Offset: 0x00000200 Length: 0x0000007D
+  // Offset: 0x00000228 Length: 0x0000007D
+}
+.mresource public FSharpOptimizationDataB.ComputationExpr01
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module ComputationExpr01.exe
-// MVID: {5A1F62A7-3703-E566-A745-0383A7621F5A}
+// MVID: {5C6C932A-9F41-ACD5-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x007B0000
+// Image base: 0x00700000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
@@ -83,7 +91,7 @@
       // Code size       15 (0xf)
       .maxstack  8
       .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
-      .line 8,8 : 9,17 'C:\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr01.fs'
+      .line 8,8 : 9,17 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr01.fs'
       IL_0000:  ldarg.0
       IL_0001:  ldfld      class [ComputationExprLibrary]Library.EventuallyBuilder ComputationExpr01/res1@8::builder@
       IL_0006:  ldc.i4.1
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr02.il.bsl
index 80dd23ca0b0..cc875d8b7ab 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly extern ComputationExprLibrary
 {
@@ -33,20 +33,28 @@
 }
 .mresource public FSharpSignatureData.ComputationExpr02
 {
-  // Offset: 0x00000000 Length: 0x000001F8
+  // Offset: 0x00000000 Length: 0x0000021A
+}
+.mresource public FSharpSignatureDataB.ComputationExpr02
+{
+  // Offset: 0x00000220 Length: 0x00000002
 }
 .mresource public FSharpOptimizationData.ComputationExpr02
 {
-  // Offset: 0x00000200 Length: 0x0000007D
+  // Offset: 0x00000228 Length: 0x0000007D
+}
+.mresource public FSharpOptimizationDataB.ComputationExpr02
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module ComputationExpr02.exe
-// MVID: {5A1F62A7-3624-E566-A745-0383A7621F5A}
+// MVID: {5C6C932A-8AFE-ACD5-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01010000
+// Image base: 0x01100000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
@@ -84,7 +92,7 @@
       .maxstack  7
       .locals init ([0] int32 x)
       .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
-      .line 8,8 : 18,33 'C:\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr02.fs'
+      .line 8,8 : 18,33 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr02.fs'
       IL_0000:  ldstr      "hello"
       IL_0005:  newobj     instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string)
       IL_000a:  call       !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4)
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr03.il.bsl
index 46926f5d00e..fc61c8f25ed 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr03.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly extern ComputationExprLibrary
 {
@@ -33,20 +33,28 @@
 }
 .mresource public FSharpSignatureData.ComputationExpr03
 {
-  // Offset: 0x00000000 Length: 0x00000222
+  // Offset: 0x00000000 Length: 0x00000244
+}
+.mresource public FSharpSignatureDataB.ComputationExpr03
+{
+  // Offset: 0x00000248 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.ComputationExpr03
 {
-  // Offset: 0x00000228 Length: 0x0000008C
+  // Offset: 0x00000250 Length: 0x0000008C
+}
+.mresource public FSharpOptimizationDataB.ComputationExpr03
+{
+  // Offset: 0x000002E0 Length: 0x00000000
 }
 .module ComputationExpr03.exe
-// MVID: {5A1F62A7-3649-E566-A745-0383A7621F5A}
+// MVID: {5C6C932A-A73F-ACD5-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00BF0000
+// Image base: 0x00D80000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
@@ -84,7 +92,7 @@
       .maxstack  7
       .locals init ([0] int32 x)
       .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
-      .line 8,8 : 18,33 'C:\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr03.fs'
+      .line 8,8 : 18,33 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr03.fs'
       IL_0000:  ldstr      "hello"
       IL_0005:  newobj     instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string)
       IL_000a:  call       !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4)
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr04.il.bsl
index 6f211063ee2..d34fc4647ed 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr04.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr04.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly extern ComputationExprLibrary
 {
@@ -33,20 +33,28 @@
 }
 .mresource public FSharpSignatureData.ComputationExpr04
 {
-  // Offset: 0x00000000 Length: 0x000001F8
+  // Offset: 0x00000000 Length: 0x0000021A
+}
+.mresource public FSharpSignatureDataB.ComputationExpr04
+{
+  // Offset: 0x00000220 Length: 0x00000002
 }
 .mresource public FSharpOptimizationData.ComputationExpr04
 {
-  // Offset: 0x00000200 Length: 0x0000007D
+  // Offset: 0x00000228 Length: 0x0000007D
+}
+.mresource public FSharpOptimizationDataB.ComputationExpr04
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module ComputationExpr04.exe
-// MVID: {5A1F62A7-366A-E566-A745-0383A7621F5A}
+// MVID: {5C6C932A-B404-ACD5-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x04DD0000
+// Image base: 0x00730000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
@@ -85,7 +93,7 @@
       .locals init ([0] int32 x,
                [1] string V_1)
       .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
-      .line 7,7 : 22,37 'C:\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr04.fs'
+      .line 7,7 : 22,37 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr04.fs'
       IL_0000:  ldstr      "hello"
       IL_0005:  newobj     instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string)
       IL_000a:  call       !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4)
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr05.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr05.il.bsl
index 8f5858d32b2..d3d57afb667 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr05.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr05.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly extern ComputationExprLibrary
 {
@@ -33,20 +33,28 @@
 }
 .mresource public FSharpSignatureData.ComputationExpr05
 {
-  // Offset: 0x00000000 Length: 0x000001F8
+  // Offset: 0x00000000 Length: 0x0000021A
+}
+.mresource public FSharpSignatureDataB.ComputationExpr05
+{
+  // Offset: 0x00000220 Length: 0x00000002
 }
 .mresource public FSharpOptimizationData.ComputationExpr05
 {
-  // Offset: 0x00000200 Length: 0x0000007D
+  // Offset: 0x00000228 Length: 0x0000007D
+}
+.mresource public FSharpOptimizationDataB.ComputationExpr05
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module ComputationExpr05.exe
-// MVID: {5A1F62A7-3687-E566-A745-0383A7621F5A}
+// MVID: {5C6C932A-AF45-ACD5-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x039D0000
+// Image base: 0x00640000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
@@ -79,7 +87,7 @@
       // Code size       1 (0x1)
       .maxstack  8
       .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
-      .line 9,9 : 68,70 'C:\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr05.fs'
+      .line 9,9 : 68,70 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr05.fs'
       IL_0000:  ret
     } // end of method 'res5@9-1'::'System-IDisposable-Dispose'
 
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr06.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr06.il.bsl
index 93152a9b90f..6cf3e339f66 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr06.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr06.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly extern ComputationExprLibrary
 {
@@ -33,20 +33,28 @@
 }
 .mresource public FSharpSignatureData.ComputationExpr06
 {
-  // Offset: 0x00000000 Length: 0x000001F8
+  // Offset: 0x00000000 Length: 0x0000021A
+}
+.mresource public FSharpSignatureDataB.ComputationExpr06
+{
+  // Offset: 0x00000220 Length: 0x00000002
 }
 .mresource public FSharpOptimizationData.ComputationExpr06
 {
-  // Offset: 0x00000200 Length: 0x0000007D
+  // Offset: 0x00000228 Length: 0x0000007D
+}
+.mresource public FSharpOptimizationDataB.ComputationExpr06
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module ComputationExpr06.exe
-// MVID: {5A1F62A7-35A8-E566-A745-0383A7621F5A}
+// MVID: {5C6C932A-9B02-ACD5-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00DD0000
+// Image base: 0x015D0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
@@ -80,7 +88,7 @@
       // Code size       15 (0xf)
       .maxstack  8
       .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
-      .line 9,9 : 15,21 'C:\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr06.fs'
+      .line 9,9 : 15,21 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr06.fs'
       IL_0000:  ldarg.0
       IL_0001:  ldfld      class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 ComputationExpr06/'res6@9-1'::x
       IL_0006:  call       !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::op_Dereference(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1)
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr07.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr07.il.bsl
index 2e07f1e3d66..720c1f54e5f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr07.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExpr07.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly extern ComputationExprLibrary
 {
@@ -33,20 +33,28 @@
 }
 .mresource public FSharpSignatureData.ComputationExpr07
 {
-  // Offset: 0x00000000 Length: 0x000001F8
+  // Offset: 0x00000000 Length: 0x0000021A
+}
+.mresource public FSharpSignatureDataB.ComputationExpr07
+{
+  // Offset: 0x00000220 Length: 0x00000002
 }
 .mresource public FSharpOptimizationData.ComputationExpr07
 {
-  // Offset: 0x00000200 Length: 0x0000007D
+  // Offset: 0x00000228 Length: 0x0000007D
+}
+.mresource public FSharpOptimizationDataB.ComputationExpr07
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module ComputationExpr07.exe
-// MVID: {5A1F62A7-35BD-E566-A745-0383A7621F5A}
+// MVID: {5C6C932A-B743-ACD5-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x03800000
+// Image base: 0x00360000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
@@ -89,7 +97,7 @@
       .maxstack  7
       .locals init ([0] int32 v)
       .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
-      .line 9,9 : 9,29 'C:\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr07.fs'
+      .line 9,9 : 9,29 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\ComputationExpressions\\ComputationExpr07.fs'
       IL_0000:  ldarg.1
       IL_0001:  stloc.0
       .line 10,10 : 13,24 ''
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.il.bsl
index 70c28499d91..877cdf3b477 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_ArrayOfArray_CSInterface
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_ArrayOfArray_CSInterface
 {
-  // Offset: 0x00000000 Length: 0x0000026E
+  // Offset: 0x00000000 Length: 0x00000276
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_ArrayOfArray_CSInterface
+{
+  // Offset: 0x00000280 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_ArrayOfArray_CSInterface
 {
-  // Offset: 0x00000278 Length: 0x000000A6
+  // Offset: 0x00000290 Length: 0x000000A6
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_ArrayOfArray_CSInterface
+{
+  // Offset: 0x00000340 Length: 0x00000000
 }
 .module DoNotBoxStruct_ArrayOfArray_CSInterface.exe
-// MVID: {59B1920A-FF24-C89E-A745-03830A92B159}
+// MVID: {5C6C932A-D91C-C978-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x015B0000
+// Image base: 0x03300000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.il.bsl
index 4693af05dc0..42cef1a310e 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_ArrayOfArray_FSInterface
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_ArrayOfArray_FSInterface
 {
-  // Offset: 0x00000000 Length: 0x00000272
+  // Offset: 0x00000000 Length: 0x0000027A
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_ArrayOfArray_FSInterface
+{
+  // Offset: 0x00000280 Length: 0x00000008
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_ArrayOfArray_FSInterface
 {
-  // Offset: 0x00000278 Length: 0x000000A6
+  // Offset: 0x00000290 Length: 0x000000A6
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_ArrayOfArray_FSInterface
+{
+  // Offset: 0x00000340 Length: 0x00000000
 }
 .module DoNotBoxStruct_ArrayOfArray_FSInterface.exe
-// MVID: {59B1920A-8A45-C8A0-A745-03830A92B159}
+// MVID: {5C6C932A-1537-81EE-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00680000
+// Image base: 0x00790000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.il.bsl
index 1ef23f5de14..8fbc2963803 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth
 {
-  // Offset: 0x00000000 Length: 0x00000291
+  // Offset: 0x00000000 Length: 0x00000299
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth
+{
+  // Offset: 0x000002A0 Length: 0x00000008
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth
 {
-  // Offset: 0x00000298 Length: 0x000000BA
+  // Offset: 0x000002B0 Length: 0x000000BA
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth
+{
+  // Offset: 0x00000370 Length: 0x00000000
 }
 .module DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.exe
-// MVID: {59B1920A-1475-D984-A745-03830A92B159}
+// MVID: {5C6C932A-D930-716D-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x015B0000
+// Image base: 0x00680000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.il.bsl
index ca6aa2077fe..097c2dae04e 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_Array_CSInterface
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_Array_CSInterface
 {
-  // Offset: 0x00000000 Length: 0x00000255
+  // Offset: 0x00000000 Length: 0x0000025D
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_Array_CSInterface
+{
+  // Offset: 0x00000268 Length: 0x00000006
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_Array_CSInterface
 {
-  // Offset: 0x00000260 Length: 0x00000098
+  // Offset: 0x00000278 Length: 0x00000098
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_Array_CSInterface
+{
+  // Offset: 0x00000318 Length: 0x00000000
 }
 .module DoNotBoxStruct_Array_CSInterface.exe
-// MVID: {59B1920A-1735-654E-A745-03830A92B159}
+// MVID: {5C6C932A-C4D6-12C8-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x031D0000
+// Image base: 0x012E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.il.bsl
index 6b25b5eec24..32686bf91ab 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_Array_FSInterface
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_Array_FSInterface
 {
-  // Offset: 0x00000000 Length: 0x00000259
+  // Offset: 0x00000000 Length: 0x00000261
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_Array_FSInterface
+{
+  // Offset: 0x00000268 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_Array_FSInterface
 {
-  // Offset: 0x00000260 Length: 0x00000098
+  // Offset: 0x00000278 Length: 0x00000098
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_Array_FSInterface
+{
+  // Offset: 0x00000318 Length: 0x00000000
 }
 .module DoNotBoxStruct_Array_FSInterface.exe
-// MVID: {59B1920A-1737-9DA5-A745-03830A92B159}
+// MVID: {5C6C932A-37AF-D4BC-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00300000
+// Image base: 0x014A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.il.bsl
index c4a168a2d73..7ee78791c8e 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_Array_FSInterface_NoExtMeth
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_Array_FSInterface_NoExtMeth
 {
-  // Offset: 0x00000000 Length: 0x00000278
+  // Offset: 0x00000000 Length: 0x00000280
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_Array_FSInterface_NoExtMeth
+{
+  // Offset: 0x00000288 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_Array_FSInterface_NoExtMeth
 {
-  // Offset: 0x00000280 Length: 0x000000AC
+  // Offset: 0x00000298 Length: 0x000000AC
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_Array_FSInterface_NoExtMeth
+{
+  // Offset: 0x00000348 Length: 0x00000000
 }
 .module DoNotBoxStruct_Array_FSInterface_NoExtMeth.exe
-// MVID: {59B1920A-8127-3EE3-A745-03830A92B159}
+// MVID: {5C6C932A-E97A-148F-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00740000
+// Image base: 0x01300000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.il.bsl
index cfeba995ccf..7252e2f7a5c 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_MDArray_CSInterface
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_MDArray_CSInterface
 {
-  // Offset: 0x00000000 Length: 0x0000025C
+  // Offset: 0x00000000 Length: 0x00000264
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_MDArray_CSInterface
+{
+  // Offset: 0x00000268 Length: 0x00000006
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_MDArray_CSInterface
 {
-  // Offset: 0x00000260 Length: 0x0000009C
+  // Offset: 0x00000278 Length: 0x0000009C
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_MDArray_CSInterface
+{
+  // Offset: 0x00000318 Length: 0x00000000
 }
 .module DoNotBoxStruct_MDArray_CSInterface.exe
-// MVID: {59B1920A-24A8-8796-A745-03830A92B159}
+// MVID: {5C6C932A-DC23-91F9-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00DD0000
+// Image base: 0x00AC0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.il.bsl
index c0d5f4ce7db..b99acf12e13 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_MDArray_FSInterface
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_MDArray_FSInterface
 {
-  // Offset: 0x00000000 Length: 0x00000260
+  // Offset: 0x00000000 Length: 0x00000268
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_MDArray_FSInterface
+{
+  // Offset: 0x00000270 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_MDArray_FSInterface
 {
-  // Offset: 0x00000268 Length: 0x0000009C
+  // Offset: 0x00000280 Length: 0x0000009C
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_MDArray_FSInterface
+{
+  // Offset: 0x00000320 Length: 0x00000000
 }
 .module DoNotBoxStruct_MDArray_FSInterface.exe
-// MVID: {59B1920A-8279-DA45-A745-03830A92B159}
+// MVID: {5C6C932A-6E4A-10F3-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00F20000
+// Image base: 0x00FA0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.il.bsl
index 00d5ffc2e07..c5e0aec8574 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_MDArray_FSInterface_NoExtMeth
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_MDArray_FSInterface_NoExtMeth
 {
-  // Offset: 0x00000000 Length: 0x0000027F
+  // Offset: 0x00000000 Length: 0x00000287
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_MDArray_FSInterface_NoExtMeth
+{
+  // Offset: 0x00000290 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_MDArray_FSInterface_NoExtMeth
 {
-  // Offset: 0x00000288 Length: 0x000000B0
+  // Offset: 0x000002A0 Length: 0x000000B0
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_MDArray_FSInterface_NoExtMeth
+{
+  // Offset: 0x00000358 Length: 0x00000000
 }
 .module DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.exe
-// MVID: {59B1920A-A67D-867A-A745-03830A92B159}
+// MVID: {5C6C932A-C675-EDD9-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x010C0000
+// Image base: 0x007A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.il.bsl
index 4b9a226ab6a..d8331bce79a 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_NoArray_CSInterface
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_NoArray_CSInterface
 {
-  // Offset: 0x00000000 Length: 0x0000024C
+  // Offset: 0x00000000 Length: 0x00000254
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_NoArray_CSInterface
+{
+  // Offset: 0x00000258 Length: 0x00000005
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_NoArray_CSInterface
 {
-  // Offset: 0x00000250 Length: 0x0000009C
+  // Offset: 0x00000268 Length: 0x0000009C
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_NoArray_CSInterface
+{
+  // Offset: 0x00000308 Length: 0x00000000
 }
 .module DoNotBoxStruct_NoArray_CSInterface.exe
-// MVID: {59B1920A-5654-8082-A745-03830A92B159}
+// MVID: {5C6C932A-58FF-535C-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00B50000
+// Image base: 0x00720000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.il.bsl
index 02f0492ad4a..23b78636aeb 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_NoArray_FSInterface
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_NoArray_FSInterface
 {
-  // Offset: 0x00000000 Length: 0x00000250
+  // Offset: 0x00000000 Length: 0x00000258
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_NoArray_FSInterface
+{
+  // Offset: 0x00000260 Length: 0x00000006
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_NoArray_FSInterface
 {
-  // Offset: 0x00000258 Length: 0x0000009C
+  // Offset: 0x00000270 Length: 0x0000009C
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_NoArray_FSInterface
+{
+  // Offset: 0x00000310 Length: 0x00000000
 }
 .module DoNotBoxStruct_NoArray_FSInterface.exe
-// MVID: {59B1920A-3F8A-B9D0-A745-03830A92B159}
+// MVID: {5C6C932A-F5B0-6DAF-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00680000
+// Image base: 0x00800000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.il.bsl
index 92d007fed43..88ef4ce3a7f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_NoArray_FSInterface_NoExtMeth
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_NoArray_FSInterface_NoExtMeth
 {
-  // Offset: 0x00000000 Length: 0x0000026F
+  // Offset: 0x00000000 Length: 0x00000277
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_NoArray_FSInterface_NoExtMeth
+{
+  // Offset: 0x00000280 Length: 0x00000006
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_NoArray_FSInterface_NoExtMeth
 {
-  // Offset: 0x00000278 Length: 0x000000B0
+  // Offset: 0x00000290 Length: 0x000000B0
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_NoArray_FSInterface_NoExtMeth
+{
+  // Offset: 0x00000348 Length: 0x00000000
 }
 .module DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.exe
-// MVID: {59B1920A-CD0A-F713-A745-03830A92B159}
+// MVID: {5C6C932A-1385-8340-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00720000
+// Image base: 0x006A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.il.bsl
index 2faba000cc7..7c5d2eba400 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly DoNotBoxStruct_ToString
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.DoNotBoxStruct_ToString
 {
-  // Offset: 0x00000000 Length: 0x00000208
+  // Offset: 0x00000000 Length: 0x00000210
+}
+.mresource public FSharpSignatureDataB.DoNotBoxStruct_ToString
+{
+  // Offset: 0x00000218 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.DoNotBoxStruct_ToString
 {
-  // Offset: 0x00000210 Length: 0x00000086
+  // Offset: 0x00000220 Length: 0x00000086
+}
+.mresource public FSharpOptimizationDataB.DoNotBoxStruct_ToString
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module DoNotBoxStruct_ToString.exe
-// MVID: {59B1920A-8D34-C606-A745-03830A92B159}
+// MVID: {5C6C932A-CA5F-CEE0-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02CC0000
+// Image base: 0x00690000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter01.il.bsl
index 601e4ffc1e7..c9581895274 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter01.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x000001FF
 }
+.mresource public FSharpSignatureDataB.GenIter01
+{
+  // Offset: 0x00000208 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.GenIter01
 {
-  // Offset: 0x00000208 Length: 0x0000007A
+  // Offset: 0x00000210 Length: 0x0000007A
+}
+.mresource public FSharpOptimizationDataB.GenIter01
+{
+  // Offset: 0x00000290 Length: 0x00000000
 }
 .module GenIter01.exe
-// MVID: {5B9A6329-F836-DC98-A745-038329639A5B}
+// MVID: {5C6C932A-15AD-8011-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01080000
+// Image base: 0x002E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter02.il.bsl
index aa203793fe4..a1652b2061a 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter02.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000200
 }
+.mresource public FSharpSignatureDataB.GenIter02
+{
+  // Offset: 0x00000208 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.GenIter02
 {
-  // Offset: 0x00000208 Length: 0x0000007B
+  // Offset: 0x00000210 Length: 0x0000007B
+}
+.mresource public FSharpOptimizationDataB.GenIter02
+{
+  // Offset: 0x00000290 Length: 0x00000000
 }
 .module GenIter02.exe
-// MVID: {5B9A6329-F857-DC98-A745-038329639A5B}
+// MVID: {5C6C932A-006A-8011-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02900000
+// Image base: 0x00350000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter03.il.bsl
index 88bd760bc85..cf22ac4782f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter03.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter03.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000200
 }
+.mresource public FSharpSignatureDataB.GenIter03
+{
+  // Offset: 0x00000208 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.GenIter03
 {
-  // Offset: 0x00000208 Length: 0x0000007B
+  // Offset: 0x00000210 Length: 0x0000007B
+}
+.mresource public FSharpOptimizationDataB.GenIter03
+{
+  // Offset: 0x00000290 Length: 0x00000000
 }
 .module GenIter03.exe
-// MVID: {5B9A6329-F77C-DC98-A745-038329639A5B}
+// MVID: {5C6C932A-FCAB-8010-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x026B0000
+// Image base: 0x01990000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter04.il.bsl
index 25a08dfd652..6394dc8f42a 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter04.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter04.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x000001F0
 }
+.mresource public FSharpSignatureDataB.GenIter04
+{
+  // Offset: 0x000001F8 Length: 0x00000002
+}
 .mresource public FSharpOptimizationData.GenIter04
 {
-  // Offset: 0x000001F8 Length: 0x0000007B
+  // Offset: 0x00000200 Length: 0x0000007B
+}
+.mresource public FSharpOptimizationDataB.GenIter04
+{
+  // Offset: 0x00000280 Length: 0x00000000
 }
 .module GenIter04.exe
-// MVID: {5B9A6329-F79D-DC98-A745-038329639A5B}
+// MVID: {5C6C932A-0870-8011-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00790000
+// Image base: 0x00680000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison01.il.bsl
index 37c0b51c0e3..cff1acac920 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly InequalityComparison01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.InequalityComparison01
 {
-  // Offset: 0x00000000 Length: 0x0000020E
+  // Offset: 0x00000000 Length: 0x00000216
+}
+.mresource public FSharpSignatureDataB.InequalityComparison01
+{
+  // Offset: 0x00000220 Length: 0x00000005
 }
 .mresource public FSharpOptimizationData.InequalityComparison01
 {
-  // Offset: 0x00000218 Length: 0x00000085
+  // Offset: 0x00000230 Length: 0x00000085
+}
+.mresource public FSharpOptimizationDataB.InequalityComparison01
+{
+  // Offset: 0x000002C0 Length: 0x00000000
 }
 .module InequalityComparison01.exe
-// MVID: {59B19213-263A-E6D5-A745-03831392B159}
+// MVID: {5C6C932A-4C3D-9640-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002E0000
+// Image base: 0x00380000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison02.il.bsl
index 6ce221af23c..9aaef3fc6af 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly InequalityComparison02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.InequalityComparison02
 {
-  // Offset: 0x00000000 Length: 0x0000020E
+  // Offset: 0x00000000 Length: 0x00000216
+}
+.mresource public FSharpSignatureDataB.InequalityComparison02
+{
+  // Offset: 0x00000220 Length: 0x00000005
 }
 .mresource public FSharpOptimizationData.InequalityComparison02
 {
-  // Offset: 0x00000218 Length: 0x00000085
+  // Offset: 0x00000230 Length: 0x00000085
+}
+.mresource public FSharpOptimizationDataB.InequalityComparison02
+{
+  // Offset: 0x000002C0 Length: 0x00000000
 }
 .module InequalityComparison02.exe
-// MVID: {59B19213-263A-E72C-A745-03831392B159}
+// MVID: {5C6C932A-2E18-F138-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02D40000
+// Image base: 0x00EC0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison03.il.bsl
index 96a9c5591cc..c8a32a37ea5 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison03.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly InequalityComparison03
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.InequalityComparison03
 {
-  // Offset: 0x00000000 Length: 0x0000020E
+  // Offset: 0x00000000 Length: 0x00000216
+}
+.mresource public FSharpSignatureDataB.InequalityComparison03
+{
+  // Offset: 0x00000220 Length: 0x00000005
 }
 .mresource public FSharpOptimizationData.InequalityComparison03
 {
-  // Offset: 0x00000218 Length: 0x00000085
+  // Offset: 0x00000230 Length: 0x00000085
+}
+.mresource public FSharpOptimizationDataB.InequalityComparison03
+{
+  // Offset: 0x000002C0 Length: 0x00000000
 }
 .module InequalityComparison03.exe
-// MVID: {59B19213-263A-E70B-A745-03831392B159}
+// MVID: {5C6C932A-5D73-9FEA-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x008E0000
+// Image base: 0x00690000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison04.il.bsl
index 5209536406c..11311ff8356 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison04.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison04.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly InequalityComparison04
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.InequalityComparison04
 {
-  // Offset: 0x00000000 Length: 0x0000020E
+  // Offset: 0x00000000 Length: 0x00000216
+}
+.mresource public FSharpSignatureDataB.InequalityComparison04
+{
+  // Offset: 0x00000220 Length: 0x00000005
 }
 .mresource public FSharpOptimizationData.InequalityComparison04
 {
-  // Offset: 0x00000218 Length: 0x00000085
+  // Offset: 0x00000230 Length: 0x00000085
+}
+.mresource public FSharpOptimizationDataB.InequalityComparison04
+{
+  // Offset: 0x000002C0 Length: 0x00000000
 }
 .module InequalityComparison04.exe
-// MVID: {59B19213-263A-E772-A745-03831392B159}
+// MVID: {5C6C932A-9F76-4F9E-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00F20000
+// Image base: 0x01020000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison05.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison05.il.bsl
index 173552b2fa4..ed6a91f4951 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison05.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/InequalityComparison/InequalityComparison05.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly InequalityComparison05
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.InequalityComparison05
 {
-  // Offset: 0x00000000 Length: 0x00000236
+  // Offset: 0x00000000 Length: 0x0000023E
+}
+.mresource public FSharpSignatureDataB.InequalityComparison05
+{
+  // Offset: 0x00000248 Length: 0x0000000A
 }
 .mresource public FSharpOptimizationData.InequalityComparison05
 {
-  // Offset: 0x00000240 Length: 0x00000085
+  // Offset: 0x00000258 Length: 0x00000085
+}
+.mresource public FSharpOptimizationDataB.InequalityComparison05
+{
+  // Offset: 0x000002E8 Length: 0x00000000
 }
 .module InequalityComparison05.exe
-// MVID: {59B19213-263A-E751-A745-03831392B159}
+// MVID: {5C6C932A-C9D1-9458-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x001D0000
+// Image base: 0x00E70000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest1.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest1.il.bsl
index 831514e5f3c..268c5414695 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest1.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest1.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ListExpressionSteppingTest1
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ListExpressionSteppingTest1
 {
-  // Offset: 0x00000000 Length: 0x0000026D
+  // Offset: 0x00000000 Length: 0x00000275
+}
+.mresource public FSharpSignatureDataB.ListExpressionSteppingTest1
+{
+  // Offset: 0x00000280 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.ListExpressionSteppingTest1
 {
-  // Offset: 0x00000278 Length: 0x000000AF
+  // Offset: 0x00000288 Length: 0x000000AF
+}
+.mresource public FSharpOptimizationDataB.ListExpressionSteppingTest1
+{
+  // Offset: 0x00000340 Length: 0x00000000
 }
 .module ListExpressionSteppingTest1.exe
-// MVID: {59B1920C-50CF-F6CE-A745-03830C92B159}
+// MVID: {5C6C932A-9EBF-875E-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x030B0000
+// Image base: 0x015B0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest2.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest2.il.bsl
index 2b86c1c4ba1..9aa0434ca63 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest2.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest2.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ListExpressionSteppingTest2
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ListExpressionSteppingTest2
 {
-  // Offset: 0x00000000 Length: 0x0000026D
+  // Offset: 0x00000000 Length: 0x00000275
+}
+.mresource public FSharpSignatureDataB.ListExpressionSteppingTest2
+{
+  // Offset: 0x00000280 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.ListExpressionSteppingTest2
 {
-  // Offset: 0x00000278 Length: 0x000000AF
+  // Offset: 0x00000288 Length: 0x000000AF
+}
+.mresource public FSharpOptimizationDataB.ListExpressionSteppingTest2
+{
+  // Offset: 0x00000340 Length: 0x00000000
 }
 .module ListExpressionSteppingTest2.exe
-// MVID: {59B1920C-D3DE-B780-A745-03830C92B159}
+// MVID: {5C6C932A-B402-875E-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00690000
+// Image base: 0x00D30000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest3.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest3.il.bsl
index 864056dbe8c..ce72793ef65 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest3.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest3.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ListExpressionSteppingTest3
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ListExpressionSteppingTest3
 {
-  // Offset: 0x00000000 Length: 0x0000027D
+  // Offset: 0x00000000 Length: 0x00000285
+}
+.mresource public FSharpSignatureDataB.ListExpressionSteppingTest3
+{
+  // Offset: 0x00000290 Length: 0x00000005
 }
 .mresource public FSharpOptimizationData.ListExpressionSteppingTest3
 {
-  // Offset: 0x00000288 Length: 0x000000AF
+  // Offset: 0x000002A0 Length: 0x000000AF
+}
+.mresource public FSharpOptimizationDataB.ListExpressionSteppingTest3
+{
+  // Offset: 0x00000358 Length: 0x00000000
 }
 .module ListExpressionSteppingTest3.exe
-// MVID: {59B1920C-AE45-39B4-A745-03830C92B159}
+// MVID: {5C6C932A-96C1-875E-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00FF0000
+// Image base: 0x01270000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest4.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest4.il.bsl
index 2d0ccb9e33d..d95c3a80396 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest4.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest4.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000275
 }
+.mresource public FSharpSignatureDataB.ListExpressionSteppingTest4
+{
+  // Offset: 0x00000280 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.ListExpressionSteppingTest4
 {
-  // Offset: 0x00000280 Length: 0x000000AF
+  // Offset: 0x00000288 Length: 0x000000AF
+}
+.mresource public FSharpOptimizationDataB.ListExpressionSteppingTest4
+{
+  // Offset: 0x00000340 Length: 0x00000000
 }
 .module ListExpressionSteppingTest4.exe
-// MVID: {5B9A68C1-3154-FA67-A745-0383C1689A5B}
+// MVID: {5C6C932A-AB04-875E-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x018D0000
+// Image base: 0x00850000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest5.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest5.il.bsl
index 39def210b7f..b3248010ee6 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest5.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest5.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000275
 }
+.mresource public FSharpSignatureDataB.ListExpressionSteppingTest5
+{
+  // Offset: 0x00000280 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.ListExpressionSteppingTest5
 {
-  // Offset: 0x00000280 Length: 0x000000AF
+  // Offset: 0x00000288 Length: 0x000000AF
+}
+.mresource public FSharpOptimizationDataB.ListExpressionSteppingTest5
+{
+  // Offset: 0x00000340 Length: 0x00000000
 }
 .module ListExpressionSteppingTest5.exe
-// MVID: {5B9A6329-CBE3-BFEA-A745-038329639A5B}
+// MVID: {5C6C932A-AEC3-875E-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x027C0000
+// Image base: 0x01600000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest6.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest6.il.bsl
index 2d43c04e954..b33bcbc3263 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest6.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest6.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000029D
 }
+.mresource public FSharpSignatureDataB.ListExpressionSteppingTest6
+{
+  // Offset: 0x000002A8 Length: 0x00000006
+}
 .mresource public FSharpOptimizationData.ListExpressionSteppingTest6
 {
-  // Offset: 0x000002A8 Length: 0x000000BC
+  // Offset: 0x000002B8 Length: 0x000000BC
+}
+.mresource public FSharpOptimizationDataB.ListExpressionSteppingTest6
+{
+  // Offset: 0x00000378 Length: 0x00000000
 }
 .module ListExpressionSteppingTest6.exe
-// MVID: {5B9A6329-98A2-AB14-A745-038329639A5B}
+// MVID: {5C6C932A-C406-875E-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x007B0000
+// Image base: 0x00980000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/LiteralValue/LiteralValue.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/LiteralValue/LiteralValue.il.bsl
index 32a104642ee..efc72a85013 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/LiteralValue/LiteralValue.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/LiteralValue/LiteralValue.il.bsl
@@ -1,5 +1,6 @@
 
-//  Microsoft (R) .NET Framework IL Disassembler.  Version 4.5.22220.0
+//  Microsoft (R) .NET Framework IL Disassembler.  Version 4.6.1055.0
+//  Copyright (c) Microsoft Corporation.  All rights reserved.
 
 
 
@@ -12,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly LiteralValue
 {
@@ -28,22 +29,28 @@
 }
 .mresource public FSharpSignatureData.LiteralValue
 {
-  // Offset: 0x00000000 Length: 0x00000274
-  // WARNING: managed resource file FSharpSignatureData.test created
+  // Offset: 0x00000000 Length: 0x00000287
+}
+.mresource public FSharpSignatureDataB.LiteralValue
+{
+  // Offset: 0x00000290 Length: 0x0000000B
 }
 .mresource public FSharpOptimizationData.LiteralValue
 {
-  // Offset: 0x00000278 Length: 0x0000006F
-  // WARNING: managed resource file FSharpOptimizationData.test created
+  // Offset: 0x000002A0 Length: 0x0000007F
+}
+.mresource public FSharpOptimizationDataB.LiteralValue
+{
+  // Offset: 0x00000328 Length: 0x00000000
 }
 .module LiteralValue.exe
- // MVID: {5AA663EB-D9C1-2E4E-A745-0383EB63A65A}
+// MVID: {5C6C932A-80D4-A6FF-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02BF0000
+// Image base: 0x00370000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
@@ -62,7 +69,7 @@
     // Code size       2 (0x2)
     .maxstack  8
     .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
-    .line 6,6 : 5,6 'D:\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\LiteralValue\\LiteralValue.fs'
+    .line 6,6 : 5,6 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\LiteralValue\\LiteralValue.fs'
     IL_0000:  ldc.i4.0
     IL_0001:  ret
   } // end of method LiteralValue::main
@@ -72,10 +79,9 @@
 .class private abstract auto ansi sealed ''.$LiteralValue
        extends [mscorlib]System.Object
 {
-} // end of class ''.$LiteralValue
+} // end of class ''.$LiteralValue
 
 
 // =============================================================
 
 // *********** DISASSEMBLY COMPLETE ***********************
-// WARNING: Created Win32 resource file test.res
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.AggressiveInlining.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.AggressiveInlining.il.bsl
index af04f94f49e..50299d0f269 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.AggressiveInlining.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.AggressiveInlining.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly MethodImplAttribute.AggressiveInlining
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.MethodImplAttribute.AggressiveInlining
 {
-  // Offset: 0x00000000 Length: 0x0000034C
+  // Offset: 0x00000000 Length: 0x00000354
+}
+.mresource public FSharpSignatureDataB.MethodImplAttribute.AggressiveInlining
+{
+  // Offset: 0x00000358 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.MethodImplAttribute.AggressiveInlining
 {
-  // Offset: 0x00000350 Length: 0x00000085
+  // Offset: 0x00000368 Length: 0x00000085
+}
+.mresource public FSharpOptimizationDataB.MethodImplAttribute.AggressiveInlining
+{
+  // Offset: 0x000003F8 Length: 0x00000000
 }
 .module MethodImplAttribute.AggressiveInlining.dll
-// MVID: {59B1920C-66DC-14D3-A745-03830C92B159}
+// MVID: {5C6C932A-4A5F-46FA-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02B20000
+// Image base: 0x00E20000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.ForwardRef.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.ForwardRef.il.bsl
index b37321a6b45..cf747e4e231 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.ForwardRef.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.ForwardRef.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly MethodImplAttribute.ForwardRef
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.MethodImplAttribute.ForwardRef
 {
-  // Offset: 0x00000000 Length: 0x00000331
+  // Offset: 0x00000000 Length: 0x00000339
+}
+.mresource public FSharpSignatureDataB.MethodImplAttribute.ForwardRef
+{
+  // Offset: 0x00000340 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.MethodImplAttribute.ForwardRef
 {
-  // Offset: 0x00000338 Length: 0x0000007D
+  // Offset: 0x00000350 Length: 0x0000007D
+}
+.mresource public FSharpOptimizationDataB.MethodImplAttribute.ForwardRef
+{
+  // Offset: 0x000003D8 Length: 0x00000000
 }
 .module MethodImplAttribute.ForwardRef.dll
-// MVID: {59B1920C-C517-03FF-A745-03830C92B159}
+// MVID: {5C6C932A-FC69-F259-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002E0000
+// Image base: 0x007C0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.InternalCall.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.InternalCall.il.bsl
index 5695375e4e0..251e965e0e8 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.InternalCall.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.InternalCall.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly MethodImplAttribute.InternalCall
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.MethodImplAttribute.InternalCall
 {
-  // Offset: 0x00000000 Length: 0x00000339
+  // Offset: 0x00000000 Length: 0x00000341
+}
+.mresource public FSharpSignatureDataB.MethodImplAttribute.InternalCall
+{
+  // Offset: 0x00000348 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.MethodImplAttribute.InternalCall
 {
-  // Offset: 0x00000340 Length: 0x0000007F
+  // Offset: 0x00000358 Length: 0x0000007F
+}
+.mresource public FSharpOptimizationDataB.MethodImplAttribute.InternalCall
+{
+  // Offset: 0x000003E0 Length: 0x00000000
 }
 .module MethodImplAttribute.InternalCall.dll
-// MVID: {59B1920C-FBF7-6A35-A745-03830C92B159}
+// MVID: {5C6C932A-6140-610F-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x015B0000
+// Image base: 0x01300000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining.il.bsl
index 6801bbb4405..1ee68051710 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly MethodImplAttribute.NoInlining
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.MethodImplAttribute.NoInlining
 {
-  // Offset: 0x00000000 Length: 0x00000331
+  // Offset: 0x00000000 Length: 0x00000339
+}
+.mresource public FSharpSignatureDataB.MethodImplAttribute.NoInlining
+{
+  // Offset: 0x00000340 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.MethodImplAttribute.NoInlining
 {
-  // Offset: 0x00000338 Length: 0x0000007D
+  // Offset: 0x00000350 Length: 0x0000007D
+}
+.mresource public FSharpOptimizationDataB.MethodImplAttribute.NoInlining
+{
+  // Offset: 0x000003D8 Length: 0x00000000
 }
 .module MethodImplAttribute.NoInlining.dll
-// MVID: {59B1920C-F47B-58B3-A745-03830C92B159}
+// MVID: {5C6C932A-D400-3767-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x012B0000
+// Image base: 0x01210000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoOptimization.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoOptimization.il.bsl
index 37557234689..eebd1c90398 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoOptimization.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoOptimization.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly MethodImplAttribute.NoOptimization
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.MethodImplAttribute.NoOptimization
 {
-  // Offset: 0x00000000 Length: 0x0000033D
+  // Offset: 0x00000000 Length: 0x00000345
+}
+.mresource public FSharpSignatureDataB.MethodImplAttribute.NoOptimization
+{
+  // Offset: 0x00000350 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.MethodImplAttribute.NoOptimization
 {
-  // Offset: 0x00000348 Length: 0x00000081
+  // Offset: 0x00000360 Length: 0x00000081
+}
+.mresource public FSharpOptimizationDataB.MethodImplAttribute.NoOptimization
+{
+  // Offset: 0x000003E8 Length: 0x00000000
 }
 .module MethodImplAttribute.NoOptimization.dll
-// MVID: {59B1920C-D394-5177-A745-03830C92B159}
+// MVID: {5C6C932A-D467-7B77-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x006A0000
+// Image base: 0x00360000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.PreserveSig.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.PreserveSig.il.bsl
index 6ded00a8d83..1131b3a44a9 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.PreserveSig.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.PreserveSig.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly MethodImplAttribute.PreserveSig
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.MethodImplAttribute.PreserveSig
 {
-  // Offset: 0x00000000 Length: 0x00000336
+  // Offset: 0x00000000 Length: 0x0000033E
+}
+.mresource public FSharpSignatureDataB.MethodImplAttribute.PreserveSig
+{
+  // Offset: 0x00000348 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.MethodImplAttribute.PreserveSig
 {
-  // Offset: 0x00000340 Length: 0x0000007E
+  // Offset: 0x00000358 Length: 0x0000007E
+}
+.mresource public FSharpOptimizationDataB.MethodImplAttribute.PreserveSig
+{
+  // Offset: 0x000003E0 Length: 0x00000000
 }
 .module MethodImplAttribute.PreserveSig.dll
-// MVID: {59B1920C-0C64-31CC-A745-03830C92B159}
+// MVID: {5C6C932A-96C2-55CD-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00D30000
+// Image base: 0x002E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.Synchronized.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.Synchronized.il.bsl
index 4fbf40b8d9e..f4b9d1fdf6f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.Synchronized.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.Synchronized.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly MethodImplAttribute.Synchronized
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.MethodImplAttribute.Synchronized
 {
-  // Offset: 0x00000000 Length: 0x00000337
+  // Offset: 0x00000000 Length: 0x0000033F
+}
+.mresource public FSharpSignatureDataB.MethodImplAttribute.Synchronized
+{
+  // Offset: 0x00000348 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.MethodImplAttribute.Synchronized
 {
-  // Offset: 0x00000340 Length: 0x0000007F
+  // Offset: 0x00000358 Length: 0x0000007F
+}
+.mresource public FSharpOptimizationDataB.MethodImplAttribute.Synchronized
+{
+  // Offset: 0x000003E0 Length: 0x00000000
 }
 .module MethodImplAttribute.Synchronized.dll
-// MVID: {59B1920C-D8F1-2CC7-A745-03830C92B159}
+// MVID: {5C6C932A-F621-FEF0-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002E0000
+// Image base: 0x00390000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.Unmanaged.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.Unmanaged.il.bsl
index 15db6ae085e..3e204b034e1 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.Unmanaged.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/MethodImplAttribute/MethodImplAttribute.Unmanaged.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly MethodImplAttribute.Unmanaged
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.MethodImplAttribute.Unmanaged
 {
-  // Offset: 0x00000000 Length: 0x0000032E
+  // Offset: 0x00000000 Length: 0x00000336
+}
+.mresource public FSharpSignatureDataB.MethodImplAttribute.Unmanaged
+{
+  // Offset: 0x00000340 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.MethodImplAttribute.Unmanaged
 {
-  // Offset: 0x00000338 Length: 0x0000007C
+  // Offset: 0x00000350 Length: 0x0000007C
+}
+.mresource public FSharpOptimizationDataB.MethodImplAttribute.Unmanaged
+{
+  // Offset: 0x000003D0 Length: 0x00000000
 }
 .module MethodImplAttribute.Unmanaged.dll
-// MVID: {59B1920C-FF34-309C-A745-03830C92B159}
+// MVID: {5C6C932A-F5DD-260B-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x013D0000
+// Image base: 0x011E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/AbstractClass.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/AbstractClass.il.bsl
index 0bae910d0f1..3986beea053 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/AbstractClass.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/AbstractClass.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly AbstractClass
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.AbstractClass
 {
-  // Offset: 0x00000000 Length: 0x00000306
+  // Offset: 0x00000000 Length: 0x0000030E
+}
+.mresource public FSharpSignatureDataB.AbstractClass
+{
+  // Offset: 0x00000318 Length: 0x00000015
 }
 .mresource public FSharpOptimizationData.AbstractClass
 {
-  // Offset: 0x00000310 Length: 0x000000B1
+  // Offset: 0x00000338 Length: 0x000000B1
+}
+.mresource public FSharpOptimizationDataB.AbstractClass
+{
+  // Offset: 0x000003F0 Length: 0x00000003
 }
 .module AbstractClass.exe
-// MVID: {59B19213-333C-8BAF-A745-03831392B159}
+// MVID: {5C6C932A-2F62-D61B-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x010A0000
+// Image base: 0x01100000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ArgumentNamesInClosures01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ArgumentNamesInClosures01.il.bsl
index dcaa46948ee..e246082a556 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ArgumentNamesInClosures01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ArgumentNamesInClosures01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ArgumentNamesInClosures01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ArgumentNamesInClosures01
 {
-  // Offset: 0x00000000 Length: 0x0000039F
+  // Offset: 0x00000000 Length: 0x000003A7
+}
+.mresource public FSharpSignatureDataB.ArgumentNamesInClosures01
+{
+  // Offset: 0x000003B0 Length: 0x00000021
 }
 .mresource public FSharpOptimizationData.ArgumentNamesInClosures01
 {
-  // Offset: 0x000003A8 Length: 0x0000010D
+  // Offset: 0x000003D8 Length: 0x0000010D
+}
+.mresource public FSharpOptimizationDataB.ArgumentNamesInClosures01
+{
+  // Offset: 0x000004F0 Length: 0x0000000F
 }
 .module ArgumentNamesInClosures01.dll
-// MVID: {59B19213-39CA-41B5-A745-03831392B159}
+// MVID: {5C6C932A-0D49-6A8E-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02A00000
+// Image base: 0x01540000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/CodeGenRenamings01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/CodeGenRenamings01.il.bsl
index 6fab8d600ef..1903776ee8f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/CodeGenRenamings01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/CodeGenRenamings01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly CodeGenRenamings01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.CodeGenRenamings01
 {
-  // Offset: 0x00000000 Length: 0x000003CC
+  // Offset: 0x00000000 Length: 0x000003D4
+}
+.mresource public FSharpSignatureDataB.CodeGenRenamings01
+{
+  // Offset: 0x000003D8 Length: 0x00000019
 }
 .mresource public FSharpOptimizationData.CodeGenRenamings01
 {
-  // Offset: 0x000003D0 Length: 0x0000011B
+  // Offset: 0x000003F8 Length: 0x0000011B
+}
+.mresource public FSharpOptimizationDataB.CodeGenRenamings01
+{
+  // Offset: 0x00000518 Length: 0x00000000
 }
 .module CodeGenRenamings01.exe
-// MVID: {59B19213-8173-986B-A745-03831392B159}
+// MVID: {5C6C932A-B73A-4856-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x010A0000
+// Image base: 0x00800000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/CustomAttributeGenericParameter01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/CustomAttributeGenericParameter01.il.bsl
index 63d76598150..4ea475afa47 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/CustomAttributeGenericParameter01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/CustomAttributeGenericParameter01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly CustomAttributeGenericParameter01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.CustomAttributeGenericParameter01
 {
-  // Offset: 0x00000000 Length: 0x000002C2
+  // Offset: 0x00000000 Length: 0x000002CA
+}
+.mresource public FSharpSignatureDataB.CustomAttributeGenericParameter01
+{
+  // Offset: 0x000002D0 Length: 0x00000006
 }
 .mresource public FSharpOptimizationData.CustomAttributeGenericParameter01
 {
-  // Offset: 0x000002C8 Length: 0x0000007A
+  // Offset: 0x000002E0 Length: 0x0000007A
+}
+.mresource public FSharpOptimizationDataB.CustomAttributeGenericParameter01
+{
+  // Offset: 0x00000360 Length: 0x00000000
 }
 .module CustomAttributeGenericParameter01.exe
-// MVID: {59B19213-F08A-F524-A745-03831392B159}
+// MVID: {5C6C932A-BACA-6C4E-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x001D0000
+// Image base: 0x007B0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Decimal01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Decimal01.il.bsl
index d4e75ea07e1..c3927cb37c4 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Decimal01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Decimal01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Decimal01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Decimal01
 {
-  // Offset: 0x00000000 Length: 0x0000013F
+  // Offset: 0x00000000 Length: 0x00000147
+}
+.mresource public FSharpSignatureDataB.Decimal01
+{
+  // Offset: 0x00000150 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Decimal01
 {
-  // Offset: 0x00000148 Length: 0x00000050
+  // Offset: 0x00000158 Length: 0x00000050
+}
+.mresource public FSharpOptimizationDataB.Decimal01
+{
+  // Offset: 0x000001B0 Length: 0x00000000
 }
 .module Decimal01.exe
-// MVID: {59B19213-F150-FA46-A745-03831392B159}
+// MVID: {5C6C932A-FEF8-4534-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002E0000
+// Image base: 0x00C20000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/EntryPoint01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/EntryPoint01.il.bsl
index 4768f783d4c..750ba7ac9cd 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/EntryPoint01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/EntryPoint01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly EntryPoint01
 {
@@ -29,14 +29,22 @@
 }
 .mresource public FSharpSignatureData.EntryPoint01
 {
-  // Offset: 0x00000000 Length: 0x00000253
+  // Offset: 0x00000000 Length: 0x0000025B
+}
+.mresource public FSharpSignatureDataB.EntryPoint01
+{
+  // Offset: 0x00000260 Length: 0x00000008
 }
 .mresource public FSharpOptimizationData.EntryPoint01
 {
-  // Offset: 0x00000258 Length: 0x00000090
+  // Offset: 0x00000270 Length: 0x00000090
+}
+.mresource public FSharpOptimizationDataB.EntryPoint01
+{
+  // Offset: 0x00000308 Length: 0x00000000
 }
 .module EntryPoint01.exe
-// MVID: {59B19213-9846-72C1-A745-03831392B159}
+// MVID: {5C6C932A-2BE3-0781-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/EqualsOnUnions01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/EqualsOnUnions01.il.bsl
index 5d270545498..69534ae8836 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/EqualsOnUnions01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/EqualsOnUnions01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly EqualsOnUnions01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.EqualsOnUnions01
 {
-  // Offset: 0x00000000 Length: 0x0000064B
+  // Offset: 0x00000000 Length: 0x0000063F
+}
+.mresource public FSharpSignatureDataB.EqualsOnUnions01
+{
+  // Offset: 0x00000648 Length: 0x0000007B
 }
 .mresource public FSharpOptimizationData.EqualsOnUnions01
 {
-  // Offset: 0x00000650 Length: 0x000001C7
+  // Offset: 0x000006C8 Length: 0x000001C7
+}
+.mresource public FSharpOptimizationDataB.EqualsOnUnions01
+{
+  // Offset: 0x00000898 Length: 0x0000002A
 }
 .module EqualsOnUnions01.exe
-// MVID: {59B19213-BBFB-14A0-A745-03831392B159}
+// MVID: {5C6C932A-3FB9-D1D2-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01350000
+// Image base: 0x012E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop01.il.bsl
index 0f5a2183244..4ec67498f33 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ForLoop01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ForLoop01
 {
-  // Offset: 0x00000000 Length: 0x0000013F
+  // Offset: 0x00000000 Length: 0x00000147
+}
+.mresource public FSharpSignatureDataB.ForLoop01
+{
+  // Offset: 0x00000150 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.ForLoop01
 {
-  // Offset: 0x00000148 Length: 0x00000050
+  // Offset: 0x00000158 Length: 0x00000050
+}
+.mresource public FSharpOptimizationDataB.ForLoop01
+{
+  // Offset: 0x000001B0 Length: 0x00000000
 }
 .module ForLoop01.exe
-// MVID: {59B19213-1795-791C-A745-03831392B159}
+// MVID: {5C6C932A-192A-DA0D-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002E0000
+// Image base: 0x01290000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop02.il.bsl
index f54c8480177..e7501af908a 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ForLoop02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ForLoop02
 {
-  // Offset: 0x00000000 Length: 0x0000013F
+  // Offset: 0x00000000 Length: 0x00000147
+}
+.mresource public FSharpSignatureDataB.ForLoop02
+{
+  // Offset: 0x00000150 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.ForLoop02
 {
-  // Offset: 0x00000148 Length: 0x00000050
+  // Offset: 0x00000158 Length: 0x00000050
+}
+.mresource public FSharpOptimizationDataB.ForLoop02
+{
+  // Offset: 0x000001B0 Length: 0x00000000
 }
 .module ForLoop02.exe
-// MVID: {59B19213-1736-791C-A745-03831392B159}
+// MVID: {5C6C932A-04E7-DA0D-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x03030000
+// Image base: 0x01210000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop03.il.bsl
index e6fda0879b7..43a4dccdab2 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop03.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ForLoop03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ForLoop03
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ForLoop03
 {
-  // Offset: 0x00000000 Length: 0x000001FA
+  // Offset: 0x00000000 Length: 0x00000202
+}
+.mresource public FSharpSignatureDataB.ForLoop03
+{
+  // Offset: 0x00000208 Length: 0x00000005
 }
 .mresource public FSharpOptimizationData.ForLoop03
 {
-  // Offset: 0x00000200 Length: 0x0000007B
+  // Offset: 0x00000218 Length: 0x0000007B
+}
+.mresource public FSharpOptimizationDataB.ForLoop03
+{
+  // Offset: 0x00000298 Length: 0x00000000
 }
 .module ForLoop03.exe
-// MVID: {59B19213-1757-791C-A745-03831392B159}
+// MVID: {5C6C932A-2128-DA0D-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00680000
+// Image base: 0x007D0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/GeneralizationOnUnions01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/GeneralizationOnUnions01.il.bsl
index eca246c526b..cc949514fff 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/GeneralizationOnUnions01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/GeneralizationOnUnions01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly GeneralizationOnUnions01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.GeneralizationOnUnions01
 {
-  // Offset: 0x00000000 Length: 0x00000699
+  // Offset: 0x00000000 Length: 0x0000068D
+}
+.mresource public FSharpSignatureDataB.GeneralizationOnUnions01
+{
+  // Offset: 0x00000698 Length: 0x0000007F
 }
 .mresource public FSharpOptimizationData.GeneralizationOnUnions01
 {
-  // Offset: 0x000006A0 Length: 0x000001F4
+  // Offset: 0x00000720 Length: 0x000001F4
+}
+.mresource public FSharpOptimizationDataB.GeneralizationOnUnions01
+{
+  // Offset: 0x00000918 Length: 0x0000002A
 }
 .module GeneralizationOnUnions01.exe
-// MVID: {59B19213-4CA2-8CD1-A745-03831392B159}
+// MVID: {5C6C932A-CDC6-3158-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x014C0000
+// Image base: 0x00480000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/GenericTypeStaticField01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/GenericTypeStaticField01.il.bsl
index 0715db93d79..aaec73bfdd5 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/GenericTypeStaticField01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/GenericTypeStaticField01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly GenericTypeStaticField01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.GenericTypeStaticField01
 {
-  // Offset: 0x00000000 Length: 0x00000608
+  // Offset: 0x00000000 Length: 0x00000610
+}
+.mresource public FSharpSignatureDataB.GenericTypeStaticField01
+{
+  // Offset: 0x00000618 Length: 0x0000004C
 }
 .mresource public FSharpOptimizationData.GenericTypeStaticField01
 {
-  // Offset: 0x00000610 Length: 0x000001E7
+  // Offset: 0x00000668 Length: 0x000001E7
+}
+.mresource public FSharpOptimizationDataB.GenericTypeStaticField01
+{
+  // Offset: 0x00000858 Length: 0x00000018
 }
 .module GenericTypeStaticField01.exe
-// MVID: {59B19213-1E75-7E6B-A745-03831392B159}
+// MVID: {5C6C932A-315A-51B2-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00730000
+// Image base: 0x00350000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/IfThenElse01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/IfThenElse01.il.bsl
index 3505d4f8e23..1a00d01358f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/IfThenElse01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/IfThenElse01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly IfThenElse01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.IfThenElse01
 {
-  // Offset: 0x00000000 Length: 0x00000201
+  // Offset: 0x00000000 Length: 0x00000209
+}
+.mresource public FSharpSignatureDataB.IfThenElse01
+{
+  // Offset: 0x00000210 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.IfThenElse01
 {
-  // Offset: 0x00000208 Length: 0x00000092
+  // Offset: 0x00000218 Length: 0x00000092
+}
+.mresource public FSharpOptimizationDataB.IfThenElse01
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module IfThenElse01.dll
-// MVID: {59B19213-2D6C-0B5D-A745-03831392B159}
+// MVID: {5C6C932A-5AC2-49CA-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00BD0000
+// Image base: 0x01750000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/LetIfThenElse01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/LetIfThenElse01.il.bsl
index 8c6ee74160d..105d10f0c34 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/LetIfThenElse01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/LetIfThenElse01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly LetIfThenElse01
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x000001E5
 }
+.mresource public FSharpSignatureDataB.LetIfThenElse01
+{
+  // Offset: 0x000001F0 Length: 0x00000007
+}
 .mresource public FSharpOptimizationData.LetIfThenElse01
 {
-  // Offset: 0x000001F0 Length: 0x00000076
+  // Offset: 0x00000200 Length: 0x00000076
+}
+.mresource public FSharpOptimizationDataB.LetIfThenElse01
+{
+  // Offset: 0x00000280 Length: 0x00000000
 }
 .module LetIfThenElse01.exe
-// MVID: {59B19213-BE5A-D8FD-A745-03831392B159}
+// MVID: {5C6C932A-21CD-AB75-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02940000
+// Image base: 0x01920000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Lock01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Lock01.il.bsl
index 641008a218f..31f7ed975eb 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Lock01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Lock01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Lock01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Lock01
 {
-  // Offset: 0x00000000 Length: 0x00000184
+  // Offset: 0x00000000 Length: 0x0000018C
+}
+.mresource public FSharpSignatureDataB.Lock01
+{
+  // Offset: 0x00000190 Length: 0x00000001
 }
 .mresource public FSharpOptimizationData.Lock01
 {
-  // Offset: 0x00000188 Length: 0x00000064
+  // Offset: 0x00000198 Length: 0x00000064
+}
+.mresource public FSharpOptimizationDataB.Lock01
+{
+  // Offset: 0x00000200 Length: 0x00000000
 }
 .module Lock01.exe
-// MVID: {59B19213-2BCA-B308-A745-03831392B159}
+// MVID: {5C6C932A-E45C-9AF4-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02FB0000
+// Image base: 0x012D0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Marshal.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Marshal.il.bsl
index a4ee5c51231..01aab58aeab 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Marshal.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Marshal.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Marshal
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Marshal
 {
-  // Offset: 0x00000000 Length: 0x0000050B
+  // Offset: 0x00000000 Length: 0x00000513
+}
+.mresource public FSharpSignatureDataB.Marshal
+{
+  // Offset: 0x00000518 Length: 0x00000025
 }
 .mresource public FSharpOptimizationData.Marshal
 {
-  // Offset: 0x00000510 Length: 0x0000004E
+  // Offset: 0x00000548 Length: 0x0000004E
+}
+.mresource public FSharpOptimizationDataB.Marshal
+{
+  // Offset: 0x000005A0 Length: 0x00000000
 }
 .module Marshal.exe
-// MVID: {59B19213-7500-369C-A745-03831392B159}
+// MVID: {5C6C932A-BFDE-1069-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01080000
+// Image base: 0x00DE0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/MethodImplNoInline.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/MethodImplNoInline.il.bsl
index 9a2538f734d..05ed35e280f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/MethodImplNoInline.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/MethodImplNoInline.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly MethodImplNoInline
 {
@@ -25,20 +25,28 @@
 }
 .mresource public FSharpSignatureData.MethodImplNoInline
 {
-  // Offset: 0x00000000 Length: 0x000002FF
+  // Offset: 0x00000000 Length: 0x00000307
+}
+.mresource public FSharpSignatureDataB.MethodImplNoInline
+{
+  // Offset: 0x00000310 Length: 0x00000008
 }
 .mresource public FSharpOptimizationData.MethodImplNoInline
 {
-  // Offset: 0x00000308 Length: 0x000000F5
+  // Offset: 0x00000320 Length: 0x000000F5
+}
+.mresource public FSharpOptimizationDataB.MethodImplNoInline
+{
+  // Offset: 0x00000420 Length: 0x00000009
 }
 .module MethodImplNoInline.exe
-// MVID: {59B19213-4480-09E2-A745-03831392B159}
+// MVID: {5C6C932A-0639-3002-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00D80000
+// Image base: 0x01800000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/MethodImplNoInline02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/MethodImplNoInline02.il.bsl
index 784e3d51a37..03025764f42 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/MethodImplNoInline02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/MethodImplNoInline02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly MethodImplNoInline02
 {
@@ -25,20 +25,28 @@
 }
 .mresource public FSharpSignatureData.MethodImplNoInline02
 {
-  // Offset: 0x00000000 Length: 0x00000305
+  // Offset: 0x00000000 Length: 0x0000030D
+}
+.mresource public FSharpSignatureDataB.MethodImplNoInline02
+{
+  // Offset: 0x00000318 Length: 0x00000008
 }
 .mresource public FSharpOptimizationData.MethodImplNoInline02
 {
-  // Offset: 0x00000310 Length: 0x000000F9
+  // Offset: 0x00000328 Length: 0x000000F9
+}
+.mresource public FSharpOptimizationDataB.MethodImplNoInline02
+{
+  // Offset: 0x00000428 Length: 0x00000009
 }
 .module MethodImplNoInline02.exe
-// MVID: {59B19213-084F-1A8E-A745-03831392B159}
+// MVID: {5C6C932A-95A3-A4EB-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x012C0000
+// Image base: 0x002F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ModuleWithExpression01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ModuleWithExpression01.il.bsl
index 479fa38706d..7e97e8f943c 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ModuleWithExpression01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/ModuleWithExpression01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ModuleWithExpression01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ModuleWithExpression01
 {
-  // Offset: 0x00000000 Length: 0x0000020E
+  // Offset: 0x00000000 Length: 0x00000216
+}
+.mresource public FSharpSignatureDataB.ModuleWithExpression01
+{
+  // Offset: 0x00000220 Length: 0x00000001
 }
 .mresource public FSharpOptimizationData.ModuleWithExpression01
 {
-  // Offset: 0x00000218 Length: 0x000000A6
+  // Offset: 0x00000228 Length: 0x000000A6
+}
+.mresource public FSharpOptimizationDataB.ModuleWithExpression01
+{
+  // Offset: 0x000002D8 Length: 0x00000000
 }
 .module ModuleWithExpression01.exe
-// MVID: {59B19213-CD1E-A8B4-A745-03831392B159}
+// MVID: {5C6C932A-EE8D-AD63-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x030A0000
+// Image base: 0x02A90000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/NoBoxingOnDispose01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/NoBoxingOnDispose01.il.bsl
index 2e111b971f8..d98afc1af52 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/NoBoxingOnDispose01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/NoBoxingOnDispose01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly NoBoxingOnDispose01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.NoBoxingOnDispose01
 {
-  // Offset: 0x00000000 Length: 0x0000021A
+  // Offset: 0x00000000 Length: 0x00000222
+}
+.mresource public FSharpSignatureDataB.NoBoxingOnDispose01
+{
+  // Offset: 0x00000228 Length: 0x00000005
 }
 .mresource public FSharpOptimizationData.NoBoxingOnDispose01
 {
-  // Offset: 0x00000220 Length: 0x0000007F
+  // Offset: 0x00000238 Length: 0x0000007F
+}
+.mresource public FSharpOptimizationDataB.NoBoxingOnDispose01
+{
+  // Offset: 0x000002C0 Length: 0x00000000
 }
 .module NoBoxingOnDispose01.exe
-// MVID: {59B19213-4EA9-C934-A745-03831392B159}
+// MVID: {5C6C932A-C029-5AC1-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00590000
+// Image base: 0x00E80000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/NonEscapingArguments02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/NonEscapingArguments02.il.bsl
index 5209960dc5f..dfd1d6d45a0 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/NonEscapingArguments02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/NonEscapingArguments02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly NonEscapingArguments02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.NonEscapingArguments02
 {
-  // Offset: 0x00000000 Length: 0x00000359
+  // Offset: 0x00000000 Length: 0x00000361
+}
+.mresource public FSharpSignatureDataB.NonEscapingArguments02
+{
+  // Offset: 0x00000368 Length: 0x0000001C
 }
 .mresource public FSharpOptimizationData.NonEscapingArguments02
 {
-  // Offset: 0x00000360 Length: 0x000001A4
+  // Offset: 0x00000388 Length: 0x000001A4
+}
+.mresource public FSharpOptimizationDataB.NonEscapingArguments02
+{
+  // Offset: 0x00000530 Length: 0x0000000D
 }
 .module NonEscapingArguments02.dll
-// MVID: {59B19213-BB56-6582-A745-03831392B159}
+// MVID: {5C6C932A-3633-A298-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01730000
+// Image base: 0x01770000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/PreserveSig.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/PreserveSig.il.bsl
index 5a8b4ef3b76..321966a70e5 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/PreserveSig.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/PreserveSig.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly PreserveSig
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.PreserveSig
 {
-  // Offset: 0x00000000 Length: 0x000002F5
+  // Offset: 0x00000000 Length: 0x000002FD
+}
+.mresource public FSharpSignatureDataB.PreserveSig
+{
+  // Offset: 0x00000308 Length: 0x0000000F
 }
 .mresource public FSharpOptimizationData.PreserveSig
 {
-  // Offset: 0x00000300 Length: 0x0000004A
+  // Offset: 0x00000320 Length: 0x0000004A
+}
+.mresource public FSharpOptimizationDataB.PreserveSig
+{
+  // Offset: 0x00000370 Length: 0x00000000
 }
 .module PreserveSig.dll
-// MVID: {59B19213-E8CC-64FE-A745-03831392B159}
+// MVID: {5C6C932A-7097-7796-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01660000
+// Image base: 0x009A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Seq_for_all01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Seq_for_all01.il.bsl
index 5ccceb26460..e90707ba692 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Seq_for_all01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Seq_for_all01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Seq_for_all01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Seq_for_all01
 {
-  // Offset: 0x00000000 Length: 0x000001AB
+  // Offset: 0x00000000 Length: 0x000001B3
+}
+.mresource public FSharpSignatureDataB.Seq_for_all01
+{
+  // Offset: 0x000001B8 Length: 0x00000001
 }
 .mresource public FSharpOptimizationData.Seq_for_all01
 {
-  // Offset: 0x000001B0 Length: 0x00000072
+  // Offset: 0x000001C0 Length: 0x00000072
+}
+.mresource public FSharpOptimizationDataB.Seq_for_all01
+{
+  // Offset: 0x00000238 Length: 0x00000000
 }
 .module Seq_for_all01.exe
-// MVID: {59B19213-D30D-BA80-A745-03831392B159}
+// MVID: {5C6C932A-1CE8-5D72-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02A60000
+// Image base: 0x00A90000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Structs01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Structs01.il.bsl
index b3476b282f7..5f2e997939a 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Structs01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Structs01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Structs01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Structs01
 {
-  // Offset: 0x00000000 Length: 0x0000074D
+  // Offset: 0x00000000 Length: 0x00000741
+}
+.mresource public FSharpSignatureDataB.Structs01
+{
+  // Offset: 0x00000748 Length: 0x00000093
 }
 .mresource public FSharpOptimizationData.Structs01
 {
-  // Offset: 0x00000758 Length: 0x00000231
+  // Offset: 0x000007E0 Length: 0x00000231
+}
+.mresource public FSharpOptimizationDataB.Structs01
+{
+  // Offset: 0x00000A18 Length: 0x00000035
 }
 .module Structs01.exe
-// MVID: {59B19213-701F-5E27-A745-03831392B159}
+// MVID: {5C6C932A-A153-39D7-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01470000
+// Image base: 0x012F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Structs02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Structs02.il.bsl
index dc002382e1d..c3b2003669e 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Structs02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/Structs02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Structs02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Structs02
 {
-  // Offset: 0x00000000 Length: 0x00000787
+  // Offset: 0x00000000 Length: 0x0000077B
+}
+.mresource public FSharpSignatureDataB.Structs02
+{
+  // Offset: 0x00000780 Length: 0x00000096
 }
 .mresource public FSharpOptimizationData.Structs02
 {
-  // Offset: 0x00000790 Length: 0x00000237
+  // Offset: 0x00000820 Length: 0x00000237
+}
+.mresource public FSharpOptimizationDataB.Structs02
+{
+  // Offset: 0x00000A60 Length: 0x00000035
 }
 .module Structs02.exe
-// MVID: {59B19213-7040-5E27-A745-03831392B159}
+// MVID: {5C6C932A-BE14-39D7-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002F0000
+// Image base: 0x00D30000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/StructsAsArrayElements01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/StructsAsArrayElements01.il.bsl
index e3e7795ebd4..27c6a3dd1f5 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/StructsAsArrayElements01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/StructsAsArrayElements01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly StructsAsArrayElements01
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000758
 }
+.mresource public FSharpSignatureDataB.StructsAsArrayElements01
+{
+  // Offset: 0x00000760 Length: 0x0000009B
+}
 .mresource public FSharpOptimizationData.StructsAsArrayElements01
 {
-  // Offset: 0x00000760 Length: 0x0000022C
+  // Offset: 0x00000800 Length: 0x0000022C
+}
+.mresource public FSharpOptimizationDataB.StructsAsArrayElements01
+{
+  // Offset: 0x00000A30 Length: 0x00000038
 }
 .module StructsAsArrayElements01.dll
-// MVID: {5B17FC4F-29F3-6E68-A745-03834FFC175B}
+// MVID: {5C6C932A-0C0D-4AEA-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00E30000
+// Image base: 0x01240000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/TryWith_NoFilterBlocks01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/TryWith_NoFilterBlocks01.il.bsl
index 63da7e6e404..e4d356babb9 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/TryWith_NoFilterBlocks01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/TryWith_NoFilterBlocks01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TryWith_NoFilterBlocks01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TryWith_NoFilterBlocks01
 {
-  // Offset: 0x00000000 Length: 0x0000015D
+  // Offset: 0x00000000 Length: 0x00000165
+}
+.mresource public FSharpSignatureDataB.TryWith_NoFilterBlocks01
+{
+  // Offset: 0x00000170 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.TryWith_NoFilterBlocks01
 {
-  // Offset: 0x00000168 Length: 0x0000005F
+  // Offset: 0x00000178 Length: 0x0000005F
+}
+.mresource public FSharpOptimizationDataB.TryWith_NoFilterBlocks01
+{
+  // Offset: 0x000001E0 Length: 0x00000000
 }
 .module TryWith_NoFilterBlocks01.exe
-// MVID: {59B19213-3DEF-9A40-A745-03831392B159}
+// MVID: {5C6C932A-6F86-BEF5-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x017A0000
+// Image base: 0x00DE0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/cas.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/cas.il.bsl
index 5f937b00b51..e1a504535aa 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/cas.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/cas.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly extern cas
 {
@@ -36,20 +36,28 @@
 }
 .mresource public FSharpSignatureData.cas
 {
-  // Offset: 0x00000000 Length: 0x000005DF
+  // Offset: 0x00000000 Length: 0x00000625
+}
+.mresource public FSharpSignatureDataB.cas
+{
+  // Offset: 0x00000630 Length: 0x00000026
 }
 .mresource public FSharpOptimizationData.cas
 {
-  // Offset: 0x000005E8 Length: 0x000000F3
+  // Offset: 0x00000660 Length: 0x000000F3
+}
+.mresource public FSharpOptimizationDataB.cas
+{
+  // Offset: 0x00000758 Length: 0x00000008
 }
 .module cas.exe
-// MVID: {59B19213-35EA-18E3-A745-03831392B159}
+// MVID: {5C6C932A-AB6F-5076-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x006A0000
+// Image base: 0x00F20000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation01.il.bsl
index 479e3804fe3..034d32e8c21 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Mutation01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Mutation01
 {
-  // Offset: 0x00000000 Length: 0x00000705
+  // Offset: 0x00000000 Length: 0x000006F9
+}
+.mresource public FSharpSignatureDataB.Mutation01
+{
+  // Offset: 0x00000700 Length: 0x00000098
 }
 .mresource public FSharpOptimizationData.Mutation01
 {
-  // Offset: 0x00000710 Length: 0x00000220
+  // Offset: 0x000007A0 Length: 0x00000220
+}
+.mresource public FSharpOptimizationDataB.Mutation01
+{
+  // Offset: 0x000009C8 Length: 0x00000039
 }
 .module Mutation01.exe
-// MVID: {59B19213-8C6A-2EAE-A745-03831392B159}
+// MVID: {5C6C932A-B7C4-3CC1-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002E0000
+// Image base: 0x01800000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation02.il.bsl
index b26df9510b4..cb0bf75c2cc 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation02.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x000001A2
 }
+.mresource public FSharpSignatureDataB.Mutation02
+{
+  // Offset: 0x000001A8 Length: 0x00000001
+}
 .mresource public FSharpOptimizationData.Mutation02
 {
-  // Offset: 0x000001A8 Length: 0x0000006C
+  // Offset: 0x000001B0 Length: 0x0000006C
+}
+.mresource public FSharpOptimizationDataB.Mutation02
+{
+  // Offset: 0x00000220 Length: 0x00000000
 }
 .module Mutation02.exe
-// MVID: {5B9A632A-8C6A-2F0D-A745-03832A639A5B}
+// MVID: {5C6C932A-F355-8B25-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02750000
+// Image base: 0x00490000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation03.il.bsl
index e43810c10bf..16c36210623 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation03.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation03.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x000001A2
 }
+.mresource public FSharpSignatureDataB.Mutation03
+{
+  // Offset: 0x000001A8 Length: 0x00000001
+}
 .mresource public FSharpOptimizationData.Mutation03
 {
-  // Offset: 0x000001A8 Length: 0x0000006C
+  // Offset: 0x000001B0 Length: 0x0000006C
+}
+.mresource public FSharpOptimizationDataB.Mutation03
+{
+  // Offset: 0x00000220 Length: 0x00000000
 }
 .module Mutation03.exe
-// MVID: {5B9A632A-8C6A-2EEC-A745-03832A639A5B}
+// MVID: {5C6C932A-C3FA-DC73-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02CA0000
+// Image base: 0x01200000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation04.il.bsl
index 444d581fc63..1ab0ab25dd2 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation04.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation04.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x000001B5
 }
+.mresource public FSharpSignatureDataB.Mutation04
+{
+  // Offset: 0x000001C0 Length: 0x00000001
+}
 .mresource public FSharpOptimizationData.Mutation04
 {
-  // Offset: 0x000001C0 Length: 0x0000006C
+  // Offset: 0x000001C8 Length: 0x0000006C
+}
+.mresource public FSharpOptimizationDataB.Mutation04
+{
+  // Offset: 0x00000238 Length: 0x00000000
 }
 .module Mutation04.exe
-// MVID: {5B9A632A-8C6A-2E43-A745-03832A639A5B}
+// MVID: {5C6C932A-648B-8363-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02A80000
+// Image base: 0x012F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation05.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation05.il.bsl
index fc052bb6e08..bfc61b7f359 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation05.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation05.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x000004CE
 }
+.mresource public FSharpSignatureDataB.Mutation05
+{
+  // Offset: 0x000004D8 Length: 0x0000003B
+}
 .mresource public FSharpOptimizationData.Mutation05
 {
-  // Offset: 0x000004D8 Length: 0x00000127
+  // Offset: 0x00000518 Length: 0x00000127
+}
+.mresource public FSharpOptimizationDataB.Mutation05
+{
+  // Offset: 0x00000648 Length: 0x00000016
 }
 .module Mutation05.exe
-// MVID: {5B9A632A-8C6A-2E22-A745-03832A639A5B}
+// MVID: {5C6C932A-3A30-3EA9-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x008E0000
+// Image base: 0x00CF0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Operators/comparison_decimal01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Operators/comparison_decimal01.il.bsl
index a30c4a069bd..1f3c46bb0f0 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Operators/comparison_decimal01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Operators/comparison_decimal01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly comparison_decimal01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.comparison_decimal01
 {
-  // Offset: 0x00000000 Length: 0x00000176
+  // Offset: 0x00000000 Length: 0x0000017E
+}
+.mresource public FSharpSignatureDataB.comparison_decimal01
+{
+  // Offset: 0x00000188 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.comparison_decimal01
 {
-  // Offset: 0x00000180 Length: 0x0000005B
+  // Offset: 0x00000190 Length: 0x0000005B
+}
+.mresource public FSharpOptimizationDataB.comparison_decimal01
+{
+  // Offset: 0x000001F0 Length: 0x00000000
 }
 .module comparison_decimal01.exe
-// MVID: {59B19240-76D8-7EE3-A745-03834092B159}
+// MVID: {5C6C932A-0B02-E065-A745-03832A936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02980000
+// Image base: 0x01610000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl
index 78bfe96fcc7..ba70a0cd54a 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl
@@ -40,18 +40,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000614
 }
+.mresource public FSharpSignatureDataB.Linq101Aggregates01
+{
+  // Offset: 0x00000618 Length: 0x00000027
+}
 .mresource public FSharpOptimizationData.Linq101Aggregates01
 {
-  // Offset: 0x00000618 Length: 0x00000211
+  // Offset: 0x00000648 Length: 0x00000211
+}
+.mresource public FSharpOptimizationDataB.Linq101Aggregates01
+{
+  // Offset: 0x00000860 Length: 0x00000000
 }
 .module Linq101Aggregates01.exe
-// MVID: {5B9A632A-D281-4783-A745-03832A639A5B}
+// MVID: {5C6C932B-CA9F-F767-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x026B0000
+// Image base: 0x00490000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.il.bsl
index b0aa6e961a6..d9fa52b0834 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.il.bsl
@@ -35,18 +35,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000038A
 }
+.mresource public FSharpSignatureDataB.Linq101ElementOperators01
+{
+  // Offset: 0x00000390 Length: 0x0000000C
+}
 .mresource public FSharpOptimizationData.Linq101ElementOperators01
 {
-  // Offset: 0x00000390 Length: 0x00000127
+  // Offset: 0x000003A0 Length: 0x00000127
+}
+.mresource public FSharpOptimizationDataB.Linq101ElementOperators01
+{
+  // Offset: 0x000004D0 Length: 0x00000000
 }
 .module Linq101ElementOperators01.exe
-// MVID: {5B9A632A-19D7-C20D-A745-03832A639A5B}
+// MVID: {5C6C932B-ED84-7458-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x028F0000
+// Image base: 0x01300000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Grouping01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Grouping01.il.bsl
index 050bdf1cc6d..1e709ee5c7e 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Grouping01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Grouping01.il.bsl
@@ -40,18 +40,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000040F
 }
+.mresource public FSharpSignatureDataB.Linq101Grouping01
+{
+  // Offset: 0x00000418 Length: 0x0000001E
+}
 .mresource public FSharpOptimizationData.Linq101Grouping01
 {
-  // Offset: 0x00000418 Length: 0x00000129
+  // Offset: 0x00000440 Length: 0x00000129
+}
+.mresource public FSharpOptimizationDataB.Linq101Grouping01
+{
+  // Offset: 0x00000570 Length: 0x00000000
 }
 .module Linq101Grouping01.exe
-// MVID: {5B9A68C1-FB79-E5BF-A745-0383C1689A5B}
+// MVID: {5C6C932B-10D0-8035-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x025F0000
+// Image base: 0x02C50000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Joins01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Joins01.il.bsl
index f985ce06194..54cf82b63a8 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Joins01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Joins01.il.bsl
@@ -40,18 +40,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000316
 }
+.mresource public FSharpSignatureDataB.Linq101Joins01
+{
+  // Offset: 0x00000320 Length: 0x00000011
+}
 .mresource public FSharpOptimizationData.Linq101Joins01
 {
-  // Offset: 0x00000320 Length: 0x000000C3
+  // Offset: 0x00000338 Length: 0x000000C3
+}
+.mresource public FSharpOptimizationDataB.Linq101Joins01
+{
+  // Offset: 0x00000400 Length: 0x00000000
 }
 .module Linq101Joins01.exe
-// MVID: {5B9A68C1-151B-685E-A745-0383C1689A5B}
+// MVID: {5C6C932B-25BC-8F2D-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x026A0000
+// Image base: 0x00D00000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Ordering01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Ordering01.il.bsl
index 79848765473..b1d6936810d 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Ordering01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Ordering01.il.bsl
@@ -35,18 +35,26 @@
 {
   // Offset: 0x00000000 Length: 0x000003BA
 }
+.mresource public FSharpSignatureDataB.Linq101Ordering01
+{
+  // Offset: 0x000003C0 Length: 0x00000012
+}
 .mresource public FSharpOptimizationData.Linq101Ordering01
 {
-  // Offset: 0x000003C0 Length: 0x00000134
+  // Offset: 0x000003D8 Length: 0x00000134
+}
+.mresource public FSharpOptimizationDataB.Linq101Ordering01
+{
+  // Offset: 0x00000510 Length: 0x00000000
 }
 .module Linq101Ordering01.exe
-// MVID: {5B9A632A-649A-6956-A745-03832A639A5B}
+// MVID: {5C6C932B-763B-E3AC-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00AD0000
+// Image base: 0x01B50000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.il.bsl
index b210d7f3c90..89a9c2c360d 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.il.bsl
@@ -35,18 +35,26 @@
 {
   // Offset: 0x00000000 Length: 0x000003DE
 }
+.mresource public FSharpSignatureDataB.Linq101Partitioning01
+{
+  // Offset: 0x000003E8 Length: 0x00000014
+}
 .mresource public FSharpOptimizationData.Linq101Partitioning01
 {
-  // Offset: 0x000003E8 Length: 0x00000138
+  // Offset: 0x00000400 Length: 0x00000138
+}
+.mresource public FSharpOptimizationDataB.Linq101Partitioning01
+{
+  // Offset: 0x00000540 Length: 0x00000000
 }
 .module Linq101Partitioning01.exe
-// MVID: {5B9A632A-B280-A6A2-A745-03832A639A5B}
+// MVID: {5C6C932B-4363-38D6-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00AF0000
+// Image base: 0x01290000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.il.bsl
index d2b715c5820..6a7ef8b91ce 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.il.bsl
@@ -40,18 +40,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000039F
 }
+.mresource public FSharpSignatureDataB.Linq101Quantifiers01
+{
+  // Offset: 0x000003A8 Length: 0x00000012
+}
 .mresource public FSharpOptimizationData.Linq101Quantifiers01
 {
-  // Offset: 0x000003A8 Length: 0x000000FF
+  // Offset: 0x000003C0 Length: 0x000000FF
+}
+.mresource public FSharpOptimizationDataB.Linq101Quantifiers01
+{
+  // Offset: 0x000004C8 Length: 0x00000000
 }
 .module Linq101Quantifiers01.exe
-// MVID: {5B9A632A-76DD-E373-A745-03832A639A5B}
+// MVID: {5C6C932B-BDD0-1A4E-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x025D0000
+// Image base: 0x01A60000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Select01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Select01.il.bsl
index 8afae23a726..298eb5e5df6 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Select01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Select01.il.bsl
@@ -35,18 +35,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000663
 }
+.mresource public FSharpSignatureDataB.Linq101Select01
+{
+  // Offset: 0x00000668 Length: 0x00000035
+}
 .mresource public FSharpOptimizationData.Linq101Select01
 {
-  // Offset: 0x00000668 Length: 0x00000204
+  // Offset: 0x000006A8 Length: 0x00000204
+}
+.mresource public FSharpOptimizationDataB.Linq101Select01
+{
+  // Offset: 0x000008B0 Length: 0x00000000
 }
 .module Linq101Select01.exe
-// MVID: {5B9A632A-6057-8F80-A745-03832A639A5B}
+// MVID: {5C6C932B-0F15-430A-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00FF0000
+// Image base: 0x00680000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl
index 7b308ef661d..a19053aa1cd 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl
@@ -35,18 +35,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000398
 }
+.mresource public FSharpSignatureDataB.Linq101SetOperators01
+{
+  // Offset: 0x000003A0 Length: 0x0000000E
+}
 .mresource public FSharpOptimizationData.Linq101SetOperators01
 {
-  // Offset: 0x000003A0 Length: 0x0000011E
+  // Offset: 0x000003B8 Length: 0x0000011E
+}
+.mresource public FSharpOptimizationDataB.Linq101SetOperators01
+{
+  // Offset: 0x000004E0 Length: 0x00000000
 }
 .module Linq101SetOperators01.exe
-// MVID: {5B9A632A-4EE5-349F-A745-03832A639A5B}
+// MVID: {5C6C932B-7E0C-F396-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x026A0000
+// Image base: 0x033A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Where01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Where01.il.bsl
index b673d1193cc..be7a8faca25 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Where01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Where01.il.bsl
@@ -35,18 +35,26 @@
 {
   // Offset: 0x00000000 Length: 0x000003D6
 }
+.mresource public FSharpSignatureDataB.Linq101Where01
+{
+  // Offset: 0x000003E0 Length: 0x00000012
+}
 .mresource public FSharpOptimizationData.Linq101Where01
 {
-  // Offset: 0x000003E0 Length: 0x0000012E
+  // Offset: 0x000003F8 Length: 0x0000012E
+}
+.mresource public FSharpOptimizationDataB.Linq101Where01
+{
+  // Offset: 0x00000530 Length: 0x00000000
 }
 .module Linq101Where01.exe
-// MVID: {5B9A632A-FF23-CD21-A745-03832A639A5B}
+// MVID: {5C6C932B-7DD2-6B6A-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x009E0000
+// Image base: 0x01210000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest1.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest1.il.bsl
index 884c03da12a..b909f7cd49e 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest1.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest1.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SeqExpressionSteppingTest1
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.SeqExpressionSteppingTest1
 {
-  // Offset: 0x00000000 Length: 0x00000267
+  // Offset: 0x00000000 Length: 0x0000026F
+}
+.mresource public FSharpSignatureDataB.SeqExpressionSteppingTest1
+{
+  // Offset: 0x00000278 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.SeqExpressionSteppingTest1
 {
-  // Offset: 0x00000270 Length: 0x000000AD
+  // Offset: 0x00000280 Length: 0x000000AD
+}
+.mresource public FSharpOptimizationDataB.SeqExpressionSteppingTest1
+{
+  // Offset: 0x00000338 Length: 0x00000000
 }
 .module SeqExpressionSteppingTest1.exe
-// MVID: {59B19240-2432-947D-A745-03834092B159}
+// MVID: {5C6C932B-97EE-0B32-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002D0000
+// Image base: 0x00E30000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest2.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest2.il.bsl
index e5450059c32..f17100b6b91 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest2.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest2.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SeqExpressionSteppingTest2
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.SeqExpressionSteppingTest2
 {
-  // Offset: 0x00000000 Length: 0x00000267
+  // Offset: 0x00000000 Length: 0x0000026F
+}
+.mresource public FSharpSignatureDataB.SeqExpressionSteppingTest2
+{
+  // Offset: 0x00000278 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.SeqExpressionSteppingTest2
 {
-  // Offset: 0x00000270 Length: 0x000000AD
+  // Offset: 0x00000280 Length: 0x000000AD
+}
+.mresource public FSharpOptimizationDataB.SeqExpressionSteppingTest2
+{
+  // Offset: 0x00000338 Length: 0x00000000
 }
 .module SeqExpressionSteppingTest2.exe
-// MVID: {59B19240-2432-951E-A745-03834092B159}
+// MVID: {5C6C932B-74C9-FC32-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00690000
+// Image base: 0x010F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest3.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest3.il.bsl
index 37e1a739636..012d9db3253 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest3.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest3.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SeqExpressionSteppingTest3
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.SeqExpressionSteppingTest3
 {
-  // Offset: 0x00000000 Length: 0x00000277
+  // Offset: 0x00000000 Length: 0x0000027F
+}
+.mresource public FSharpSignatureDataB.SeqExpressionSteppingTest3
+{
+  // Offset: 0x00000288 Length: 0x00000005
 }
 .mresource public FSharpOptimizationData.SeqExpressionSteppingTest3
 {
-  // Offset: 0x00000280 Length: 0x000000AD
+  // Offset: 0x00000298 Length: 0x000000AD
+}
+.mresource public FSharpOptimizationDataB.SeqExpressionSteppingTest3
+{
+  // Offset: 0x00000350 Length: 0x00000000
 }
 .module SeqExpressionSteppingTest3.exe
-// MVID: {59B19240-2432-943F-A745-03834092B159}
+// MVID: {5C6C932B-A424-AAE4-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02660000
+// Image base: 0x003B0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest4.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest4.il.bsl
index ea764c62bb0..952211cb6bb 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest4.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest4.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000026F
 }
+.mresource public FSharpSignatureDataB.SeqExpressionSteppingTest4
+{
+  // Offset: 0x00000278 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.SeqExpressionSteppingTest4
 {
-  // Offset: 0x00000278 Length: 0x000000AD
+  // Offset: 0x00000280 Length: 0x000000AD
+}
+.mresource public FSharpOptimizationDataB.SeqExpressionSteppingTest4
+{
+  // Offset: 0x00000338 Length: 0x00000000
 }
 .module SeqExpressionSteppingTest4.exe
-// MVID: {5B9A68C1-2432-93E0-A745-0383C1689A5B}
+// MVID: {5C6C932B-E627-5A98-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00760000
+// Image base: 0x00960000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest5.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest5.il.bsl
index 0af7608e807..e2e39952483 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest5.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest5.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000026F
 }
+.mresource public FSharpSignatureDataB.SeqExpressionSteppingTest5
+{
+  // Offset: 0x00000278 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.SeqExpressionSteppingTest5
 {
-  // Offset: 0x00000278 Length: 0x000000AD
+  // Offset: 0x00000280 Length: 0x000000AD
+}
+.mresource public FSharpOptimizationDataB.SeqExpressionSteppingTest5
+{
+  // Offset: 0x00000338 Length: 0x00000000
 }
 .module SeqExpressionSteppingTest5.exe
-// MVID: {5B9A632A-2432-9401-A745-03832A639A5B}
+// MVID: {5C6C932B-1582-094B-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x026A0000
+// Image base: 0x015E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest6.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest6.il.bsl
index d06d692b20b..25b1be9efa7 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest6.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest6.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x000002A4
 }
+.mresource public FSharpSignatureDataB.SeqExpressionSteppingTest6
+{
+  // Offset: 0x000002A8 Length: 0x00000006
+}
 .mresource public FSharpOptimizationData.SeqExpressionSteppingTest6
 {
-  // Offset: 0x000002A8 Length: 0x000000BA
+  // Offset: 0x000002B8 Length: 0x000000BA
+}
+.mresource public FSharpOptimizationDataB.SeqExpressionSteppingTest6
+{
+  // Offset: 0x00000378 Length: 0x00000000
 }
 .module SeqExpressionSteppingTest6.exe
-// MVID: {5B9A632A-2432-94A2-A745-03832A639A5B}
+// MVID: {5C6C932B-F25D-FA4A-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01330000
+// Image base: 0x01260000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest7.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest7.il.bsl
index ae9e2337813..6f0f52b1d05 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest7.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest7.il.bsl
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000272
 }
+.mresource public FSharpSignatureDataB.SeqExpressionSteppingTest7
+{
+  // Offset: 0x00000278 Length: 0x00000007
+}
 .mresource public FSharpOptimizationData.SeqExpressionSteppingTest7
 {
-  // Offset: 0x00000278 Length: 0x00000098
+  // Offset: 0x00000288 Length: 0x00000098
+}
+.mresource public FSharpOptimizationDataB.SeqExpressionSteppingTest7
+{
+  // Offset: 0x00000328 Length: 0x00000000
 }
 .module SeqExpressionSteppingTest7.exe
-// MVID: {5B9A632A-2432-93C3-A745-03832A639A5B}
+// MVID: {5C6C932B-21B8-A8FD-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02450000
+// Image base: 0x03150000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.il.bsl
index d03a45be913..f8f309e3456 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SeqExpressionTailCalls01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.SeqExpressionTailCalls01
 {
-  // Offset: 0x00000000 Length: 0x0000021D
+  // Offset: 0x00000000 Length: 0x00000225
+}
+.mresource public FSharpSignatureDataB.SeqExpressionTailCalls01
+{
+  // Offset: 0x00000230 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.SeqExpressionTailCalls01
 {
-  // Offset: 0x00000228 Length: 0x0000008C
+  // Offset: 0x00000238 Length: 0x0000008C
+}
+.mresource public FSharpOptimizationDataB.SeqExpressionTailCalls01
+{
+  // Offset: 0x000002C8 Length: 0x00000000
 }
 .module SeqExpressionTailCalls01.exe
-// MVID: {59B19240-093A-A6BE-A745-03834092B159}
+// MVID: {5C6C932B-78CB-49A7-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x027D0000
+// Image base: 0x00310000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.il.bsl
index 4cca2bf3f7c..1bc34c3aa9a 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SeqExpressionTailCalls02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.SeqExpressionTailCalls02
 {
-  // Offset: 0x00000000 Length: 0x00000256
+  // Offset: 0x00000000 Length: 0x0000025E
+}
+.mresource public FSharpSignatureDataB.SeqExpressionTailCalls02
+{
+  // Offset: 0x00000268 Length: 0x00000008
 }
 .mresource public FSharpOptimizationData.SeqExpressionTailCalls02
 {
-  // Offset: 0x00000260 Length: 0x0000009E
+  // Offset: 0x00000278 Length: 0x0000009E
+}
+.mresource public FSharpOptimizationDataB.SeqExpressionTailCalls02
+{
+  // Offset: 0x00000320 Length: 0x00000000
 }
 .module SeqExpressionTailCalls02.exe
-// MVID: {59B19240-093A-EC43-A745-03834092B159}
+// MVID: {5C6C932B-3D3A-FB43-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x017C0000
+// Image base: 0x01300000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/LetBinding01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/LetBinding01.il.bsl
index c29de0c7bdc..9942ef5ef74 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/LetBinding01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/LetBinding01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly LetBinding01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.LetBinding01
 {
-  // Offset: 0x00000000 Length: 0x000001B4
+  // Offset: 0x00000000 Length: 0x000001BC
+}
+.mresource public FSharpSignatureDataB.LetBinding01
+{
+  // Offset: 0x000001C0 Length: 0x00000001
 }
 .mresource public FSharpOptimizationData.LetBinding01
 {
-  // Offset: 0x000001B8 Length: 0x00000070
+  // Offset: 0x000001C8 Length: 0x00000070
+}
+.mresource public FSharpOptimizationDataB.LetBinding01
+{
+  // Offset: 0x00000240 Length: 0x00000000
 }
 .module LetBinding01.exe
-// MVID: {59B19250-269D-BEEF-A745-03835092B159}
+// MVID: {5C6C932B-5C17-B285-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01570000
+// Image base: 0x010B0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Class01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Class01.il.bsl
index 2dd345fe2d4..76e9baec9e7 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Class01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Class01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly StaticInit_Class01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.StaticInit_Class01
 {
-  // Offset: 0x00000000 Length: 0x00000335
+  // Offset: 0x00000000 Length: 0x0000033D
+}
+.mresource public FSharpSignatureDataB.StaticInit_Class01
+{
+  // Offset: 0x00000348 Length: 0x00000011
 }
 .mresource public FSharpOptimizationData.StaticInit_Class01
 {
-  // Offset: 0x00000340 Length: 0x000000AD
+  // Offset: 0x00000360 Length: 0x000000AD
+}
+.mresource public FSharpOptimizationDataB.StaticInit_Class01
+{
+  // Offset: 0x00000418 Length: 0x00000003
 }
 .module StaticInit_Class01.dll
-// MVID: {59B19250-EC34-E66E-A745-03835092B159}
+// MVID: {5C6C932B-A030-4E6D-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00FE0000
+// Image base: 0x00690000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Module01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Module01.il.bsl
index c9cd745c46a..0f31c26c331 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Module01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Module01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly StaticInit_Module01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.StaticInit_Module01
 {
-  // Offset: 0x00000000 Length: 0x000002A7
+  // Offset: 0x00000000 Length: 0x000002AF
+}
+.mresource public FSharpSignatureDataB.StaticInit_Module01
+{
+  // Offset: 0x000002B8 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.StaticInit_Module01
 {
-  // Offset: 0x000002B0 Length: 0x000000DF
+  // Offset: 0x000002C0 Length: 0x000000DF
+}
+.mresource public FSharpOptimizationDataB.StaticInit_Module01
+{
+  // Offset: 0x000003A8 Length: 0x00000000
 }
 .module StaticInit_Module01.dll
-// MVID: {59B19250-705F-DF4F-A745-03835092B159}
+// MVID: {5C6C932B-6B9E-F72A-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00370000
+// Image base: 0x01000000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Struct01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Struct01.il.bsl
index 55664ad8b3a..80df9fbe194 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Struct01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Struct01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly StaticInit_Struct01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.StaticInit_Struct01
 {
-  // Offset: 0x00000000 Length: 0x000007B1
+  // Offset: 0x00000000 Length: 0x000007A5
+}
+.mresource public FSharpSignatureDataB.StaticInit_Struct01
+{
+  // Offset: 0x000007B0 Length: 0x0000009B
 }
 .mresource public FSharpOptimizationData.StaticInit_Struct01
 {
-  // Offset: 0x000007B8 Length: 0x0000021F
+  // Offset: 0x00000850 Length: 0x0000021F
+}
+.mresource public FSharpOptimizationDataB.StaticInit_Struct01
+{
+  // Offset: 0x00000A78 Length: 0x00000035
 }
 .module StaticInit_Struct01.dll
-// MVID: {59B19250-05F6-D6CB-A745-03835092B159}
+// MVID: {5C6C932B-B529-9BEA-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02BA0000
+// Image base: 0x00AD0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch01.il.bsl
index aa77b1c7e0e..11205700317 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SteppingMatch01
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000021C
 }
+.mresource public FSharpSignatureDataB.SteppingMatch01
+{
+  // Offset: 0x00000220 Length: 0x00000007
+}
 .mresource public FSharpOptimizationData.SteppingMatch01
 {
-  // Offset: 0x00000220 Length: 0x0000007A
+  // Offset: 0x00000230 Length: 0x0000007A
+}
+.mresource public FSharpOptimizationDataB.SteppingMatch01
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module SteppingMatch01.dll
-// MVID: {59B19213-ABFD-13F6-A745-03831392B159}
+// MVID: {5C6C932B-8800-E210-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00CA0000
+// Image base: 0x01250000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch02.il.bsl
index 453261211ee..cb7426bc48b 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SteppingMatch02
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000021C
 }
+.mresource public FSharpSignatureDataB.SteppingMatch02
+{
+  // Offset: 0x00000220 Length: 0x00000007
+}
 .mresource public FSharpOptimizationData.SteppingMatch02
 {
-  // Offset: 0x00000220 Length: 0x0000007A
+  // Offset: 0x00000230 Length: 0x0000007A
+}
+.mresource public FSharpOptimizationDataB.SteppingMatch02
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module SteppingMatch02.dll
-// MVID: {59B19213-CAC2-C63D-A745-03831392B159}
+// MVID: {5C6C932B-8401-E210-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01090000
+// Image base: 0x012B0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch03.il.bsl
index f2ced1b23d2..e7e10ca8faa 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch03.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SteppingMatch03
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000231
 }
+.mresource public FSharpSignatureDataB.SteppingMatch03
+{
+  // Offset: 0x00000238 Length: 0x00000009
+}
 .mresource public FSharpOptimizationData.SteppingMatch03
 {
-  // Offset: 0x00000238 Length: 0x0000007A
+  // Offset: 0x00000248 Length: 0x0000007A
+}
+.mresource public FSharpOptimizationDataB.SteppingMatch03
+{
+  // Offset: 0x000002C8 Length: 0x00000000
 }
 .module SteppingMatch03.dll
-// MVID: {59B19213-4E87-D110-A745-03831392B159}
+// MVID: {5C6C932B-8002-E210-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00D00000
+// Image base: 0x00C20000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch04.il.bsl
index dc909634a1a..d0566b1659f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch04.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch04.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SteppingMatch04
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000232
 }
+.mresource public FSharpSignatureDataB.SteppingMatch04
+{
+  // Offset: 0x00000238 Length: 0x00000009
+}
 .mresource public FSharpOptimizationData.SteppingMatch04
 {
-  // Offset: 0x00000238 Length: 0x0000007B
+  // Offset: 0x00000248 Length: 0x0000007B
+}
+.mresource public FSharpOptimizationDataB.SteppingMatch04
+{
+  // Offset: 0x000002C8 Length: 0x00000000
 }
 .module SteppingMatch04.dll
-// MVID: {59B19213-6D4C-8357-A745-03831392B159}
+// MVID: {5C6C932B-7BFB-E210-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02770000
+// Image base: 0x03190000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch05.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch05.il.bsl
index 8da1f763ae7..6950472a441 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch05.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch05.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SteppingMatch05
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000232
 }
+.mresource public FSharpSignatureDataB.SteppingMatch05
+{
+  // Offset: 0x00000238 Length: 0x00000009
+}
 .mresource public FSharpOptimizationData.SteppingMatch05
 {
-  // Offset: 0x00000238 Length: 0x0000007B
+  // Offset: 0x00000248 Length: 0x0000007B
+}
+.mresource public FSharpOptimizationDataB.SteppingMatch05
+{
+  // Offset: 0x000002C8 Length: 0x00000000
 }
 .module SteppingMatch05.dll
-// MVID: {59B19213-30E9-4ADA-A745-03831392B159}
+// MVID: {5C6C932B-77FC-E210-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02FF0000
+// Image base: 0x00680000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch06.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch06.il.bsl
index 078b8cd73e3..b72644640fe 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch06.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch06.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SteppingMatch06
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.SteppingMatch06
 {
-  // Offset: 0x00000000 Length: 0x0000067D
+  // Offset: 0x00000000 Length: 0x00000679
+}
+.mresource public FSharpSignatureDataB.SteppingMatch06
+{
+  // Offset: 0x00000680 Length: 0x0000007D
 }
 .mresource public FSharpOptimizationData.SteppingMatch06
 {
-  // Offset: 0x00000688 Length: 0x000001D9
+  // Offset: 0x00000708 Length: 0x000001D9
+}
+.mresource public FSharpOptimizationDataB.SteppingMatch06
+{
+  // Offset: 0x000008E8 Length: 0x0000002A
 }
 .module SteppingMatch06.dll
-// MVID: {59B19213-4FAE-FD21-A745-03831392B159}
+// MVID: {5C6C932B-73FD-E210-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x028F0000
+// Image base: 0x02FC0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch07.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch07.il.bsl
index a897b0908a0..4c4283a36de 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch07.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch07.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SteppingMatch07
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.SteppingMatch07
 {
-  // Offset: 0x00000000 Length: 0x0000067D
+  // Offset: 0x00000000 Length: 0x00000679
+}
+.mresource public FSharpSignatureDataB.SteppingMatch07
+{
+  // Offset: 0x00000680 Length: 0x0000007D
 }
 .mresource public FSharpOptimizationData.SteppingMatch07
 {
-  // Offset: 0x00000688 Length: 0x000001D9
+  // Offset: 0x00000708 Length: 0x000001D9
+}
+.mresource public FSharpOptimizationDataB.SteppingMatch07
+{
+  // Offset: 0x000008E8 Length: 0x0000002A
 }
 .module SteppingMatch07.dll
-// MVID: {59B19213-D373-07F3-A745-03831392B159}
+// MVID: {5C6C932B-6FFE-E210-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x03330000
+// Image base: 0x01090000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch08.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch08.il.bsl
index 5d87f08136f..00f2d8bfb9d 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch08.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch08.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SteppingMatch08
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.SteppingMatch08
 {
-  // Offset: 0x00000000 Length: 0x000001DF
+  // Offset: 0x00000000 Length: 0x000001E7
+}
+.mresource public FSharpSignatureDataB.SteppingMatch08
+{
+  // Offset: 0x000001F0 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.SteppingMatch08
 {
-  // Offset: 0x000001E8 Length: 0x00000079
+  // Offset: 0x000001F8 Length: 0x00000079
+}
+.mresource public FSharpOptimizationDataB.SteppingMatch08
+{
+  // Offset: 0x00000278 Length: 0x00000000
 }
 .module SteppingMatch08.dll
-// MVID: {59B19213-F238-BA3A-A745-03831392B159}
+// MVID: {5C6C932B-6A07-E210-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00C70000
+// Image base: 0x002F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch09.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch09.il.bsl
index 5baef73c908..88f9aee3aa8 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch09.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/SteppingMatch09.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly SteppingMatch09
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000318
 }
+.mresource public FSharpSignatureDataB.SteppingMatch09
+{
+  // Offset: 0x00000320 Length: 0x00000013
+}
 .mresource public FSharpOptimizationData.SteppingMatch09
 {
-  // Offset: 0x00000320 Length: 0x000000EB
+  // Offset: 0x00000338 Length: 0x000000EB
+}
+.mresource public FSharpOptimizationDataB.SteppingMatch09
+{
+  // Offset: 0x00000428 Length: 0x00000000
 }
 .module SteppingMatch09.dll
-// MVID: {59B19213-4935-D6AC-A745-03831392B159}
+// MVID: {5C6C932B-6608-E210-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00390000
+// Image base: 0x00F20000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall01.il.bsl
index 028bdaec338..5056cdd1ef9 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TailCall01
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000021D
 }
+.mresource public FSharpSignatureDataB.TailCall01
+{
+  // Offset: 0x00000228 Length: 0x00000008
+}
 .mresource public FSharpOptimizationData.TailCall01
 {
-  // Offset: 0x00000228 Length: 0x0000007C
+  // Offset: 0x00000238 Length: 0x0000007C
+}
+.mresource public FSharpOptimizationDataB.TailCall01
+{
+  // Offset: 0x000002B8 Length: 0x00000000
 }
 .module TailCall01.exe
-// MVID: {59B19213-7D8F-CF4A-A745-03831392B159}
+// MVID: {5C6C932B-B1B5-7213-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02E90000
+// Image base: 0x00FF0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall02.il.bsl
index 8a7cd2907e0..f93602c9f7c 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TailCall02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TailCall02
 {
-  // Offset: 0x00000000 Length: 0x00000202
+  // Offset: 0x00000000 Length: 0x0000020A
+}
+.mresource public FSharpSignatureDataB.TailCall02
+{
+  // Offset: 0x00000210 Length: 0x00000007
 }
 .mresource public FSharpOptimizationData.TailCall02
 {
-  // Offset: 0x00000208 Length: 0x0000007C
+  // Offset: 0x00000220 Length: 0x0000007C
+}
+.mresource public FSharpOptimizationDataB.TailCall02
+{
+  // Offset: 0x000002A0 Length: 0x00000000
 }
 .module TailCall02.exe
-// MVID: {59B19213-7D8F-CE9D-A745-03831392B159}
+// MVID: {5C6C932B-0C24-612C-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00E20000
+// Image base: 0x01100000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall03.il.bsl
index 0b27a3419b2..5ce0ef5f583 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall03.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TailCall03
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000241
 }
+.mresource public FSharpSignatureDataB.TailCall03
+{
+  // Offset: 0x00000248 Length: 0x0000000D
+}
 .mresource public FSharpOptimizationData.TailCall03
 {
-  // Offset: 0x00000248 Length: 0x0000007C
+  // Offset: 0x00000260 Length: 0x0000007C
+}
+.mresource public FSharpOptimizationDataB.TailCall03
+{
+  // Offset: 0x000002E0 Length: 0x00000000
 }
 .module TailCall03.exe
-// MVID: {59B19213-7D8F-CE88-A745-03831392B159}
+// MVID: {5C6C932B-A07F-6869-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00E50000
+// Image base: 0x012F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall04.il.bsl
index 309f764e782..5e4c87c0aff 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall04.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall04.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TailCall04
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000022F
 }
+.mresource public FSharpSignatureDataB.TailCall04
+{
+  // Offset: 0x00000238 Length: 0x00000009
+}
 .mresource public FSharpOptimizationData.TailCall04
 {
-  // Offset: 0x00000238 Length: 0x0000007C
+  // Offset: 0x00000248 Length: 0x0000007C
+}
+.mresource public FSharpOptimizationDataB.TailCall04
+{
+  // Offset: 0x000002C8 Length: 0x00000000
 }
 .module TailCall04.exe
-// MVID: {59B19213-7D8F-CFE3-A745-03831392B159}
+// MVID: {5C6C932B-9FC6-6CBD-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00B70000
+// Image base: 0x00CF0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall05.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall05.il.bsl
index 5ae3bd0b331..56436fc9ea2 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall05.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TailCalls/TailCall05.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TailCall05
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000023F
 }
+.mresource public FSharpSignatureDataB.TailCall05
+{
+  // Offset: 0x00000248 Length: 0x0000000B
+}
 .mresource public FSharpOptimizationData.TailCall05
 {
-  // Offset: 0x00000248 Length: 0x0000007C
+  // Offset: 0x00000258 Length: 0x0000007C
+}
+.mresource public FSharpOptimizationDataB.TailCall05
+{
+  // Offset: 0x000002D8 Length: 0x00000000
 }
 .module TailCall05.exe
-// MVID: {59B19213-7D8F-CFC6-A745-03831392B159}
+// MVID: {5C6C932B-3421-73FB-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x03210000
+// Image base: 0x00D70000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction1.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction1.il.bsl
index 6a80341afe9..f4586814ea1 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction1.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction1.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction1
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction1
 {
-  // Offset: 0x00000000 Length: 0x000001CA
+  // Offset: 0x00000000 Length: 0x000001D2
+}
+.mresource public FSharpSignatureDataB.TestFunction1
+{
+  // Offset: 0x000001D8 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.TestFunction1
 {
-  // Offset: 0x000001D0 Length: 0x00000070
+  // Offset: 0x000001E0 Length: 0x00000070
+}
+.mresource public FSharpOptimizationDataB.TestFunction1
+{
+  // Offset: 0x00000258 Length: 0x00000000
 }
 .module TestFunction1.exe
-// MVID: {59B19208-65FC-8929-A745-03830892B159}
+// MVID: {5C6C932B-173F-9F02-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x03230000
+// Image base: 0x017B0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction10.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction10.il.bsl
index 868ca11e97b..14fd24131c8 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction10.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction10.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction10
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction10
 {
-  // Offset: 0x00000000 Length: 0x000001C9
+  // Offset: 0x00000000 Length: 0x000001D1
+}
+.mresource public FSharpSignatureDataB.TestFunction10
+{
+  // Offset: 0x000001D8 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.TestFunction10
 {
-  // Offset: 0x000001D0 Length: 0x00000072
+  // Offset: 0x000001E0 Length: 0x00000072
+}
+.mresource public FSharpOptimizationDataB.TestFunction10
+{
+  // Offset: 0x00000258 Length: 0x00000000
 }
 .module TestFunction10.exe
-// MVID: {59B199CC-A624-44FB-A745-0383CC99B159}
+// MVID: {5C6C932B-9C9F-8748-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00DA0000
+// Image base: 0x002F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction13.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction13.il.bsl
index a23943d01bf..2f0793edb26 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction13.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction13.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction13
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000020F
 }
+.mresource public FSharpSignatureDataB.TestFunction13
+{
+  // Offset: 0x00000218 Length: 0x00000007
+}
 .mresource public FSharpOptimizationData.TestFunction13
 {
-  // Offset: 0x00000218 Length: 0x00000072
+  // Offset: 0x00000228 Length: 0x00000072
+}
+.mresource public FSharpOptimizationDataB.TestFunction13
+{
+  // Offset: 0x000002A0 Length: 0x00000000
 }
 .module TestFunction13.exe
-// MVID: {59B199CC-A624-451C-A745-0383CC99B159}
+// MVID: {5C6C932B-BAC4-2C50-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01000000
+// Image base: 0x012F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction14.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction14.il.bsl
index a139e414063..d3e69113061 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction14.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction14.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction14
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction14
 {
-  // Offset: 0x00000000 Length: 0x000001EA
+  // Offset: 0x00000000 Length: 0x000001F2
+}
+.mresource public FSharpSignatureDataB.TestFunction14
+{
+  // Offset: 0x000001F8 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.TestFunction14
 {
-  // Offset: 0x000001F0 Length: 0x00000072
+  // Offset: 0x00000200 Length: 0x00000072
+}
+.mresource public FSharpOptimizationDataB.TestFunction14
+{
+  // Offset: 0x00000278 Length: 0x00000000
 }
 .module TestFunction14.exe
-// MVID: {59B19208-A624-4587-A745-03830892B159}
+// MVID: {5C6C932B-1F0B-8930-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x006B0000
+// Image base: 0x00BF0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction16.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction16.il.bsl
index 35254e97c34..75841c86509 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction16.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction16.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction16
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction16
 {
-  // Offset: 0x00000000 Length: 0x00000693
+  // Offset: 0x00000000 Length: 0x00000687
+}
+.mresource public FSharpSignatureDataB.TestFunction16
+{
+  // Offset: 0x00000690 Length: 0x0000007F
 }
 .mresource public FSharpOptimizationData.TestFunction16
 {
-  // Offset: 0x00000698 Length: 0x000001CD
+  // Offset: 0x00000718 Length: 0x000001CD
+}
+.mresource public FSharpOptimizationDataB.TestFunction16
+{
+  // Offset: 0x000008F0 Length: 0x0000002A
 }
 .module TestFunction16.exe
-// MVID: {59B199CC-A624-45C5-A745-0383CC99B159}
+// MVID: {5C6C932B-12D5-E97E-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01940000
+// Image base: 0x02D40000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction17.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction17.il.bsl
index cc502982e7b..fb52b0564b5 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction17.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction17.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction17
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction17
 {
-  // Offset: 0x00000000 Length: 0x0000067E
+  // Offset: 0x00000000 Length: 0x00000672
+}
+.mresource public FSharpSignatureDataB.TestFunction17
+{
+  // Offset: 0x00000678 Length: 0x0000007E
 }
 .mresource public FSharpOptimizationData.TestFunction17
 {
-  // Offset: 0x00000688 Length: 0x000001CD
+  // Offset: 0x00000700 Length: 0x000001CD
+}
+.mresource public FSharpOptimizationDataB.TestFunction17
+{
+  // Offset: 0x000008D8 Length: 0x0000002A
 }
 .module TestFunction17.exe
-// MVID: {59B199CC-A624-45A8-A745-0383CC99B159}
+// MVID: {5C6C932B-3D30-2E38-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x027C0000
+// Image base: 0x00690000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction19.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction19.il.bsl
index f5468bf0fd6..105c12d0958 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction19.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction19.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction19
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction19
 {
-  // Offset: 0x00000000 Length: 0x00000352
+  // Offset: 0x00000000 Length: 0x0000035A
+}
+.mresource public FSharpSignatureDataB.TestFunction19
+{
+  // Offset: 0x00000360 Length: 0x00000021
 }
 .mresource public FSharpOptimizationData.TestFunction19
 {
-  // Offset: 0x00000358 Length: 0x00000100
+  // Offset: 0x00000388 Length: 0x00000100
+}
+.mresource public FSharpOptimizationDataB.TestFunction19
+{
+  // Offset: 0x00000490 Length: 0x0000000E
 }
 .module TestFunction19.exe
-// MVID: {59B19208-A624-46AE-A745-03830892B159}
+// MVID: {5C6C932B-9122-E342-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x016D0000
+// Image base: 0x010A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction20.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction20.il.bsl
index 5b65668cd8c..dcc15efc219 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction20.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction20.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction20
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction20
 {
-  // Offset: 0x00000000 Length: 0x00000393
+  // Offset: 0x00000000 Length: 0x0000039B
+}
+.mresource public FSharpSignatureDataB.TestFunction20
+{
+  // Offset: 0x000003A0 Length: 0x00000026
 }
 .mresource public FSharpOptimizationData.TestFunction20
 {
-  // Offset: 0x00000398 Length: 0x00000100
+  // Offset: 0x000003D0 Length: 0x00000100
+}
+.mresource public FSharpOptimizationDataB.TestFunction20
+{
+  // Offset: 0x000004D8 Length: 0x0000000E
 }
 .module TestFunction20.exe
-// MVID: {59B19208-A643-44FB-A745-03830892B159}
+// MVID: {5C6C932B-A09E-8748-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01320000
+// Image base: 0x00950000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction21.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction21.il.bsl
index 30b59304c56..52814a3ee24 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction21.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction21.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction21
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction21
 {
-  // Offset: 0x00000000 Length: 0x00000685
+  // Offset: 0x00000000 Length: 0x00000679
+}
+.mresource public FSharpSignatureDataB.TestFunction21
+{
+  // Offset: 0x00000680 Length: 0x0000007E
 }
 .mresource public FSharpOptimizationData.TestFunction21
 {
-  // Offset: 0x00000690 Length: 0x000001CD
+  // Offset: 0x00000708 Length: 0x000001CD
+}
+.mresource public FSharpOptimizationDataB.TestFunction21
+{
+  // Offset: 0x000008E0 Length: 0x0000002A
 }
 .module TestFunction21.exe
-// MVID: {59B19208-A643-45E6-A745-03830892B159}
+// MVID: {5C6C932B-CFF9-35FA-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00F80000
+// Image base: 0x012E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction23.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction23.il.bsl
index fffbcac4e2f..525e1ac0966 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction23.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction23.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction23
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000346
 }
+.mresource public FSharpSignatureDataB.TestFunction23
+{
+  // Offset: 0x00000350 Length: 0x0000001C
+}
 .mresource public FSharpOptimizationData.TestFunction23
 {
-  // Offset: 0x00000350 Length: 0x000000E3
+  // Offset: 0x00000370 Length: 0x000000E3
+}
+.mresource public FSharpOptimizationDataB.TestFunction23
+{
+  // Offset: 0x00000458 Length: 0x00000008
 }
 .module TestFunction23.exe
-// MVID: {59B19208-A643-451C-A745-03830892B159}
+// MVID: {5C6C932B-BEC3-2C50-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02D60000
+// Image base: 0x019E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction24.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction24.il.bsl
index bdbd5f41fc7..2e61558adb0 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction24.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction24.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction24
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction24
 {
-  // Offset: 0x00000000 Length: 0x0000075B
+  // Offset: 0x00000000 Length: 0x0000074F
+}
+.mresource public FSharpSignatureDataB.TestFunction24
+{
+  // Offset: 0x00000758 Length: 0x0000008A
 }
 .mresource public FSharpOptimizationData.TestFunction24
 {
-  // Offset: 0x00000760 Length: 0x00000228
+  // Offset: 0x000007E8 Length: 0x00000228
+}
+.mresource public FSharpOptimizationDataB.TestFunction24
+{
+  // Offset: 0x00000A18 Length: 0x0000002A
 }
 .module TestFunction24.exe
-// MVID: {59B19208-A643-4587-A745-03830892B159}
+// MVID: {5C6C932B-230A-8930-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01080000
+// Image base: 0x01290000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction3b.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction3b.il.bsl
index d543e2e48bb..d4e461227fb 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction3b.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction3b.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction3b
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction3b
 {
-  // Offset: 0x00000000 Length: 0x00000200
+  // Offset: 0x00000000 Length: 0x00000208
+}
+.mresource public FSharpSignatureDataB.TestFunction3b
+{
+  // Offset: 0x00000210 Length: 0x00000006
 }
 .mresource public FSharpOptimizationData.TestFunction3b
 {
-  // Offset: 0x00000208 Length: 0x0000008A
+  // Offset: 0x00000220 Length: 0x0000008A
+}
+.mresource public FSharpOptimizationDataB.TestFunction3b
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module TestFunction3b.exe
-// MVID: {59B19208-A662-4FC9-A745-03830892B159}
+// MVID: {5C6C932B-8257-1603-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00BB0000
+// Image base: 0x01260000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction3c.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction3c.il.bsl
index dc790e1200b..c569e9b4ab1 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction3c.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction3c.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction3c
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction3c
 {
-  // Offset: 0x00000000 Length: 0x00000200
+  // Offset: 0x00000000 Length: 0x00000208
+}
+.mresource public FSharpSignatureDataB.TestFunction3c
+{
+  // Offset: 0x00000210 Length: 0x00000006
 }
 .mresource public FSharpOptimizationData.TestFunction3c
 {
-  // Offset: 0x00000208 Length: 0x0000008A
+  // Offset: 0x00000220 Length: 0x0000008A
+}
+.mresource public FSharpOptimizationDataB.TestFunction3c
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module TestFunction3c.exe
-// MVID: {59B19208-A662-4FAC-A745-03830892B159}
+// MVID: {5C6C932B-16B2-1D41-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02B20000
+// Image base: 0x00300000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction9b4.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction9b4.il.bsl
index a92010a91c4..445880758cb 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction9b4.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction9b4.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction9b4
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000024C
 }
+.mresource public FSharpSignatureDataB.TestFunction9b4
+{
+  // Offset: 0x00000250 Length: 0x00000006
+}
 .mresource public FSharpOptimizationData.TestFunction9b4
 {
-  // Offset: 0x00000250 Length: 0x00000085
+  // Offset: 0x00000260 Length: 0x00000085
+}
+.mresource public FSharpOptimizationDataB.TestFunction9b4
+{
+  // Offset: 0x000002F0 Length: 0x00000000
 }
 .module TestFunction9b4.exe
-// MVID: {5B17FC67-A091-56C1-A745-038367FC175B}
+// MVID: {5C6C932B-9FB1-31E1-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x026C0000
+// Image base: 0x014A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction11.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction11.il.bsl
index 5fc9397c162..f2bebe1eab2 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction11.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction11.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction11
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction11
 {
-  // Offset: 0x00000000 Length: 0x000001E8
+  // Offset: 0x00000000 Length: 0x000001F0
+}
+.mresource public FSharpSignatureDataB.TestFunction11
+{
+  // Offset: 0x000001F8 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.TestFunction11
 {
-  // Offset: 0x000001F0 Length: 0x00000072
+  // Offset: 0x00000200 Length: 0x00000072
+}
+.mresource public FSharpOptimizationDataB.TestFunction11
+{
+  // Offset: 0x00000278 Length: 0x00000000
 }
 .module TestFunction11.exe
-// MVID: {59B19208-A624-45E6-A745-03830892B159}
+// MVID: {5C6C932B-CBFA-35FA-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01080000
+// Image base: 0x012D0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction12.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction12.il.bsl
index 2f7b3efff8e..67e94ff8670 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction12.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction12.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction12
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction12
 {
-  // Offset: 0x00000000 Length: 0x000001DB
+  // Offset: 0x00000000 Length: 0x000001E3
+}
+.mresource public FSharpSignatureDataB.TestFunction12
+{
+  // Offset: 0x000001E8 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.TestFunction12
 {
-  // Offset: 0x000001E0 Length: 0x00000072
+  // Offset: 0x000001F0 Length: 0x00000072
+}
+.mresource public FSharpOptimizationDataB.TestFunction12
+{
+  // Offset: 0x00000268 Length: 0x00000000
 }
 .module TestFunction12.exe
-// MVID: {59B19208-A624-4539-A745-03830892B159}
+// MVID: {5C6C932B-9069-E796-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002D0000
+// Image base: 0x015F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction15.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction15.il.bsl
index ae9215ad18e..31f26bea8b2 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction15.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction15.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction15
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction15
 {
-  // Offset: 0x00000000 Length: 0x000001EA
+  // Offset: 0x00000000 Length: 0x000001F2
+}
+.mresource public FSharpSignatureDataB.TestFunction15
+{
+  // Offset: 0x000001F8 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.TestFunction15
 {
-  // Offset: 0x000001F0 Length: 0x00000072
+  // Offset: 0x00000200 Length: 0x00000072
+}
+.mresource public FSharpOptimizationDataB.TestFunction15
+{
+  // Offset: 0x00000278 Length: 0x00000000
 }
 .module TestFunction15.exe
-// MVID: {59B19208-A624-4662-A745-03830892B159}
+// MVID: {5C6C932B-4E66-37E2-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02B10000
+// Image base: 0x007A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction18.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction18.il.bsl
index 80848608547..8a7cdf987bd 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction18.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction18.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction18
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x000001ED
 }
+.mresource public FSharpSignatureDataB.TestFunction18
+{
+  // Offset: 0x000001F8 Length: 0x00000004
+}
 .mresource public FSharpOptimizationData.TestFunction18
 {
-  // Offset: 0x000001F8 Length: 0x00000072
+  // Offset: 0x00000200 Length: 0x00000072
+}
+.mresource public FSharpOptimizationDataB.TestFunction18
+{
+  // Offset: 0x00000278 Length: 0x00000000
 }
 .module TestFunction18.exe
-// MVID: {59B19208-A624-4603-A745-03830892B159}
+// MVID: {5C6C932B-61C7-3490-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x019B0000
+// Image base: 0x01290000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction2.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction2.il.bsl
index 92ec82161db..14e2f6fc156 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction2.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction2.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction2
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction2
 {
-  // Offset: 0x00000000 Length: 0x000001FD
+  // Offset: 0x00000000 Length: 0x00000205
+}
+.mresource public FSharpSignatureDataB.TestFunction2
+{
+  // Offset: 0x00000210 Length: 0x00000006
 }
 .mresource public FSharpOptimizationData.TestFunction2
 {
-  // Offset: 0x00000208 Length: 0x00000088
+  // Offset: 0x00000220 Length: 0x00000088
+}
+.mresource public FSharpOptimizationDataB.TestFunction2
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module TestFunction2.exe
-// MVID: {59B19208-661D-8929-A745-03830892B159}
+// MVID: {5C6C932B-0A82-9F02-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002E0000
+// Image base: 0x012E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22.il.bsl
index 3c7a947a3b4..a62aa7f5859 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Testfunction22
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Testfunction22
 {
-  // Offset: 0x00000000 Length: 0x0000015B
+  // Offset: 0x00000000 Length: 0x00000163
+}
+.mresource public FSharpSignatureDataB.Testfunction22
+{
+  // Offset: 0x00000168 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Testfunction22
 {
-  // Offset: 0x00000160 Length: 0x00000055
+  // Offset: 0x00000170 Length: 0x00000055
+}
+.mresource public FSharpOptimizationDataB.Testfunction22
+{
+  // Offset: 0x000001D0 Length: 0x00000000
 }
 .module Testfunction22.exe
-// MVID: {59B199CC-5AA3-4518-A745-0383CC99B159}
+// MVID: {5C6C932B-35C8-D937-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002E0000
+// Image base: 0x017B0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22b.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22b.il.bsl
index ac3e76f8f2e..e3aba46a08e 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22b.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22b.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Testfunction22b
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Testfunction22b
 {
-  // Offset: 0x00000000 Length: 0x0000015D
+  // Offset: 0x00000000 Length: 0x00000165
+}
+.mresource public FSharpSignatureDataB.Testfunction22b
+{
+  // Offset: 0x00000170 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Testfunction22b
 {
-  // Offset: 0x00000168 Length: 0x00000056
+  // Offset: 0x00000178 Length: 0x00000056
+}
+.mresource public FSharpOptimizationDataB.Testfunction22b
+{
+  // Offset: 0x000001D8 Length: 0x00000000
 }
 .module Testfunction22b.exe
-// MVID: {59B19208-8504-18B7-A745-03830892B159}
+// MVID: {5C6C932B-5346-F08B-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002D0000
+// Image base: 0x010F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22c.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22c.il.bsl
index e5640da7b20..11b11c6e381 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22c.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22c.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Testfunction22c
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Testfunction22c
 {
-  // Offset: 0x00000000 Length: 0x0000015D
+  // Offset: 0x00000000 Length: 0x00000165
+}
+.mresource public FSharpSignatureDataB.Testfunction22c
+{
+  // Offset: 0x00000170 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Testfunction22c
 {
-  // Offset: 0x00000168 Length: 0x00000056
+  // Offset: 0x00000178 Length: 0x00000056
+}
+.mresource public FSharpOptimizationDataB.Testfunction22c
+{
+  // Offset: 0x000001D8 Length: 0x00000000
 }
 .module Testfunction22c.exe
-// MVID: {59B19208-459D-3DF8-A745-03830892B159}
+// MVID: {5C6C932B-5705-F08B-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x03000000
+// Image base: 0x01A50000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22d.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22d.il.bsl
index 06dc2c7b954..2609a7349fd 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22d.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22d.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Testfunction22d
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Testfunction22d
 {
-  // Offset: 0x00000000 Length: 0x0000015D
+  // Offset: 0x00000000 Length: 0x00000165
+}
+.mresource public FSharpSignatureDataB.Testfunction22d
+{
+  // Offset: 0x00000170 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Testfunction22d
 {
-  // Offset: 0x00000168 Length: 0x00000056
+  // Offset: 0x00000178 Length: 0x00000056
+}
+.mresource public FSharpOptimizationDataB.Testfunction22d
+{
+  // Offset: 0x000001D8 Length: 0x00000000
 }
 .module Testfunction22d.exe
-// MVID: {59B19208-FDCA-89B1-A745-03830892B159}
+// MVID: {5C6C932B-7C4C-F08B-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00720000
+// Image base: 0x01880000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22e.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22e.il.bsl
index ed2dae30740..aee0d95317c 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22e.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22e.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Testfunction22e
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Testfunction22e
 {
-  // Offset: 0x00000000 Length: 0x0000015D
+  // Offset: 0x00000000 Length: 0x00000165
+}
+.mresource public FSharpSignatureDataB.Testfunction22e
+{
+  // Offset: 0x00000170 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Testfunction22e
 {
-  // Offset: 0x00000168 Length: 0x00000056
+  // Offset: 0x00000178 Length: 0x00000056
+}
+.mresource public FSharpOptimizationDataB.Testfunction22e
+{
+  // Offset: 0x000001D8 Length: 0x00000000
 }
 .module Testfunction22e.exe
-// MVID: {59B19208-C83B-1CB9-A745-03830892B159}
+// MVID: {5C6C932B-5F0B-F08B-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002D0000
+// Image base: 0x01A90000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22f.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22f.il.bsl
index 2dd07a07bb2..9caf6169c11 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22f.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22f.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Testfunction22f
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Testfunction22f
 {
-  // Offset: 0x00000000 Length: 0x0000015D
+  // Offset: 0x00000000 Length: 0x00000165
+}
+.mresource public FSharpSignatureDataB.Testfunction22f
+{
+  // Offset: 0x00000170 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Testfunction22f
 {
-  // Offset: 0x00000168 Length: 0x00000056
+  // Offset: 0x00000178 Length: 0x00000056
+}
+.mresource public FSharpOptimizationDataB.Testfunction22f
+{
+  // Offset: 0x000001D8 Length: 0x00000000
 }
 .module Testfunction22f.exe
-// MVID: {59B19208-C040-2523-A745-03830892B159}
+// MVID: {5C6C932B-634A-F08B-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x012C0000
+// Image base: 0x00F20000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22g.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22g.il.bsl
index 629593f6e0a..06cf6cce796 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22g.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22g.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Testfunction22g
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Testfunction22g
 {
-  // Offset: 0x00000000 Length: 0x0000015D
+  // Offset: 0x00000000 Length: 0x00000165
+}
+.mresource public FSharpSignatureDataB.Testfunction22g
+{
+  // Offset: 0x00000170 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Testfunction22g
 {
-  // Offset: 0x00000168 Length: 0x00000056
+  // Offset: 0x00000178 Length: 0x00000056
+}
+.mresource public FSharpOptimizationDataB.Testfunction22g
+{
+  // Offset: 0x000001D8 Length: 0x00000000
 }
 .module Testfunction22g.exe
-// MVID: {59B19208-CA89-74DB-A745-03830892B159}
+// MVID: {5C6C932B-6709-F08B-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x012F0000
+// Image base: 0x03080000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22h.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22h.il.bsl
index 7fcae895abd..7b684c59319 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22h.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction22h.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Testfunction22h
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Testfunction22h
 {
-  // Offset: 0x00000000 Length: 0x0000015D
+  // Offset: 0x00000000 Length: 0x00000165
+}
+.mresource public FSharpSignatureDataB.Testfunction22h
+{
+  // Offset: 0x00000170 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Testfunction22h
 {
-  // Offset: 0x00000168 Length: 0x00000056
+  // Offset: 0x00000178 Length: 0x00000056
+}
+.mresource public FSharpOptimizationDataB.Testfunction22h
+{
+  // Offset: 0x000001D8 Length: 0x00000000
 }
 .module Testfunction22h.exe
-// MVID: {59B19208-0266-39F6-A745-03830892B159}
+// MVID: {5C6C932B-8E50-F08B-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00370000
+// Image base: 0x00C50000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction3.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction3.il.bsl
index 2a64c727d05..38e98f5b839 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction3.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction3.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction3
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction3
 {
-  // Offset: 0x00000000 Length: 0x000001FD
+  // Offset: 0x00000000 Length: 0x00000205
+}
+.mresource public FSharpSignatureDataB.TestFunction3
+{
+  // Offset: 0x00000210 Length: 0x00000006
 }
 .mresource public FSharpOptimizationData.TestFunction3
 {
-  // Offset: 0x00000208 Length: 0x00000088
+  // Offset: 0x00000220 Length: 0x00000088
+}
+.mresource public FSharpOptimizationDataB.TestFunction3
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module TestFunction3.exe
-// MVID: {59B19208-663A-8929-A745-03830892B159}
+// MVID: {5C6C932B-0F41-9F02-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x013E0000
+// Image base: 0x00D60000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction4.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction4.il.bsl
index 0b9818bebb3..d53c9ba8136 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction4.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction4.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction4
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction4
 {
-  // Offset: 0x00000000 Length: 0x000001FD
+  // Offset: 0x00000000 Length: 0x00000205
+}
+.mresource public FSharpSignatureDataB.TestFunction4
+{
+  // Offset: 0x00000210 Length: 0x00000006
 }
 .mresource public FSharpOptimizationData.TestFunction4
 {
-  // Offset: 0x00000208 Length: 0x00000088
+  // Offset: 0x00000220 Length: 0x00000088
+}
+.mresource public FSharpOptimizationDataB.TestFunction4
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module TestFunction4.exe
-// MVID: {59B19208-665B-8929-A745-03830892B159}
+// MVID: {5C6C932B-2284-9F02-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x026C0000
+// Image base: 0x001F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction5.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction5.il.bsl
index fb983f1af1e..b4d71120e1c 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction5.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction5.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction5
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction5
 {
-  // Offset: 0x00000000 Length: 0x000001FD
+  // Offset: 0x00000000 Length: 0x00000205
+}
+.mresource public FSharpSignatureDataB.TestFunction5
+{
+  // Offset: 0x00000210 Length: 0x00000006
 }
 .mresource public FSharpOptimizationData.TestFunction5
 {
-  // Offset: 0x00000208 Length: 0x00000088
+  // Offset: 0x00000220 Length: 0x00000088
+}
+.mresource public FSharpOptimizationDataB.TestFunction5
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module TestFunction5.exe
-// MVID: {59B19208-6570-8929-A745-03830892B159}
+// MVID: {5C6C932B-2743-9F02-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x010A0000
+// Image base: 0x00E90000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction6.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction6.il.bsl
index dcb8a71396b..cc0f946bf94 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction6.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction6.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction6
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000205
 }
+.mresource public FSharpSignatureDataB.TestFunction6
+{
+  // Offset: 0x00000210 Length: 0x00000006
+}
 .mresource public FSharpOptimizationData.TestFunction6
 {
-  // Offset: 0x00000210 Length: 0x00000088
+  // Offset: 0x00000220 Length: 0x00000088
+}
+.mresource public FSharpOptimizationDataB.TestFunction6
+{
+  // Offset: 0x000002B0 Length: 0x00000000
 }
 .module TestFunction6.exe
-// MVID: {5B17FC67-6591-8929-A745-038367FC175B}
+// MVID: {5C6C932B-1A86-9F02-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x03360000
+// Image base: 0x02900000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction7.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction7.il.bsl
index a9af9b236e4..210bd1a88a9 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction7.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction7.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction7
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction7
 {
-  // Offset: 0x00000000 Length: 0x000001BF
+  // Offset: 0x00000000 Length: 0x000001C7
+}
+.mresource public FSharpSignatureDataB.TestFunction7
+{
+  // Offset: 0x000001D0 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.TestFunction7
 {
-  // Offset: 0x000001C8 Length: 0x00000070
+  // Offset: 0x000001D8 Length: 0x00000070
+}
+.mresource public FSharpOptimizationDataB.TestFunction7
+{
+  // Offset: 0x00000250 Length: 0x00000000
 }
 .module TestFunction7.exe
-// MVID: {59B19208-65AE-8929-A745-03830892B159}
+// MVID: {5C6C932B-1F45-9F02-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00E30000
+// Image base: 0x00D50000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction8.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction8.il.bsl
index 328e4809402..3e17c515386 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction8.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction8.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction8
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction8
 {
-  // Offset: 0x00000000 Length: 0x000001C8
+  // Offset: 0x00000000 Length: 0x000001D0
+}
+.mresource public FSharpSignatureDataB.TestFunction8
+{
+  // Offset: 0x000001D8 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.TestFunction8
 {
-  // Offset: 0x000001D0 Length: 0x00000070
+  // Offset: 0x000001E0 Length: 0x00000070
+}
+.mresource public FSharpOptimizationDataB.TestFunction8
+{
+  // Offset: 0x00000258 Length: 0x00000000
 }
 .module TestFunction8.exe
-// MVID: {59B19208-65CF-8929-A745-03830892B159}
+// MVID: {5C6C932B-3488-9F02-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01010000
+// Image base: 0x00D60000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9.il.bsl
index b7e4921fdc3..cf33cbc97dd 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction9
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction9
 {
-  // Offset: 0x00000000 Length: 0x000001D6
+  // Offset: 0x00000000 Length: 0x000001DE
+}
+.mresource public FSharpSignatureDataB.TestFunction9
+{
+  // Offset: 0x000001E8 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.TestFunction9
 {
-  // Offset: 0x000001E0 Length: 0x00000070
+  // Offset: 0x000001F0 Length: 0x00000070
+}
+.mresource public FSharpOptimizationDataB.TestFunction9
+{
+  // Offset: 0x00000268 Length: 0x00000000
 }
 .module TestFunction9.exe
-// MVID: {59B19208-64F4-8929-A745-03830892B159}
+// MVID: {5C6C932B-3947-9F02-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x016E0000
+// Image base: 0x00CF0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b.il.bsl
index a4168bde720..8621c96373a 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction9b
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction9b
 {
-  // Offset: 0x00000000 Length: 0x000001F6
+  // Offset: 0x00000000 Length: 0x000001FE
+}
+.mresource public FSharpSignatureDataB.TestFunction9b
+{
+  // Offset: 0x00000208 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.TestFunction9b
 {
-  // Offset: 0x00000200 Length: 0x00000072
+  // Offset: 0x00000210 Length: 0x00000072
+}
+.mresource public FSharpOptimizationDataB.TestFunction9b
+{
+  // Offset: 0x00000288 Length: 0x00000000
 }
 .module TestFunction9b.exe
-// MVID: {59B19208-A52C-4FC9-A745-03830892B159}
+// MVID: {5C6C932B-9A61-1603-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01AA0000
+// Image base: 0x00FB0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b1.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b1.il.bsl
index 28857893620..bbf9ba2ed2f 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b1.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b1.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction9b1
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction9b1
 {
-  // Offset: 0x00000000 Length: 0x00000208
+  // Offset: 0x00000000 Length: 0x00000210
+}
+.mresource public FSharpSignatureDataB.TestFunction9b1
+{
+  // Offset: 0x00000218 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.TestFunction9b1
 {
-  // Offset: 0x00000210 Length: 0x00000083
+  // Offset: 0x00000220 Length: 0x00000083
+}
+.mresource public FSharpOptimizationDataB.TestFunction9b1
+{
+  // Offset: 0x000002A8 Length: 0x00000000
 }
 .module TestFunction9b1.exe
-// MVID: {59B19208-A406-DAF4-A745-03830892B159}
+// MVID: {5C6C932B-8BEE-31E1-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02730000
+// Image base: 0x012E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b2.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b2.il.bsl
index 005b49c3081..8a17783e4dd 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b2.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b2.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction9b2
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction9b2
 {
-  // Offset: 0x00000000 Length: 0x00000208
+  // Offset: 0x00000000 Length: 0x00000210
+}
+.mresource public FSharpSignatureDataB.TestFunction9b2
+{
+  // Offset: 0x00000218 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.TestFunction9b2
 {
-  // Offset: 0x00000210 Length: 0x00000083
+  // Offset: 0x00000220 Length: 0x00000083
+}
+.mresource public FSharpOptimizationDataB.TestFunction9b2
+{
+  // Offset: 0x000002A8 Length: 0x00000000
 }
 .module TestFunction9b2.exe
-// MVID: {59B19208-9C0B-E35E-A745-03830892B159}
+// MVID: {5C6C932B-87AF-31E1-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00730000
+// Image base: 0x006F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b3.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b3.il.bsl
index dc4f68ffb80..d7c5ca747d7 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b3.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/Testfunction9b3.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TestFunction9b3
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TestFunction9b3
 {
-  // Offset: 0x00000000 Length: 0x00000208
+  // Offset: 0x00000000 Length: 0x00000210
+}
+.mresource public FSharpSignatureDataB.TestFunction9b3
+{
+  // Offset: 0x00000218 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.TestFunction9b3
 {
-  // Offset: 0x00000210 Length: 0x00000083
+  // Offset: 0x00000220 Length: 0x00000083
+}
+.mresource public FSharpOptimizationDataB.TestFunction9b3
+{
+  // Offset: 0x000002A8 Length: 0x00000000
 }
 .module TestFunction9b3.exe
-// MVID: {59B19208-C1A4-612A-A745-03830892B159}
+// MVID: {5C6C932B-A4F0-31E1-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00680000
+// Image base: 0x015C0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple01.il.bsl
index 36d04a11dc5..95aa3aa920b 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Tuple01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Tuple01
 {
-  // Offset: 0x00000000 Length: 0x0000013F
+  // Offset: 0x00000000 Length: 0x00000147
+}
+.mresource public FSharpSignatureDataB.Tuple01
+{
+  // Offset: 0x00000150 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Tuple01
 {
-  // Offset: 0x00000148 Length: 0x0000004E
+  // Offset: 0x00000158 Length: 0x0000004E
+}
+.mresource public FSharpOptimizationDataB.Tuple01
+{
+  // Offset: 0x000001B0 Length: 0x00000000
 }
 .module Tuple01.exe
-// MVID: {59B19208-6FDB-3E0B-A745-03830892B159}
+// MVID: {5C6C932B-E0B7-6D31-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002E0000
+// Image base: 0x01860000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple02.il.bsl
index a668638daa3..74b9baa5502 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple02.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Tuple02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Tuple02
 {
-  // Offset: 0x00000000 Length: 0x0000013F
+  // Offset: 0x00000000 Length: 0x00000147
+}
+.mresource public FSharpSignatureDataB.Tuple02
+{
+  // Offset: 0x00000150 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Tuple02
 {
-  // Offset: 0x00000148 Length: 0x0000004E
+  // Offset: 0x00000158 Length: 0x0000004E
+}
+.mresource public FSharpOptimizationDataB.Tuple02
+{
+  // Offset: 0x000001B0 Length: 0x00000000
 }
 .module Tuple02.exe
-// MVID: {59B19208-ECCC-7D58-A745-03830892B159}
+// MVID: {5C6C932B-FD78-6D31-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02C00000
+// Image base: 0x00410000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple03.il.bsl
index db8af4b0cfa..45647ab8c5e 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple03.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Tuple03
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Tuple03
 {
-  // Offset: 0x00000000 Length: 0x0000013F
+  // Offset: 0x00000000 Length: 0x00000147
+}
+.mresource public FSharpSignatureDataB.Tuple03
+{
+  // Offset: 0x00000150 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Tuple03
 {
-  // Offset: 0x00000148 Length: 0x0000004E
+  // Offset: 0x00000158 Length: 0x0000004E
+}
+.mresource public FSharpOptimizationDataB.Tuple03
+{
+  // Offset: 0x000001B0 Length: 0x00000000
 }
 .module Tuple03.exe
-// MVID: {59B19208-AD65-A299-A745-03830892B159}
+// MVID: {5C6C932B-F9B9-6D31-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00AF0000
+// Image base: 0x01BA0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple04.il.bsl
index a35c62c665d..3f908dfdb64 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple04.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple04.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Tuple04
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Tuple04
 {
-  // Offset: 0x00000000 Length: 0x0000013F
+  // Offset: 0x00000000 Length: 0x00000147
+}
+.mresource public FSharpSignatureDataB.Tuple04
+{
+  // Offset: 0x00000150 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Tuple04
 {
-  // Offset: 0x00000148 Length: 0x0000004E
+  // Offset: 0x00000158 Length: 0x0000004E
+}
+.mresource public FSharpOptimizationDataB.Tuple04
+{
+  // Offset: 0x000001B0 Length: 0x00000000
 }
 .module Tuple04.exe
-// MVID: {59B19208-6A2E-9E97-A745-03830892B159}
+// MVID: {5C6C932B-D472-6D31-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x001E0000
+// Image base: 0x00EE0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple05.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple05.il.bsl
index 07388eb7f39..41a9f547bd0 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple05.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple05.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Tuple05
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Tuple05
 {
-  // Offset: 0x00000000 Length: 0x0000013F
+  // Offset: 0x00000000 Length: 0x00000147
+}
+.mresource public FSharpSignatureDataB.Tuple05
+{
+  // Offset: 0x00000150 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Tuple05
 {
-  // Offset: 0x00000148 Length: 0x0000004E
+  // Offset: 0x00000158 Length: 0x0000004E
+}
+.mresource public FSharpOptimizationDataB.Tuple05
+{
+  // Offset: 0x000001B0 Length: 0x00000000
 }
 .module Tuple05.exe
-// MVID: {59B19208-349F-319F-A745-03830892B159}
+// MVID: {5C6C932B-D0B3-6D31-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00730000
+// Image base: 0x002F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple06.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple06.il.bsl
index adbe519a887..55c69e8b262 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple06.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple06.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Tuple06
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Tuple06
 {
-  // Offset: 0x00000000 Length: 0x0000013F
+  // Offset: 0x00000000 Length: 0x00000147
+}
+.mresource public FSharpSignatureDataB.Tuple06
+{
+  // Offset: 0x00000150 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Tuple06
 {
-  // Offset: 0x00000148 Length: 0x0000004E
+  // Offset: 0x00000158 Length: 0x0000004E
+}
+.mresource public FSharpOptimizationDataB.Tuple06
+{
+  // Offset: 0x000001B0 Length: 0x00000000
 }
 .module Tuple06.exe
-// MVID: {59B19208-67E0-4675-A745-03830892B159}
+// MVID: {5C6C932B-ED74-6D31-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02A20000
+// Image base: 0x011F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple07.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple07.il.bsl
index e42f75990a8..49bc4eb9b4c 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple07.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple07.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Tuple07
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Tuple07
 {
-  // Offset: 0x00000000 Length: 0x0000013F
+  // Offset: 0x00000000 Length: 0x00000147
+}
+.mresource public FSharpSignatureDataB.Tuple07
+{
+  // Offset: 0x00000150 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Tuple07
 {
-  // Offset: 0x00000148 Length: 0x0000004E
+  // Offset: 0x00000158 Length: 0x0000004E
+}
+.mresource public FSharpOptimizationDataB.Tuple07
+{
+  // Offset: 0x000001B0 Length: 0x00000000
 }
 .module Tuple07.exe
-// MVID: {59B19208-7229-962D-A745-03830892B159}
+// MVID: {5C6C932B-E9B5-6D31-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x017A0000
+// Image base: 0x01300000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple08.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple08.il.bsl
index d029623cf32..27689a5ea43 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple08.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/Tuple08.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Tuple08
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Tuple08
 {
-  // Offset: 0x00000000 Length: 0x0000013F
+  // Offset: 0x00000000 Length: 0x00000147
+}
+.mresource public FSharpSignatureDataB.Tuple08
+{
+  // Offset: 0x00000150 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.Tuple08
 {
-  // Offset: 0x00000148 Length: 0x0000004E
+  // Offset: 0x00000158 Length: 0x0000004E
+}
+.mresource public FSharpOptimizationDataB.Tuple08
+{
+  // Offset: 0x000001B0 Length: 0x00000000
 }
 .module Tuple08.exe
-// MVID: {59B19208-E542-67B3-A745-03830892B159}
+// MVID: {5C6C932B-067E-6D32-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00390000
+// Image base: 0x01760000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleElimination.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleElimination.il.bsl
index 8feaefd480e..2e3f26381d4 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleElimination.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleElimination.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly TupleElimination
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000236
 }
+.mresource public FSharpSignatureDataB.TupleElimination
+{
+  // Offset: 0x00000240 Length: 0x00000007
+}
 .mresource public FSharpOptimizationData.TupleElimination
 {
-  // Offset: 0x00000240 Length: 0x0000007B
+  // Offset: 0x00000250 Length: 0x0000007B
+}
+.mresource public FSharpOptimizationDataB.TupleElimination
+{
+  // Offset: 0x000002D0 Length: 0x00000000
 }
 .module TupleElimination.exe
-// MVID: {5B17FC67-DFDD-92DF-A745-038367FC175B}
+// MVID: {5C6C932B-5561-FAE7-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02760000
+// Image base: 0x012C0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleMonster.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleMonster.il.bsl
index 1626f867b9d..85a676b482c 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleMonster.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleMonster.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly TupleMonster
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.TupleMonster
 {
-  // Offset: 0x00000000 Length: 0x00000149
+  // Offset: 0x00000000 Length: 0x00000151
+}
+.mresource public FSharpSignatureDataB.TupleMonster
+{
+  // Offset: 0x00000158 Length: 0x00000000
 }
 .mresource public FSharpOptimizationData.TupleMonster
 {
-  // Offset: 0x00000150 Length: 0x00000053
+  // Offset: 0x00000160 Length: 0x00000053
+}
+.mresource public FSharpOptimizationDataB.TupleMonster
+{
+  // Offset: 0x000001B8 Length: 0x00000000
 }
 .module TupleMonster.exe
-// MVID: {59B19208-1552-41D8-A745-03830892B159}
+// MVID: {5C6C932B-36C8-CAB4-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x010B0000
+// Image base: 0x00710000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/ValueTupleAliasConstructor.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/ValueTupleAliasConstructor.il.bsl
index 768deb722a1..a4e92adba0a 100644
--- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/ValueTupleAliasConstructor.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/ValueTupleAliasConstructor.il.bsl
@@ -15,11 +15,6 @@
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
   .ver 4:5:0:0
 }
-.assembly extern System.ValueTuple
-{
-  .publickeytoken = (CC 7B 13 FF CD 2D DD 51 )                         // .{...-.Q
-  .ver 4:0:1:0
-}
 .assembly ValueTupleAliasConstructor
 {
   .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
@@ -34,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ValueTupleAliasConstructor
 {
-  // Offset: 0x00000000 Length: 0x000001EA
+  // Offset: 0x00000000 Length: 0x000001EC
+}
+.mresource public FSharpSignatureDataB.ValueTupleAliasConstructor
+{
+  // Offset: 0x000001F0 Length: 0x00000002
 }
 .mresource public FSharpOptimizationData.ValueTupleAliasConstructor
 {
-  // Offset: 0x000001F0 Length: 0x00000061
+  // Offset: 0x000001F8 Length: 0x00000061
+}
+.mresource public FSharpOptimizationDataB.ValueTupleAliasConstructor
+{
+  // Offset: 0x00000260 Length: 0x00000000
 }
 .module ValueTupleAliasConstructor.exe
-// MVID: {5B9C53DD-A8CF-BB34-A745-0383DD539C5B}
+// MVID: {5C6C932B-E59F-7FAD-A745-03832B936C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01B00000
+// Image base: 0x01150000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
@@ -71,11 +74,11 @@
     // Code size       9 (0x9)
     .maxstack  8
     .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
-    .line 3,3 : 9,22 'c:\\kevinransom\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\Tuples\\ValueTupleAliasConstructor.fs'
+    .line 3,3 : 9,22 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\Tuples\\ValueTupleAliasConstructor.fs'
     IL_0000:  ldc.i4.2
     IL_0001:  ldc.i4.2
-    IL_0002:  newobj     instance void valuetype [System.ValueTuple]System.ValueTuple`2::.ctor(!0,
-                                                                                                            !1)
+    IL_0002:  newobj     instance void valuetype [mscorlib]System.ValueTuple`2::.ctor(!0,
+                                                                                                   !1)
     IL_0007:  pop
     IL_0008:  ret
   } // end of method $ValueTupleAliasConstructor::main@
diff --git a/tests/fsharpqa/Source/CodeGen/LazyNoInline01.il.bsl b/tests/fsharpqa/Source/CodeGen/LazyNoInline01.il.bsl
index 54cc47dfc7d..d45a480f910 100644
--- a/tests/fsharpqa/Source/CodeGen/LazyNoInline01.il.bsl
+++ b/tests/fsharpqa/Source/CodeGen/LazyNoInline01.il.bsl
@@ -31,10 +31,18 @@
 {
   // Offset: 0x00000000 Length: 0x000001A8
 }
+.mresource public FSharpSignatureDataB.LazyNoInline01
+{
+  // Offset: 0x00000000 Length: 0x000001A8
+}
 .mresource public FSharpOptimizationData.LazyNoInline01
 {
   // Offset: 0x000001B0 Length: 0x00000074
 }
+.mresource public FSharpOptimizationDataB.LazyNoInline01
+{
+  // Offset: 0x000001B0 Length: 0x00000074
+}
 .module LazyNoInline01.exe
 // MVID: {4CDA515D-3328-E592-A745-03835D51DA4C}
 .imagebase 0x00400000
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/gccerrors/comparer.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/gccerrors/comparer.fsx
index dfc716408b9..78eba0e6a71 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsc/gccerrors/comparer.fsx
+++ b/tests/fsharpqa/Source/CompilerOptions/fsc/gccerrors/comparer.fsx
@@ -1,8 +1,10 @@
+open System
+open System.IO
 // #NoMT #CompilerOptions #RequiresENU   
 let fn1 = fsi.CommandLineArgs.[1]
 let fn2 = fsi.CommandLineArgs.[2]
 // Read file into an array
-let File2List(filename : string) = System.IO.File.ReadAllLines filename |> Array.toList
+let File2List(filename : string) = File.ReadAllLines filename |> Array.toList
 let f1 = File2List fn1
 let f2 = File2List fn2
 let mutable i = 0
@@ -17,5 +19,11 @@ let compare f1 f2 =
                          printfn "\t<< %s" b
                          false)
 
+let update = try Environment.GetEnvironmentVariable("TEST_UPDATE_BSL") = "1" with _ -> false
+
+if update then 
+    printfn "Updating %s --> %s" fn1 fn2
+    File.Copy(fn1, fn2, true)
+
 exit (if (f1.Length = f2.Length && compare f1 f2) then 0
       else 1)
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/help/comparer.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/help/comparer.fsx
index 38adec6afd1..a64c3b89d2f 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsc/help/comparer.fsx
+++ b/tests/fsharpqa/Source/CompilerOptions/fsc/help/comparer.fsx
@@ -1,5 +1,6 @@
 // #NoMT #CompilerOptions #RequiresENU   
-#light
+open System
+open System.IO
 
 let arg0 = System.Environment.GetCommandLineArgs().[0]
 let path = System.Environment.GetEnvironmentVariable("PATH")
@@ -26,7 +27,16 @@ let compare (f1:string[]) (f2:string[]) =
             printfn "\t>> %s" a
             printfn "\t<< %s" b
             false
-       ) 
+    ) 
 
-exit (if compare f1 f2 then 0 else 1)
+let update = try Environment.GetEnvironmentVariable("TEST_UPDATE_BSL") = "1" with _ -> false
 
+if update then 
+    printfn "Updating %s --> %s" fn1 fn2
+    File.Copy(fn1, fn2, true)
+
+let exitCode = 
+   if compare f1 f2 then 0 
+   else printfn "File contents differ"; 1 
+
+exit exitCode
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl
index b0fd6746810..f449adb91fb 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl
+++ b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl
@@ -93,6 +93,9 @@ Copyright (c) Microsoft Corporation. All Rights Reserved.
 --nowarn:                      Disable specific warning messages
 --warnon:                      Enable specific warnings that may be
                                          off by default
+--checknulls[+|-]                        Enable nullness declarations and
+                                         checks
+--langversion:                           Specify the language version
 --consolecolors[+|-]                     Output warning and error messages in
                                          color
 
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/nologo/comparer.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/nologo/comparer.fsx
index 9f4ea4aab69..92dbc42a9a2 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsc/nologo/comparer.fsx
+++ b/tests/fsharpqa/Source/CompilerOptions/fsc/nologo/comparer.fsx
@@ -1,5 +1,6 @@
 // #NoMT #CompilerOptions #RequiresENU 
-#light
+open System
+open System.IO
 
 let fn1 = fsi.CommandLineArgs.[1]
 let fn2 = fsi.CommandLineArgs.[2]
@@ -30,4 +31,11 @@ let compare (f1:string list) (f2:string list) = List.forall2  (fun (a:string) (b
                                                                             false
                                                                        ) f1 f2
 
+
+let update = try Environment.GetEnvironmentVariable("TEST_UPDATE_BSL") = "1" with _ -> false
+
+if update then 
+    printfn "Updating %s --> %s" fn1 fn2
+    File.Copy(fn1, fn2, true)
+
 exit (if compare f1 f2 then 0 else 1)
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/nologo/logo.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/nologo/logo.437.1033.bsl
index 7f0560a46c0..aa3952904d4 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsc/nologo/logo.437.1033.bsl
+++ b/tests/fsharpqa/Source/CompilerOptions/fsc/nologo/logo.437.1033.bsl
@@ -1,4 +1,4 @@
-Microsoft (R) F# Compiler version 11.0.50518.0
+Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
 Copyright (c) Microsoft Corporation. All Rights Reserved.
 
 error FS0207: No inputs specified
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/exename/comparer.fsx b/tests/fsharpqa/Source/CompilerOptions/fsi/exename/comparer.fsx
index dd10fa3f16c..4dd1708a4ab 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsi/exename/comparer.fsx
+++ b/tests/fsharpqa/Source/CompilerOptions/fsi/exename/comparer.fsx
@@ -1,4 +1,7 @@
 // #NoMT #CompilerOptions #RequiresENU   
+open System
+open System.IO
+
 let fn1 = fsi.CommandLineArgs.[1]
 let fn2 = fsi.CommandLineArgs.[2]
 let File2List(filename : string) = System.IO.File.ReadAllLines filename |> Array.toList
@@ -16,6 +19,13 @@ let compare f1 f2 =
             printfn "\t<< %s" b
             false) 
 
+
+let update = try Environment.GetEnvironmentVariable("TEST_UPDATE_BSL") = "1" with _ -> false
+
+if update then 
+    printfn "Updating %s --> %s" fn1 fn2
+    File.Copy(fn1, fn2, true)
+
 exit (if compare f1 f2 then 0
       else 1)
 
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl
index d19a024e300..8f8d0a1e610 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl
+++ b/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl
@@ -44,6 +44,9 @@ Usage: fsharpi  [script.fsx []]
 --nowarn:                      Disable specific warning messages
 --warnon:                      Enable specific warnings that may be
                                          off by default
+--checknulls[+|-]                        Enable nullness declarations and
+                                         checks
+--langversion:                           Specify the language version
 --consolecolors[+|-]                     Output warning and error messages in
                                          color
 
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/comparer.fsx b/tests/fsharpqa/Source/CompilerOptions/fsi/help/comparer.fsx
index c0b39d14f3e..69938a4a679 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/comparer.fsx
+++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/comparer.fsx
@@ -1,5 +1,6 @@
 // #NoMT #CompilerOptions #RequiresENU   
-#light
+open System
+open System.IO
 
 let arg0 = System.Environment.GetCommandLineArgs().[0]
 let path = System.Environment.GetEnvironmentVariable("PATH")
@@ -33,4 +34,11 @@ let compare (f1:string[]) (f2:string[]) =
             false
        ) 
 
+
+let update = try Environment.GetEnvironmentVariable("TEST_UPDATE_BSL") = "1" with _ -> false
+
+if update then 
+    printfn "Updating %s --> %s" fn1 fn2
+    File.Copy(fn1, fn2, true)
+
 exit (if compare f1 f2 then 0 else 1)
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl
index 242cb274d2d..27603967ae4 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl
+++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl
@@ -1,5 +1,5 @@
 
-Usage: fsi.exe  [script.fsx []]
+Usage: fsiAnyCpu.exe  [script.fsx []]
 
 
 		- INPUT FILES -
@@ -44,6 +44,9 @@ Usage: fsi.exe  [script.fsx []]
 --nowarn:                      Disable specific warning messages
 --warnon:                      Enable specific warnings that may be
                                          off by default
+--checknulls[+|-]                        Enable nullness declarations and
+                                         checks
+--langversion:                           Specify the language version
 --consolecolors[+|-]                     Output warning and error messages in
                                          color
 
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl
index 34d28e5f70b..b0abb6af670 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl
+++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl
@@ -1,7 +1,7 @@
 Microsoft (R) F# Interactive version 10.2.3 for F# 4.5
 Copyright (c) Microsoft Corporation. All Rights Reserved.
 
-Usage: fsi.exe  [script.fsx []]
+Usage: fsiAnyCpu.exe  [script.fsx []]
 
 
 		- INPUT FILES -
@@ -46,6 +46,9 @@ Usage: fsi.exe  [script.fsx []]
 --nowarn:                      Disable specific warning messages
 --warnon:                      Enable specific warnings that may be
                                          off by default
+--checknulls[+|-]                        Enable nullness declarations and
+                                         checks
+--langversion:                           Specify the language version
 --consolecolors[+|-]                     Output warning and error messages in
                                          color
 
diff --git a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in05.fs b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in05.fs
index eaefd989c14..0c386d1676d 100644
--- a/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in05.fs
+++ b/tests/fsharpqa/Source/Conformance/Expressions/BindingExpressions/Binding/in05.fs
@@ -4,8 +4,8 @@
 // I'm adding these cases to make sure we do not accidentally change the behavior from version to version
 // Eventually, we will deprecated them - and the specs will be updated.
 //The type 'int' does not match the type 'unit'$
-//Type mismatch\. Expecting a.    ''a -> 'b'    .but given a.    ''a -> unit'    .The type 'int' does not match the type 'unit'$
 //The result of this expression has type 'bool' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$
+
 module E = 
     let a = 3 in
         a + 1 |> ignore
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx
index d2eb3f460ae..08eb1ecdafd 100644
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx
+++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx
@@ -22,11 +22,11 @@ type T4() =
     inherit CSLib5.B1()
     override x.M(i : int) = 2     // ERROR {expected}
 
-//Cannot override inherited member 'B1::M' because it is sealed$
-//Cannot override inherited member 'B1::M' because it is sealed$
-//Cannot override inherited member 'B1::M' because it is sealed$
+//Cannot override inherited member 'CSLib.B1::M' because it is sealed$
+//Cannot override inherited member 'CSLib2.B1::M' because it is sealed$
+//Cannot override inherited member 'CSLib4.B1::M' because it is sealed$
 //No implementation was given for those members:
 //	'CSLib5\.B0\.M\(c: char, a: int\) : int'
 //	'CSLib5\.B0\.N\(c: char, a: int\) : int'
 //This type is 'abstract' since some abstract members have not been given an implementation\. If this is intentional then add the '\[\]' attribute to your type\.$
-//Cannot override inherited member 'B1::M' because it is sealed$
\ No newline at end of file
+//Cannot override inherited member 'CSLib5.B1::M' because it is sealed$
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override03.fsx b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override03.fsx
index 9414401cb12..5767cfa602e 100644
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override03.fsx
+++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override03.fsx
@@ -14,5 +14,5 @@ type T2() =
     override x.M(o : obj) = 12
     override x.M(i : int) = 2     // ERROR {expected}
 
-//Cannot override inherited member 'B1::M' because it is sealed$
-//Cannot override inherited member 'B1::M' because it is sealed$
\ No newline at end of file
+//Cannot override inherited member 'CSLib.B1::M' because it is sealed$
+//Cannot override inherited member 'CSLib2.B1::M' because it is sealed$
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Import/E_SealedMethod.fs b/tests/fsharpqa/Source/Import/E_SealedMethod.fs
index c3e4790d3dd..2abecd67045 100644
--- a/tests/fsharpqa/Source/Import/E_SealedMethod.fs
+++ b/tests/fsharpqa/Source/Import/E_SealedMethod.fs
@@ -1,6 +1,6 @@
 // #Regression #NoMT #Import 
 // Dev11 Bug 90642
-//Cannot override inherited member 'Class2::F' because it is sealed$
+//Cannot override inherited member 'ClassLibrary1.Class2::F' because it is sealed$
 
 type MyClass() =
     inherit ClassLibrary1.Class2()
diff --git a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs
index 8d4c0cd35f5..da8cd1abe50 100644
--- a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs
+++ b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs
@@ -2225,6 +2225,20 @@ Microsoft.FSharp.Core.Operators+Unchecked: System.Type GetType()
 Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]()
 Microsoft.FSharp.Core.Operators: Boolean Equals(System.Object)
 Microsoft.FSharp.Core.Operators: Boolean Not(Boolean)
+Microsoft.FSharp.Core.Operators: Boolean IsNullV[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullMatchPattern[T](T)
+Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullValueMatchPattern[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: System.Nullable`1[T] NullV[T]()
+Microsoft.FSharp.Core.Operators: System.Nullable`1[T] WithNullV[T](T)
+Microsoft.FSharp.Core.Operators: T DefaultIfNone[T](T, Microsoft.FSharp.Core.FSharpOption`1[T])
+Microsoft.FSharp.Core.Operators: T DefaultIfNullV[T](T, System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: T DefaultIfNull[T](T, T)
+Microsoft.FSharp.Core.Operators: T NonNullPattern[T](T)
+Microsoft.FSharp.Core.Operators: T NonNullV[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: T NonNullValuePattern[T](System.Nullable`1[T])
+Microsoft.FSharp.Core.Operators: T NonNull[T](T)
+Microsoft.FSharp.Core.Operators: T NullArgCheck[T](System.String, T)
+Microsoft.FSharp.Core.Operators: T WithNull[T](T)
 Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T)
 Microsoft.FSharp.Core.Operators: Boolean op_GreaterThanOrEqual[T](T, T)
 Microsoft.FSharp.Core.Operators: Boolean op_GreaterThan[T](T, T)
diff --git a/tests/fsharpqa/Source/Optimizations/CompareIL.cmd b/tests/fsharpqa/Source/Optimizations/CompareIL.cmd
index 0462386d285..0b48c2a26da 100644
--- a/tests/fsharpqa/Source/Optimizations/CompareIL.cmd
+++ b/tests/fsharpqa/Source/Optimizations/CompareIL.cmd
@@ -5,5 +5,12 @@ IF NOT ERRORLEVEL 0 exit 1
 
 echo ..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il"
 ..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il"
+
+
+if /i "%TEST_UPDATE_BSL%" == "1" (
+  echo copy /y "%~n1.il" "%~n1.il.bsl"
+  copy /y "%~n1.il" "%~n1.il.bsl"
+)
+
 exit /b %ERRORLEVEL%
 
diff --git a/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnArray01.il.bsl b/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnArray01.il.bsl
index 38b3a3aa80c..af596ec9fd0 100644
--- a/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnArray01.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnArray01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ForEachOnArray01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ForEachOnArray01
 {
-  // Offset: 0x00000000 Length: 0x000001E0
+  // Offset: 0x00000000 Length: 0x000001E8
+}
+.mresource public FSharpSignatureDataB.ForEachOnArray01
+{
+  // Offset: 0x000001F0 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.ForEachOnArray01
 {
-  // Offset: 0x000001E8 Length: 0x0000007C
+  // Offset: 0x000001F8 Length: 0x0000007C
+}
+.mresource public FSharpOptimizationDataB.ForEachOnArray01
+{
+  // Offset: 0x00000278 Length: 0x00000000
 }
 .module ForEachOnArray01.dll
-// MVID: {59B18AEE-7E2E-D3AE-A745-0383EE8AB159}
+// MVID: {5C6C9457-50A7-149A-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00D00000
+// Image base: 0x03050000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnList01.il.bsl b/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnList01.il.bsl
index 14d6a854963..d8d232df889 100644
--- a/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnList01.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnList01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ForEachOnList01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ForEachOnList01
 {
-  // Offset: 0x00000000 Length: 0x000002ED
+  // Offset: 0x00000000 Length: 0x000002F5
+}
+.mresource public FSharpSignatureDataB.ForEachOnList01
+{
+  // Offset: 0x00000300 Length: 0x00000016
 }
 .mresource public FSharpOptimizationData.ForEachOnList01
 {
-  // Offset: 0x000002F8 Length: 0x000000DB
+  // Offset: 0x00000320 Length: 0x000000DB
+}
+.mresource public FSharpOptimizationDataB.ForEachOnList01
+{
+  // Offset: 0x00000400 Length: 0x00000000
 }
 .module ForEachOnList01.dll
-// MVID: {59B18AEE-56DF-F74F-A745-0383EE8AB159}
+// MVID: {5C6C9457-0E98-FFDA-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002D0000
+// Image base: 0x01A80000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnString01.il.bsl b/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnString01.il.bsl
index 0db8de85fcc..0e41dfff845 100644
--- a/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnString01.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/ForLoop/ForEachOnString01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ForEachOnString01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ForEachOnString01
 {
-  // Offset: 0x00000000 Length: 0x00000354
+  // Offset: 0x00000000 Length: 0x0000035C
+}
+.mresource public FSharpSignatureDataB.ForEachOnString01
+{
+  // Offset: 0x00000360 Length: 0x0000001B
 }
 .mresource public FSharpOptimizationData.ForEachOnString01
 {
-  // Offset: 0x00000358 Length: 0x000000FF
+  // Offset: 0x00000380 Length: 0x000000FF
+}
+.mresource public FSharpOptimizationDataB.ForEachOnString01
+{
+  // Offset: 0x00000488 Length: 0x00000000
 }
 .module ForEachOnString01.dll
-// MVID: {59B18AEE-105C-852B-A745-0383EE8AB159}
+// MVID: {5C6C9457-3AEB-B9F2-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002D0000
+// Image base: 0x00720000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/ForLoop/NoAllocationOfTuple01.il.bsl b/tests/fsharpqa/Source/Optimizations/ForLoop/NoAllocationOfTuple01.il.bsl
index 4dd6df631f0..947de419665 100644
--- a/tests/fsharpqa/Source/Optimizations/ForLoop/NoAllocationOfTuple01.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/ForLoop/NoAllocationOfTuple01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly NoAllocationOfTuple01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.NoAllocationOfTuple01
 {
-  // Offset: 0x00000000 Length: 0x000001E0
+  // Offset: 0x00000000 Length: 0x000001E8
+}
+.mresource public FSharpSignatureDataB.NoAllocationOfTuple01
+{
+  // Offset: 0x000001F0 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.NoAllocationOfTuple01
 {
-  // Offset: 0x000001E8 Length: 0x00000085
+  // Offset: 0x000001F8 Length: 0x00000085
+}
+.mresource public FSharpOptimizationDataB.NoAllocationOfTuple01
+{
+  // Offset: 0x00000288 Length: 0x00000000
 }
 .module NoAllocationOfTuple01.dll
-// MVID: {59B18AEE-13B5-F699-A745-0383EE8AB159}
+// MVID: {5C6C9457-98F3-D7D7-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x03460000
+// Image base: 0x00980000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable01.il.bsl b/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable01.il.bsl
index 41dcfaf2ed2..4b9d179a30d 100644
--- a/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable01.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly NoIEnumerable01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.NoIEnumerable01
 {
-  // Offset: 0x00000000 Length: 0x000001D1
+  // Offset: 0x00000000 Length: 0x000001D9
+}
+.mresource public FSharpSignatureDataB.NoIEnumerable01
+{
+  // Offset: 0x000001E0 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.NoIEnumerable01
 {
-  // Offset: 0x000001D8 Length: 0x0000006C
+  // Offset: 0x000001E8 Length: 0x0000006C
+}
+.mresource public FSharpOptimizationDataB.NoIEnumerable01
+{
+  // Offset: 0x00000258 Length: 0x00000000
 }
 .module NoIEnumerable01.dll
-// MVID: {59B18AEE-31A1-8DCB-A745-0383EE8AB159}
+// MVID: {5C6C9457-5ACD-81FC-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x013E0000
+// Image base: 0x00E20000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable02.il.bsl b/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable02.il.bsl
index 12424f0aa91..3f851eb66cf 100644
--- a/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable02.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly NoIEnumerable02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.NoIEnumerable02
 {
-  // Offset: 0x00000000 Length: 0x000001D1
+  // Offset: 0x00000000 Length: 0x000001D9
+}
+.mresource public FSharpSignatureDataB.NoIEnumerable02
+{
+  // Offset: 0x000001E0 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.NoIEnumerable02
 {
-  // Offset: 0x000001D8 Length: 0x0000006C
+  // Offset: 0x000001E8 Length: 0x0000006C
+}
+.mresource public FSharpOptimizationDataB.NoIEnumerable02
+{
+  // Offset: 0x00000258 Length: 0x00000000
 }
 .module NoIEnumerable02.dll
-// MVID: {59B18AEE-5066-4012-A745-0383EE8AB159}
+// MVID: {5C6C9457-56CE-81FC-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00720000
+// Image base: 0x02DF0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable03.il.bsl b/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable03.il.bsl
index 7223d4a04bd..c925618a60d 100644
--- a/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable03.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/ForLoop/NoIEnumerable03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly NoIEnumerable03
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.NoIEnumerable03
 {
-  // Offset: 0x00000000 Length: 0x000001DF
+  // Offset: 0x00000000 Length: 0x000001E7
+}
+.mresource public FSharpSignatureDataB.NoIEnumerable03
+{
+  // Offset: 0x000001F0 Length: 0x00000005
 }
 .mresource public FSharpOptimizationData.NoIEnumerable03
 {
-  // Offset: 0x000001E8 Length: 0x0000006C
+  // Offset: 0x00000200 Length: 0x0000006C
+}
+.mresource public FSharpOptimizationDataB.NoIEnumerable03
+{
+  // Offset: 0x00000270 Length: 0x00000000
 }
 .module NoIEnumerable03.dll
-// MVID: {59B18AEE-7903-6020-A745-0383EE8AB159}
+// MVID: {5C6C9457-52CF-81FC-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01970000
+// Image base: 0x00B40000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/ForLoop/ZeroToArrLength01.il.bsl b/tests/fsharpqa/Source/Optimizations/ForLoop/ZeroToArrLength01.il.bsl
index a27da5651f5..c26749d3b08 100644
--- a/tests/fsharpqa/Source/Optimizations/ForLoop/ZeroToArrLength01.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/ForLoop/ZeroToArrLength01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ZeroToArrLength01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ZeroToArrLength01
 {
-  // Offset: 0x00000000 Length: 0x000001E0
+  // Offset: 0x00000000 Length: 0x000001E8
+}
+.mresource public FSharpSignatureDataB.ZeroToArrLength01
+{
+  // Offset: 0x000001F0 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.ZeroToArrLength01
 {
-  // Offset: 0x000001E8 Length: 0x0000007B
+  // Offset: 0x000001F8 Length: 0x0000007B
+}
+.mresource public FSharpOptimizationDataB.ZeroToArrLength01
+{
+  // Offset: 0x00000278 Length: 0x00000000
 }
 .module ZeroToArrLength01.dll
-// MVID: {59B18AEE-A3D0-03A7-A745-0383EE8AB159}
+// MVID: {5C6C9457-61C7-F28D-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02E70000
+// Image base: 0x01260000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/ForLoop/ZeroToArrLength02.il.bsl b/tests/fsharpqa/Source/Optimizations/ForLoop/ZeroToArrLength02.il.bsl
index eedc9d7bee3..eae2652a618 100644
--- a/tests/fsharpqa/Source/Optimizations/ForLoop/ZeroToArrLength02.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/ForLoop/ZeroToArrLength02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly ZeroToArrLength02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.ZeroToArrLength02
 {
-  // Offset: 0x00000000 Length: 0x000001E0
+  // Offset: 0x00000000 Length: 0x000001E8
+}
+.mresource public FSharpSignatureDataB.ZeroToArrLength02
+{
+  // Offset: 0x000001F0 Length: 0x00000004
 }
 .mresource public FSharpOptimizationData.ZeroToArrLength02
 {
-  // Offset: 0x000001E8 Length: 0x0000007B
+  // Offset: 0x000001F8 Length: 0x0000007B
+}
+.mresource public FSharpOptimizationDataB.ZeroToArrLength02
+{
+  // Offset: 0x00000278 Length: 0x00000000
 }
 .module ZeroToArrLength02.dll
-// MVID: {59B18AEE-A36B-03A7-A745-0383EE8AB159}
+// MVID: {5C6C9457-5DC8-F28D-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01550000
+// Image base: 0x00360000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare01.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare01.il.bsl
index 974905405eb..b668effe41a 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare01.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Compare01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Compare01
 {
-  // Offset: 0x00000000 Length: 0x00000225
+  // Offset: 0x00000000 Length: 0x0000022D
+}
+.mresource public FSharpSignatureDataB.Compare01
+{
+  // Offset: 0x00000238 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Compare01
 {
-  // Offset: 0x00000230 Length: 0x000000B2
+  // Offset: 0x00000240 Length: 0x000000B2
+}
+.mresource public FSharpOptimizationDataB.Compare01
+{
+  // Offset: 0x000002F8 Length: 0x00000000
 }
 .module Compare01.dll
-// MVID: {59B18AEE-04A0-F88E-A745-0383EE8AB159}
+// MVID: {5C6C9457-E518-27BF-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00FF0000
+// Image base: 0x015C0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare02.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare02.il.bsl
index 74bd16af665..d5725e2c683 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare02.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Compare02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Compare02
 {
-  // Offset: 0x00000000 Length: 0x0000022C
+  // Offset: 0x00000000 Length: 0x00000234
+}
+.mresource public FSharpSignatureDataB.Compare02
+{
+  // Offset: 0x00000238 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Compare02
 {
-  // Offset: 0x00000230 Length: 0x000000B9
+  // Offset: 0x00000240 Length: 0x000000B9
+}
+.mresource public FSharpOptimizationDataB.Compare02
+{
+  // Offset: 0x00000300 Length: 0x00000000
 }
 .module Compare02.dll
-// MVID: {59B18AEE-0481-F88E-A745-0383EE8AB159}
+// MVID: {5C6C9457-E917-27BF-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00BA0000
+// Image base: 0x01230000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare03.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare03.il.bsl
index c31f8088d27..be38ae1e682 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare03.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Compare03
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Compare03
 {
-  // Offset: 0x00000000 Length: 0x00000237
+  // Offset: 0x00000000 Length: 0x0000023F
+}
+.mresource public FSharpSignatureDataB.Compare03
+{
+  // Offset: 0x00000248 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Compare03
 {
-  // Offset: 0x00000240 Length: 0x000000B9
+  // Offset: 0x00000250 Length: 0x000000B9
+}
+.mresource public FSharpOptimizationDataB.Compare03
+{
+  // Offset: 0x00000310 Length: 0x00000000
 }
 .module Compare03.dll
-// MVID: {59B18AEE-0562-F88E-A745-0383EE8AB159}
+// MVID: {5C6C9457-CC16-27BF-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002E0000
+// Image base: 0x00F30000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare04.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare04.il.bsl
index 0a5d7ed4b4f..3ab46cbea0c 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare04.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare04.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Compare04
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Compare04
 {
-  // Offset: 0x00000000 Length: 0x00000237
+  // Offset: 0x00000000 Length: 0x0000023F
+}
+.mresource public FSharpSignatureDataB.Compare04
+{
+  // Offset: 0x00000248 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Compare04
 {
-  // Offset: 0x00000240 Length: 0x000000B9
+  // Offset: 0x00000250 Length: 0x000000B9
+}
+.mresource public FSharpOptimizationDataB.Compare04
+{
+  // Offset: 0x00000310 Length: 0x00000000
 }
 .module Compare04.dll
-// MVID: {59B18AEE-053B-F88E-A745-0383EE8AB159}
+// MVID: {5C6C9457-D115-27BF-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x013E0000
+// Image base: 0x00A60000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare05.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare05.il.bsl
index 1b66e37d298..db51cf273a9 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare05.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare05.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Compare05
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Compare05
 {
-  // Offset: 0x00000000 Length: 0x000006EC
+  // Offset: 0x00000000 Length: 0x000006E0
+}
+.mresource public FSharpSignatureDataB.Compare05
+{
+  // Offset: 0x000006E8 Length: 0x0000007E
 }
 .mresource public FSharpOptimizationData.Compare05
 {
-  // Offset: 0x000006F0 Length: 0x000003BA
+  // Offset: 0x00000770 Length: 0x000003BA
+}
+.mresource public FSharpOptimizationDataB.Compare05
+{
+  // Offset: 0x00000B30 Length: 0x00000057
 }
 .module Compare05.dll
-// MVID: {59B18AEE-051C-F88E-A745-0383EE8AB159}
+// MVID: {5C6C9457-D514-27BF-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002D0000
+// Image base: 0x01770000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare06.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare06.il.bsl
index 49c709033de..b49f71fa591 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare06.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare06.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Compare06
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Compare06
 {
-  // Offset: 0x00000000 Length: 0x000006DF
+  // Offset: 0x00000000 Length: 0x000006D3
+}
+.mresource public FSharpSignatureDataB.Compare06
+{
+  // Offset: 0x000006D8 Length: 0x0000007D
 }
 .mresource public FSharpOptimizationData.Compare06
 {
-  // Offset: 0x000006E8 Length: 0x000003BC
+  // Offset: 0x00000760 Length: 0x000003BC
+}
+.mresource public FSharpOptimizationDataB.Compare06
+{
+  // Offset: 0x00000B20 Length: 0x00000057
 }
 .module Compare06.dll
-// MVID: {59B18AEE-04FD-F88E-A745-0383EE8AB159}
+// MVID: {5C6C9457-D913-27BF-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02E80000
+// Image base: 0x007C0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare07.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare07.il.bsl
index 70335b05d20..05862d29f75 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare07.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare07.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Compare07
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Compare07
 {
-  // Offset: 0x00000000 Length: 0x0000089A
+  // Offset: 0x00000000 Length: 0x0000088E
+}
+.mresource public FSharpSignatureDataB.Compare07
+{
+  // Offset: 0x00000898 Length: 0x000000A8
 }
 .mresource public FSharpOptimizationData.Compare07
 {
-  // Offset: 0x000008A0 Length: 0x00000692
+  // Offset: 0x00000948 Length: 0x00000692
+}
+.mresource public FSharpOptimizationDataB.Compare07
+{
+  // Offset: 0x00000FE0 Length: 0x000000B8
 }
 .module Compare07.dll
-// MVID: {59B18AEE-05DE-F88E-A745-0383EE8AB159}
+// MVID: {5C6C9457-BC12-27BF-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02BA0000
+// Image base: 0x01740000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare08.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare08.il.bsl
index 29f55a0cb58..92ccc2b792d 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare08.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare08.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Compare08
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Compare08
 {
-  // Offset: 0x00000000 Length: 0x00000230
+  // Offset: 0x00000000 Length: 0x00000238
+}
+.mresource public FSharpSignatureDataB.Compare08
+{
+  // Offset: 0x00000240 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Compare08
 {
-  // Offset: 0x00000238 Length: 0x000000B2
+  // Offset: 0x00000248 Length: 0x000000B2
+}
+.mresource public FSharpOptimizationDataB.Compare08
+{
+  // Offset: 0x00000300 Length: 0x00000000
 }
 .module Compare08.dll
-// MVID: {59B18AEE-03E7-F88E-A745-0383EE8AB159}
+// MVID: {5C6C9457-BF21-27BF-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01590000
+// Image base: 0x01550000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare09.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare09.il.bsl
index 4d890783eed..5e0bc411704 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare09.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare09.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Compare09
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Compare09
 {
-  // Offset: 0x00000000 Length: 0x00000230
+  // Offset: 0x00000000 Length: 0x00000238
+}
+.mresource public FSharpSignatureDataB.Compare09
+{
+  // Offset: 0x00000240 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Compare09
 {
-  // Offset: 0x00000238 Length: 0x000000B2
+  // Offset: 0x00000248 Length: 0x000000B2
+}
+.mresource public FSharpOptimizationDataB.Compare09
+{
+  // Offset: 0x00000300 Length: 0x00000000
 }
 .module Compare09.dll
-// MVID: {59B18AEE-03C8-F88E-A745-0383EE8AB159}
+// MVID: {5C6C9457-C320-27BF-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01020000
+// Image base: 0x00700000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare10.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare10.il.bsl
index 16bada503c5..5af9d8d0353 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare10.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare10.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Compare10
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Compare10
 {
-  // Offset: 0x00000000 Length: 0x00000AA4
+  // Offset: 0x00000000 Length: 0x00000A98
+}
+.mresource public FSharpSignatureDataB.Compare10
+{
+  // Offset: 0x00000AA0 Length: 0x000000FA
 }
 .mresource public FSharpOptimizationData.Compare10
 {
-  // Offset: 0x00000AA8 Length: 0x0000058E
+  // Offset: 0x00000BA0 Length: 0x0000058E
+}
+.mresource public FSharpOptimizationDataB.Compare10
+{
+  // Offset: 0x00001138 Length: 0x000000AE
 }
 .module Compare10.dll
-// MVID: {59B18AEE-04BF-1753-A745-0383EE8AB159}
+// MVID: {5C6C9457-DAFE-57E6-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002E0000
+// Image base: 0x007B0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare11.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare11.il.bsl
index 7f37b719bb4..f6ae4589600 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare11.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Compare11.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Compare11
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Compare11
 {
-  // Offset: 0x00000000 Length: 0x00000230
+  // Offset: 0x00000000 Length: 0x00000238
+}
+.mresource public FSharpSignatureDataB.Compare11
+{
+  // Offset: 0x00000240 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Compare11
 {
-  // Offset: 0x00000238 Length: 0x000000B1
+  // Offset: 0x00000248 Length: 0x000000B1
+}
+.mresource public FSharpOptimizationDataB.Compare11
+{
+  // Offset: 0x00000300 Length: 0x00000000
 }
 .module Compare11.dll
-// MVID: {59B18AEE-04A0-1753-A745-0383EE8AB159}
+// MVID: {5C6C9457-DEFD-57E6-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x010A0000
+// Image base: 0x007A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals01.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals01.il.bsl
index c722fc2d31f..3e3f99af507 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals01.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Equals01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Equals01
 {
-  // Offset: 0x00000000 Length: 0x00000234
+  // Offset: 0x00000000 Length: 0x0000023C
+}
+.mresource public FSharpSignatureDataB.Equals01
+{
+  // Offset: 0x00000240 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Equals01
 {
-  // Offset: 0x00000238 Length: 0x000000B6
+  // Offset: 0x00000248 Length: 0x000000B6
+}
+.mresource public FSharpOptimizationDataB.Equals01
+{
+  // Offset: 0x00000308 Length: 0x00000000
 }
 .module Equals01.dll
-// MVID: {59B18AEE-0759-50B1-A745-0383EE8AB159}
+// MVID: {5C6C9457-0E46-E867-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02D70000
+// Image base: 0x012D0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals02.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals02.il.bsl
index aa7bbc68da5..21a9bee882d 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals02.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly Equals02
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000023C
 }
+.mresource public FSharpSignatureDataB.Equals02
+{
+  // Offset: 0x00000240 Length: 0x00000003
+}
 .mresource public FSharpOptimizationData.Equals02
 {
-  // Offset: 0x00000240 Length: 0x000000B6
+  // Offset: 0x00000248 Length: 0x000000B6
+}
+.mresource public FSharpOptimizationDataB.Equals02
+{
+  // Offset: 0x00000308 Length: 0x00000000
 }
 .module Equals02.dll
-// MVID: {5B18753B-0759-B6D8-A745-03833B75185B}
+// MVID: {5C6C9457-2317-8CEE-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00F20000
+// Image base: 0x012C0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
@@ -57,7 +65,7 @@
     .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) 
     .method public static bool  f4_tuple4() cil managed
     {
-      // Code size       44 (0x2c)
+      // Code size       36 (0x24)
       .maxstack  4
       .locals init ([0] bool x,
                [1] int32 i)
@@ -69,6 +77,7 @@
       IL_0002:  ldc.i4.0
       IL_0003:  stloc.1
       IL_0004:  br.s       IL_001a
+
       .line 9,9 : 12,26 ''
       IL_0006:  ldstr      "five"
       IL_000b:  ldstr      "5"
@@ -83,17 +92,22 @@
       IL_001a:  ldloc.1
       IL_001b:  ldc.i4     0x989681
       IL_0020:  blt.s      IL_0006
+
       .line 10,10 : 8,9 ''
       IL_0022:  ldloc.0
       IL_0023:  ret
     } // end of method EqualsMicroPerfAndCodeGenerationTests::f4_tuple4
+
   } // end of class EqualsMicroPerfAndCodeGenerationTests
+
 } // end of class Equals02
+
 .class private abstract auto ansi sealed ''.$Equals02$fsx
        extends [mscorlib]System.Object
 {
 } // end of class ''.$Equals02$fsx
 
+
 // =============================================================
 
 // *********** DISASSEMBLY COMPLETE ***********************
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals03.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals03.il.bsl
index e222d314825..47587c74657 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals03.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly Equals03
 {
@@ -31,18 +31,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000023C
 }
+.mresource public FSharpSignatureDataB.Equals03
+{
+  // Offset: 0x00000240 Length: 0x00000003
+}
 .mresource public FSharpOptimizationData.Equals03
 {
-  // Offset: 0x00000240 Length: 0x000000B6
+  // Offset: 0x00000248 Length: 0x000000B6
+}
+.mresource public FSharpOptimizationDataB.Equals03
+{
+  // Offset: 0x00000308 Length: 0x00000000
 }
 .module Equals03.dll
-// MVID: {5B18753B-0759-3313-A745-03833B75185B}
+// MVID: {5C6C9457-1A7C-8819-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02630000
+// Image base: 0x00EC0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals04.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals04.il.bsl
index 6ad198b4879..88208c84cb9 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals04.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals04.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Equals04
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Equals04
 {
-  // Offset: 0x00000000 Length: 0x000006E8
+  // Offset: 0x00000000 Length: 0x000006DC
+}
+.mresource public FSharpSignatureDataB.Equals04
+{
+  // Offset: 0x000006E0 Length: 0x0000007E
 }
 .mresource public FSharpOptimizationData.Equals04
 {
-  // Offset: 0x000006F0 Length: 0x000003B7
+  // Offset: 0x00000768 Length: 0x000003B7
+}
+.mresource public FSharpOptimizationDataB.Equals04
+{
+  // Offset: 0x00000B28 Length: 0x00000057
 }
 .module Equals04.dll
-// MVID: {59B18AEE-0759-EA8A-A745-0383EE8AB159}
+// MVID: {5C6C9457-994D-EF23-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002D0000
+// Image base: 0x001F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals05.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals05.il.bsl
index ecc013d450a..6ae166b4375 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals05.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals05.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Equals05
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Equals05
 {
-  // Offset: 0x00000000 Length: 0x000006DB
+  // Offset: 0x00000000 Length: 0x000006CF
+}
+.mresource public FSharpSignatureDataB.Equals05
+{
+  // Offset: 0x000006D8 Length: 0x0000007D
 }
 .mresource public FSharpOptimizationData.Equals05
 {
-  // Offset: 0x000006E0 Length: 0x000003B9
+  // Offset: 0x00000760 Length: 0x000003B9
+}
+.mresource public FSharpOptimizationDataB.Equals05
+{
+  // Offset: 0x00000B20 Length: 0x00000057
 }
 .module Equals05.dll
-// MVID: {59B18AEE-0759-CBC5-A745-0383EE8AB159}
+// MVID: {5C6C9457-90B2-EA4E-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x033B0000
+// Image base: 0x002E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals06.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals06.il.bsl
index 91247bff24d..b73361b489f 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals06.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals06.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Equals06
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Equals06
 {
-  // Offset: 0x00000000 Length: 0x00000896
+  // Offset: 0x00000000 Length: 0x0000088A
+}
+.mresource public FSharpSignatureDataB.Equals06
+{
+  // Offset: 0x00000890 Length: 0x000000A8
 }
 .mresource public FSharpOptimizationData.Equals06
 {
-  // Offset: 0x000008A0 Length: 0x0000068E
+  // Offset: 0x00000940 Length: 0x0000068E
+}
+.mresource public FSharpOptimizationDataB.Equals06
+{
+  // Offset: 0x00000FD8 Length: 0x000000B8
 }
 .module Equals06.dll
-// MVID: {59B18AEE-0759-31EC-A745-0383EE8AB159}
+// MVID: {5C6C9457-A583-8ED5-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01B90000
+// Image base: 0x00C60000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals07.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals07.il.bsl
index 91f97c289a2..5d3de51dd7b 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals07.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals07.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Equals07
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Equals07
 {
-  // Offset: 0x00000000 Length: 0x0000022D
+  // Offset: 0x00000000 Length: 0x00000235
+}
+.mresource public FSharpSignatureDataB.Equals07
+{
+  // Offset: 0x00000240 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Equals07
 {
-  // Offset: 0x00000238 Length: 0x000000AF
+  // Offset: 0x00000248 Length: 0x000000AF
+}
+.mresource public FSharpOptimizationDataB.Equals07
+{
+  // Offset: 0x00000300 Length: 0x00000000
 }
 .module Equals07.dll
-// MVID: {59B18AEE-0759-AE27-A745-0383EE8AB159}
+// MVID: {5C6C9457-9CE8-8A00-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01C80000
+// Image base: 0x01510000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals08.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals08.il.bsl
index 55da6ee102e..6e5b2aa5044 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals08.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals08.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Equals08
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Equals08
 {
-  // Offset: 0x00000000 Length: 0x0000022D
+  // Offset: 0x00000000 Length: 0x00000235
+}
+.mresource public FSharpSignatureDataB.Equals08
+{
+  // Offset: 0x00000240 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Equals08
 {
-  // Offset: 0x00000238 Length: 0x000000AF
+  // Offset: 0x00000248 Length: 0x000000AF
+}
+.mresource public FSharpOptimizationDataB.Equals08
+{
+  // Offset: 0x00000300 Length: 0x00000000
 }
 .module Equals08.dll
-// MVID: {59B18AEE-0759-659E-A745-0383EE8AB159}
+// MVID: {5C6C9457-25B9-C4FB-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01090000
+// Image base: 0x02AC0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals09.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals09.il.bsl
index 8985acaa02b..8323f0cc60a 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals09.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals09.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Equals09
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Equals09
 {
-  // Offset: 0x00000000 Length: 0x00000AA0
+  // Offset: 0x00000000 Length: 0x00000A94
+}
+.mresource public FSharpSignatureDataB.Equals09
+{
+  // Offset: 0x00000A98 Length: 0x000000FA
 }
 .mresource public FSharpOptimizationData.Equals09
 {
-  // Offset: 0x00000AA8 Length: 0x0000058B
+  // Offset: 0x00000B98 Length: 0x0000058B
+}
+.mresource public FSharpOptimizationDataB.Equals09
+{
+  // Offset: 0x00001128 Length: 0x000000AE
 }
 .module Equals09.dll
-// MVID: {59B18AEE-0759-46D9-A745-0383EE8AB159}
+// MVID: {5C6C9457-1D1E-C026-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02720000
+// Image base: 0x03080000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash01.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash01.il.bsl
index cb63a42741b..793c6f599a0 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash01.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash01
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash01
 {
-  // Offset: 0x00000000 Length: 0x00000219
+  // Offset: 0x00000000 Length: 0x00000221
+}
+.mresource public FSharpSignatureDataB.Hash01
+{
+  // Offset: 0x00000228 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Hash01
 {
-  // Offset: 0x00000220 Length: 0x000000A9
+  // Offset: 0x00000230 Length: 0x000000A9
+}
+.mresource public FSharpOptimizationDataB.Hash01
+{
+  // Offset: 0x000002E0 Length: 0x00000000
 }
 .module Hash01.dll
-// MVID: {59B18AEE-9642-78D3-A745-0383EE8AB159}
+// MVID: {5C6C9457-1A55-AA80-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02FB0000
+// Image base: 0x00BE0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash02.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash02.il.bsl
index 985bcae6f37..f85561bf210 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash02.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash02
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash02
 {
-  // Offset: 0x00000000 Length: 0x00000220
+  // Offset: 0x00000000 Length: 0x00000228
+}
+.mresource public FSharpSignatureDataB.Hash02
+{
+  // Offset: 0x00000230 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Hash02
 {
-  // Offset: 0x00000228 Length: 0x0000010B
+  // Offset: 0x00000238 Length: 0x0000010B
+}
+.mresource public FSharpOptimizationDataB.Hash02
+{
+  // Offset: 0x00000348 Length: 0x00000006
 }
 .module Hash02.dll
-// MVID: {59B18AEE-9642-796E-A745-0383EE8AB159}
+// MVID: {5C6C9457-11BA-A5AB-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01920000
+// Image base: 0x00570000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash03.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash03.il.bsl
index 94e5977da05..faa4de70d4c 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash03.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash03.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash03
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash03
 {
-  // Offset: 0x00000000 Length: 0x00000220
+  // Offset: 0x00000000 Length: 0x00000228
+}
+.mresource public FSharpSignatureDataB.Hash03
+{
+  // Offset: 0x00000230 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Hash03
 {
-  // Offset: 0x00000228 Length: 0x000000B0
+  // Offset: 0x00000238 Length: 0x000000B0
+}
+.mresource public FSharpOptimizationDataB.Hash03
+{
+  // Offset: 0x000002F0 Length: 0x00000000
 }
 .module Hash03.dll
-// MVID: {59B18AEE-9642-788D-A745-0383EE8AB159}
+// MVID: {5C6C9457-091F-A0D6-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x02DA0000
+// Image base: 0x01270000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash04.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash04.il.bsl
index 79b1e6d5ad9..593cbdd873c 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash04.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash04.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash04
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash04
 {
-  // Offset: 0x00000000 Length: 0x00000220
+  // Offset: 0x00000000 Length: 0x00000228
+}
+.mresource public FSharpSignatureDataB.Hash04
+{
+  // Offset: 0x00000230 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Hash04
 {
-  // Offset: 0x00000228 Length: 0x000000B0
+  // Offset: 0x00000238 Length: 0x000000B0
+}
+.mresource public FSharpOptimizationDataB.Hash04
+{
+  // Offset: 0x000002F0 Length: 0x00000000
 }
 .module Hash04.dll
-// MVID: {59B18AEE-9642-7838-A745-0383EE8AB159}
+// MVID: {5C6C9457-A55C-B13C-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x012B0000
+// Image base: 0x01300000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash05.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash05.il.bsl
index 50ea47e8580..13d254c45c7 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash05.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash05.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash05
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash05
 {
-  // Offset: 0x00000000 Length: 0x000006E0
+  // Offset: 0x00000000 Length: 0x000006D4
+}
+.mresource public FSharpSignatureDataB.Hash05
+{
+  // Offset: 0x000006D8 Length: 0x0000007E
 }
 .mresource public FSharpOptimizationData.Hash05
 {
-  // Offset: 0x000006E8 Length: 0x000003B1
+  // Offset: 0x00000760 Length: 0x000003B1
+}
+.mresource public FSharpOptimizationDataB.Hash05
+{
+  // Offset: 0x00000B18 Length: 0x00000057
 }
 .module Hash05.dll
-// MVID: {59B18AEE-9642-7857-A745-0383EE8AB159}
+// MVID: {5C6C9457-9CC1-AC67-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01AC0000
+// Image base: 0x00AC0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash06.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash06.il.bsl
index df45d5ddbdb..1b3ca194185 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash06.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash06.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash06
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash06
 {
-  // Offset: 0x00000000 Length: 0x000006E1
+  // Offset: 0x00000000 Length: 0x000006D5
+}
+.mresource public FSharpSignatureDataB.Hash06
+{
+  // Offset: 0x000006E0 Length: 0x0000007E
 }
 .mresource public FSharpOptimizationData.Hash06
 {
-  // Offset: 0x000006E8 Length: 0x000003B2
+  // Offset: 0x00000768 Length: 0x000003B2
+}
+.mresource public FSharpOptimizationDataB.Hash06
+{
+  // Offset: 0x00000B20 Length: 0x00000057
 }
 .module Hash06.dll
-// MVID: {59B18AEE-9642-78F2-A745-0383EE8AB159}
+// MVID: {5C6C9457-9426-A792-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01040000
+// Image base: 0x007A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash07.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash07.il.bsl
index b57640a2818..4906fa2c377 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash07.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash07.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash07
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash07
 {
-  // Offset: 0x00000000 Length: 0x0000021A
+  // Offset: 0x00000000 Length: 0x00000222
+}
+.mresource public FSharpSignatureDataB.Hash07
+{
+  // Offset: 0x00000228 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Hash07
 {
-  // Offset: 0x00000220 Length: 0x000000AA
+  // Offset: 0x00000230 Length: 0x000000AA
+}
+.mresource public FSharpOptimizationDataB.Hash07
+{
+  // Offset: 0x000002E0 Length: 0x00000000
 }
 .module Hash07.dll
-// MVID: {59B18AEE-9642-7811-A745-0383EE8AB159}
+// MVID: {5C6C9457-8B8B-A2BD-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x010A0000
+// Image base: 0x011A0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash08.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash08.il.bsl
index a0945b3885d..94595e55f6b 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash08.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash08.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash08
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash08
 {
-  // Offset: 0x00000000 Length: 0x000006D3
+  // Offset: 0x00000000 Length: 0x000006C7
+}
+.mresource public FSharpSignatureDataB.Hash08
+{
+  // Offset: 0x000006D0 Length: 0x0000007D
 }
 .mresource public FSharpOptimizationData.Hash08
 {
-  // Offset: 0x000006D8 Length: 0x000003B3
+  // Offset: 0x00000758 Length: 0x000003B3
+}
+.mresource public FSharpOptimizationDataB.Hash08
+{
+  // Offset: 0x00000B10 Length: 0x00000057
 }
 .module Hash08.dll
-// MVID: {59B18AEE-9642-77BC-A745-0383EE8AB159}
+// MVID: {5C6C9457-1418-D796-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01AA0000
+// Image base: 0x002F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash09.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash09.il.bsl
index df7b115d207..954be19449f 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash09.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash09.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash09
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash09
 {
-  // Offset: 0x00000000 Length: 0x0000088E
+  // Offset: 0x00000000 Length: 0x00000882
+}
+.mresource public FSharpSignatureDataB.Hash09
+{
+  // Offset: 0x00000888 Length: 0x000000A8
 }
 .mresource public FSharpOptimizationData.Hash09
 {
-  // Offset: 0x00000898 Length: 0x00000686
+  // Offset: 0x00000938 Length: 0x00000686
+}
+.mresource public FSharpOptimizationDataB.Hash09
+{
+  // Offset: 0x00000FC8 Length: 0x000000B8
 }
 .module Hash09.dll
-// MVID: {59B18AEE-9642-77DB-A745-0383EE8AB159}
+// MVID: {5C6C9457-0B7D-D2C1-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x00690000
+// Image base: 0x002E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash10.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash10.il.bsl
index 20c3ceeb8f6..fce5a66aa34 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash10.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash10.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash10
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash10
 {
-  // Offset: 0x00000000 Length: 0x00000219
+  // Offset: 0x00000000 Length: 0x00000221
+}
+.mresource public FSharpSignatureDataB.Hash10
+{
+  // Offset: 0x00000228 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Hash10
 {
-  // Offset: 0x00000220 Length: 0x000000A9
+  // Offset: 0x00000230 Length: 0x000000A9
+}
+.mresource public FSharpOptimizationDataB.Hash10
+{
+  // Offset: 0x000002E0 Length: 0x00000000
 }
 .module Hash10.dll
-// MVID: {59B18AEE-9661-78B4-A745-0383EE8AB159}
+// MVID: {5C6C9457-1EF1-AF55-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01080000
+// Image base: 0x011E0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash11.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash11.il.bsl
index f4eb5020175..c7d25bf6c6c 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash11.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash11.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash11
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash11
 {
-  // Offset: 0x00000000 Length: 0x00000219
+  // Offset: 0x00000000 Length: 0x00000221
+}
+.mresource public FSharpSignatureDataB.Hash11
+{
+  // Offset: 0x00000228 Length: 0x00000003
 }
 .mresource public FSharpOptimizationData.Hash11
 {
-  // Offset: 0x00000220 Length: 0x000000A9
+  // Offset: 0x00000230 Length: 0x000000A9
+}
+.mresource public FSharpOptimizationDataB.Hash11
+{
+  // Offset: 0x000002E0 Length: 0x00000000
 }
 .module Hash11.dll
-// MVID: {59B18AEE-9661-78D3-A745-0383EE8AB159}
+// MVID: {5C6C9457-1656-AA80-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x002D0000
+// Image base: 0x00A90000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash12.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash12.il.bsl
index 9c5bfb73cf3..c96839307a9 100644
--- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash12.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Hash12.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Hash12
 {
@@ -29,20 +29,28 @@
 }
 .mresource public FSharpSignatureData.Hash12
 {
-  // Offset: 0x00000000 Length: 0x00000A98
+  // Offset: 0x00000000 Length: 0x00000A8C
+}
+.mresource public FSharpSignatureDataB.Hash12
+{
+  // Offset: 0x00000A90 Length: 0x000000FA
 }
 .mresource public FSharpOptimizationData.Hash12
 {
-  // Offset: 0x00000AA0 Length: 0x00000585
+  // Offset: 0x00000B90 Length: 0x00000585
+}
+.mresource public FSharpOptimizationDataB.Hash12
+{
+  // Offset: 0x00001120 Length: 0x000000AE
 }
 .module Hash12.dll
-// MVID: {59B18AEE-9661-796E-A745-0383EE8AB159}
+// MVID: {5C6C9457-0DBB-A5AB-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01080000
+// Image base: 0x00C80000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/Inlining/Match01.il.bsl b/tests/fsharpqa/Source/Optimizations/Inlining/Match01.il.bsl
index aa979cf89ae..c360fcb7025 100644
--- a/tests/fsharpqa/Source/Optimizations/Inlining/Match01.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/Inlining/Match01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Match01
 {
@@ -25,20 +25,28 @@
 }
 .mresource public FSharpSignatureData.Match01
 {
-  // Offset: 0x00000000 Length: 0x000006F6
+  // Offset: 0x00000000 Length: 0x000006EA
+}
+.mresource public FSharpSignatureDataB.Match01
+{
+  // Offset: 0x000006F0 Length: 0x00000086
 }
 .mresource public FSharpOptimizationData.Match01
 {
-  // Offset: 0x00000700 Length: 0x000003B7
+  // Offset: 0x00000780 Length: 0x000003B7
+}
+.mresource public FSharpOptimizationDataB.Match01
+{
+  // Offset: 0x00000B40 Length: 0x0000005F
 }
 .module Match01.dll
-// MVID: {59B18AF8-FAFE-C8E4-A745-0383F88AB159}
+// MVID: {5C6C9457-6E36-2371-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x01790000
+// Image base: 0x00360000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/Inlining/Match02.il.bsl b/tests/fsharpqa/Source/Optimizations/Inlining/Match02.il.bsl
index a22def741ec..94d5cb1c033 100644
--- a/tests/fsharpqa/Source/Optimizations/Inlining/Match02.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/Inlining/Match02.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:1:0
+  .ver 4:5:0:0
 }
 .assembly Match02
 {
@@ -27,18 +27,26 @@
 {
   // Offset: 0x00000000 Length: 0x00000490
 }
+.mresource public FSharpSignatureDataB.Match02
+{
+  // Offset: 0x00000498 Length: 0x00000035
+}
 .mresource public FSharpOptimizationData.Match02
 {
-  // Offset: 0x00000498 Length: 0x000002EE
+  // Offset: 0x000004D8 Length: 0x000002EE
+}
+.mresource public FSharpOptimizationDataB.Match02
+{
+  // Offset: 0x000007D0 Length: 0x0000004C
 }
 .module Match02.dll
-// MVID: {59B18AF8-6125-4D81-A745-0383F88AB159}
+// MVID: {5C6C9457-8B37-2371-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x015D0000
+// Image base: 0x00C50000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/fsharpqa/Source/Optimizations/Inlining/StructUnion01.il.bsl b/tests/fsharpqa/Source/Optimizations/Inlining/StructUnion01.il.bsl
index 7e07ff48ffd..01c75d6eaa4 100644
--- a/tests/fsharpqa/Source/Optimizations/Inlining/StructUnion01.il.bsl
+++ b/tests/fsharpqa/Source/Optimizations/Inlining/StructUnion01.il.bsl
@@ -13,7 +13,7 @@
 .assembly extern FSharp.Core
 {
   .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
-  .ver 4:4:3:0
+  .ver 4:5:0:0
 }
 .assembly StructUnion01
 {
@@ -27,18 +27,26 @@
 {
   // Offset: 0x00000000 Length: 0x0000087E
 }
+.mresource public FSharpSignatureDataB.StructUnion01
+{
+  // Offset: 0x00000888 Length: 0x000000B0
+}
 .mresource public FSharpOptimizationData.StructUnion01
 {
-  // Offset: 0x00000888 Length: 0x00000421
+  // Offset: 0x00000940 Length: 0x00000421
+}
+.mresource public FSharpOptimizationDataB.StructUnion01
+{
+  // Offset: 0x00000D68 Length: 0x00000067
 }
 .module StructUnion01.dll
-// MVID: {5B1ED843-D3E9-6B24-A745-038343D81E5B}
+// MVID: {5C6C9457-997B-102F-A745-038357946C5C}
 .imagebase 0x00400000
 .file alignment 0x00000200
 .stackreserve 0x00100000
 .subsystem 0x0003       // WINDOWS_CUI
 .corflags 0x00000001    //  ILONLY
-// Image base: 0x017F0000
+// Image base: 0x002F0000
 
 
 // =============== CLASS MEMBERS DECLARATION ===================
diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs
index a92301bcefb..ba0b37af407 100644
--- a/tests/service/ExprTests.fs
+++ b/tests/service/ExprTests.fs
@@ -2655,8 +2655,14 @@ let ``Test Operator Declarations for String`` () =
         "let testStringToUInt32Operator(e1) = LanguagePrimitives.ParseUInt32 (e1) @ (47,47--47,56)";
         "let testStringToInt64Operator(e1) = LanguagePrimitives.ParseInt64 (e1) @ (48,47--48,55)";
         "let testStringToUInt64Operator(e1) = LanguagePrimitives.ParseUInt64 (e1) @ (49,47--49,56)";
+#if USES_FSHARP_CORE_45_PACKAGE
+        // the definition of these operators has changed slightly in latest FSharp.Core
         "let testStringToSingleOperator(e1) = Single.Parse ((if Operators.op_Equality (e1,dflt) then dflt else e1.Replace(\"_\",\"\")),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (52,47--52,57)";
         "let testStringToDoubleOperator(e1) = Double.Parse ((if Operators.op_Equality (e1,dflt) then dflt else e1.Replace(\"_\",\"\")),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (53,47--53,55)";
+#else
+        "let testStringToSingleOperator(e1) = ((if Object.ReferenceEquals (e1 :> Microsoft.FSharp.Core.obj,dflt) then Operators.Raise (new ArgumentNullException(\"s\") :> Microsoft.FSharp.Core.exn) else ()); Single.Parse (e1.Replace(\"_\",\"\"),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider)) @ (52,47--52,57)";
+        "let testStringToDoubleOperator(e1) = ((if Object.ReferenceEquals (e1 :> Microsoft.FSharp.Core.obj,dflt) then Operators.Raise (new ArgumentNullException(\"s\") :> Microsoft.FSharp.Core.exn) else ()); Double.Parse (e1.Replace(\"_\",\"\"),167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider)) @ (53,47--53,55)";
+#endif
         "let testStringToDecimalOperator(e1) = Decimal.Parse (e1,167,CultureInfo.get_InvariantCulture () :> System.IFormatProvider) @ (54,47--54,57)";
         "let testStringToCharOperator(e1) = Char.Parse (e1) @ (55,47--55,54)";
         "let testStringToStringOperator(e1) = let matchValue: Microsoft.FSharp.Core.obj = Operators.Box (e1) in match (if Operators.op_Equality (matchValue,dflt) then $0 else (if matchValue :? System.IFormattable then $1 else $2)) targets ... @ (56,47--56,56)";
diff --git a/tests/service/data/TestTP/ProvidedTypes.fs b/tests/service/data/TestTP/ProvidedTypes.fs
index 51cdb0bddd0..323df18d426 100644
--- a/tests/service/data/TestTP/ProvidedTypes.fs
+++ b/tests/service/data/TestTP/ProvidedTypes.fs
@@ -50,7 +50,7 @@ module internal Misc =
     let isEmpty s = s = ExpectedStackState.Empty
     let isAddress s = s = ExpectedStackState.Address
 
-    let nonNull str x = if x=null then failwith ("Null in " + str) else x
+    let failIfNull str x = if x=null then failwith ("Null in " + str) else x
     
     let notRequired opname item = 
         let msg = sprintf "The operation '%s' on item '%s' should not be called on provided type, member or parameter" opname item
@@ -651,7 +651,7 @@ type ProvidedConstructor(parameters : ProvidedParameter list) =
     override __.GetParameters() = parameters |> List.toArray 
     override __.Attributes = ctorAttributes
     override __.Name = if isStatic() then ".cctor" else ".ctor"
-    override __.DeclaringType = declaringType |> nonNull "ProvidedConstructor.DeclaringType"                                   
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedConstructor.DeclaringType"                                   
     override __.IsDefined(_attributeType, _inherit) = true 
 
     override __.Invoke(_invokeAttr, _binder, _parameters, _culture)      = notRequired "Invoke" (nameText())
@@ -737,7 +737,7 @@ type ProvidedMethod(methodName: string, parameters: ProvidedParameter list, retu
     override __.GetParameters() = argParams |> Array.ofList
     override __.Attributes = methodAttrs
     override __.Name = methodName
-    override __.DeclaringType = declaringType |> nonNull "ProvidedMethod.DeclaringType"                                   
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedMethod.DeclaringType"                                   
     override __.IsDefined(_attributeType, _inherit) : bool = true
     override __.MemberType = MemberTypes.Method
     override __.CallingConvention = 
@@ -820,7 +820,7 @@ type ProvidedProperty(propertyName: string, propertyType: Type, ?parameters: Pro
     override __.CanWrite = hasSetter()
     override __.GetValue(_obj, _invokeAttr, _binder, _index, _culture) : obj = notRequired "GetValue" propertyName
     override __.Name = propertyName
-    override __.DeclaringType = declaringType |> nonNull "ProvidedProperty.DeclaringType"
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedProperty.DeclaringType"
     override __.MemberType : MemberTypes = MemberTypes.Property
 
     override __.ReflectedType                                     = notRequired "ReflectedType" propertyName
@@ -874,7 +874,7 @@ type ProvidedEvent(eventName:string,eventHandlerType:Type) =
     override __.GetRemoveMethod _nonPublic = remover.Force() :> MethodInfo
     override __.Attributes = EventAttributes.None
     override __.Name = eventName
-    override __.DeclaringType = declaringType |> nonNull "ProvidedEvent.DeclaringType"
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedEvent.DeclaringType"
     override __.MemberType : MemberTypes = MemberTypes.Event
 
     override __.GetRaiseMethod _nonPublic                      = notRequired "GetRaiseMethod" eventName
@@ -909,7 +909,7 @@ type ProvidedLiteralField(fieldName:string,fieldType:Type,literalValue:obj) =
     override __.GetRawConstantValue()  = literalValue
     override __.Attributes = FieldAttributes.Static ||| FieldAttributes.Literal ||| FieldAttributes.Public
     override __.Name = fieldName
-    override __.DeclaringType = declaringType |> nonNull "ProvidedLiteralField.DeclaringType"
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedLiteralField.DeclaringType"
     override __.MemberType : MemberTypes = MemberTypes.Field
 
     override __.ReflectedType                                     = notRequired "ReflectedType" fieldName
@@ -948,7 +948,7 @@ type ProvidedField(fieldName:string,fieldType:Type) =
     override __.GetRawConstantValue()  = null
     override __.Attributes = fieldAttrs
     override __.Name = fieldName
-    override __.DeclaringType = declaringType |> nonNull "ProvidedField.DeclaringType"
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedField.DeclaringType"
     override __.MemberType : MemberTypes = MemberTypes.Field
 
     override __.ReflectedType                                     = notRequired "ReflectedType" fieldName
diff --git a/vsintegration/src/FSharp.Editor/AutomaticCompletion/BraceCompletionSessionProvider.fs b/vsintegration/src/FSharp.Editor/AutomaticCompletion/BraceCompletionSessionProvider.fs
index dd3be821094..f4dd4d29dfd 100644
--- a/vsintegration/src/FSharp.Editor/AutomaticCompletion/BraceCompletionSessionProvider.fs
+++ b/vsintegration/src/FSharp.Editor/AutomaticCompletion/BraceCompletionSessionProvider.fs
@@ -42,7 +42,6 @@ module BraceCompletionSessionProviderHelpers =
     [] 
     let BraceCompletion = "Brace_Completion"
 
-[]
 type IEditorBraceCompletionSession =
     inherit ILanguageService
 
@@ -58,7 +57,7 @@ type IEditorBraceCompletionSession =
 type IEditorBraceCompletionSessionFactory =
     inherit ILanguageService
 
-    abstract TryCreateSession : Document * openingPosition: int * openingBrace: char * CancellationToken -> IEditorBraceCompletionSession
+    abstract TryCreateSession : Document * openingPosition: int * openingBrace: char * CancellationToken -> IEditorBraceCompletionSession?
 
 type BraceCompletionSession 
     (
@@ -73,7 +72,7 @@ type BraceCompletionSession
     ) =
 
     let mutable closingPoint = subjectBuffer.CurrentSnapshot.CreateTrackingPoint(openingPoint.Position, PointTrackingMode.Positive)
-    let mutable openingPoint : ITrackingPoint = null
+    let mutable openingPoint : ITrackingPoint? = null
     let editorOperations = editorOperationsFactoryService.GetEditorOperations(textView)
 
     member __.EndSession() =
@@ -193,6 +192,9 @@ type BraceCompletionSession
                         
         member this.PreBackspace handledCommand =
             handledCommand <- false
+            match openingPoint with 
+            | null -> ()
+            | NonNull openingPoint -> 
 
             let caretPos = tryGetCaretPosition this
             let snapshot = subjectBuffer.CurrentSnapshot
@@ -484,20 +486,20 @@ type EditorBraceCompletionSessionFactory() =
                         | _ -> true // anything else is a valid classification type
                     ))                
 
-    member __.CreateEditorSession(_document, _openingPosition, openingBrace, _cancellationToken) =
+    member __.CreateEditorSession(_document, _openingPosition, openingBrace, _cancellationToken) : IEditorBraceCompletionSession? =
         match openingBrace with
-        | Parenthesis.OpenCharacter -> ParenthesisCompletionSession() :> IEditorBraceCompletionSession
-        | CurlyBrackets.OpenCharacter -> ParenthesisCompletionSession() :> IEditorBraceCompletionSession
-        | SquareBrackets.OpenCharacter -> ParenthesisCompletionSession() :> IEditorBraceCompletionSession
-        | VerticalBar.OpenCharacter -> VerticalBarCompletionSession() :> IEditorBraceCompletionSession
-        | AngleBrackets.OpenCharacter -> AngleBracketCompletionSession() :> IEditorBraceCompletionSession
-        | DoubleQuote.OpenCharacter -> DoubleQuoteCompletionSession() :> IEditorBraceCompletionSession
-        | Asterisk.OpenCharacter -> AsteriskCompletionSession() :> IEditorBraceCompletionSession
+        | Parenthesis.OpenCharacter -> ParenthesisCompletionSession() :> _
+        | CurlyBrackets.OpenCharacter -> ParenthesisCompletionSession() :> _
+        | SquareBrackets.OpenCharacter -> ParenthesisCompletionSession() :> _
+        | VerticalBar.OpenCharacter -> VerticalBarCompletionSession() :> _
+        | AngleBrackets.OpenCharacter -> AngleBracketCompletionSession() :> _
+        | DoubleQuote.OpenCharacter -> DoubleQuoteCompletionSession() :> _
+        | Asterisk.OpenCharacter -> AsteriskCompletionSession() :> _
         | _ -> null
 
     interface IEditorBraceCompletionSessionFactory with
 
-        member this.TryCreateSession(document, openingPosition, openingBrace, cancellationToken) = 
+        member this.TryCreateSession(document, openingPosition, openingBrace, cancellationToken) : IEditorBraceCompletionSession? = 
             if this.IsSupportedOpeningBrace(openingBrace) && this.CheckCodeContext(document, openingPosition, openingBrace, cancellationToken) then
                 this.CreateEditorSession(document, openingPosition, openingBrace, cancellationToken)
             else
@@ -526,7 +528,9 @@ type BraceCompletionSessionProvider
                 maybe {
                     let! document =       openingPoint.Snapshot.GetOpenDocumentInCurrentContextWithChanges() |> Option.ofObj
                     let! sessionFactory = document.TryGetLanguageService()
-                    let! session =        sessionFactory.TryCreateSession(document, openingPoint.Position, openingBrace, CancellationToken.None) |> Option.ofObj
+                    let! session =
+                        sessionFactory.TryCreateSession(document, openingPoint.Position, openingBrace, CancellationToken.None)
+                        |> Option.ofObj
 
                     let undoHistory = undoManager.GetTextBufferUndoManager(textView.TextBuffer).TextBufferUndoHistory
                     return BraceCompletionSession(
diff --git a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs
index 749c3ceed7a..14d3ffcc040 100644
--- a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs
+++ b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs
@@ -118,19 +118,19 @@ module internal ClassificationDefinitions =
 
 
     []
-    let FSharpFunctionClassificationType : ClassificationTypeDefinition = null
+    let FSharpFunctionClassificationType : ClassificationTypeDefinition? = null
 
     []
-    let FSharpMutableVarClassificationType : ClassificationTypeDefinition = null
+    let FSharpMutableVarClassificationType : ClassificationTypeDefinition? = null
 
     []
-    let FSharpPrintfClassificationType : ClassificationTypeDefinition = null
+    let FSharpPrintfClassificationType : ClassificationTypeDefinition? = null
 
     []
-    let FSharpPropertyClassificationType : ClassificationTypeDefinition = null
+    let FSharpPropertyClassificationType : ClassificationTypeDefinition? = null
 
     []
-    let FSharpDisposableClassificationType : ClassificationTypeDefinition = null
+    let FSharpDisposableClassificationType : ClassificationTypeDefinition? = null
 
     [)>]
     []
diff --git a/vsintegration/src/FSharp.Editor/CodeLens/CodeLensProvider.fs b/vsintegration/src/FSharp.Editor/CodeLens/CodeLensProvider.fs
index 415f9e5fa6d..108fcae2a02 100644
--- a/vsintegration/src/FSharp.Editor/CodeLens/CodeLensProvider.fs
+++ b/vsintegration/src/FSharp.Editor/CodeLens/CodeLensProvider.fs
@@ -85,12 +85,12 @@ type internal CodeLensProvider
     [); Name("CodeLens");
       Order(Before = PredefinedAdornmentLayers.Text);
       TextViewRole(PredefinedTextViewRoles.Document)>]
-    member val CodeLensAdornmentLayerDefinition : AdornmentLayerDefinition = null with get, set
+    member val CodeLensAdornmentLayerDefinition : AdornmentLayerDefinition? = null with get, set
     
     [); Name("LineLens");
       Order(Before = PredefinedAdornmentLayers.Text);
       TextViewRole(PredefinedTextViewRoles.Document)>]
-    member val LineLensAdornmentLayerDefinition : AdornmentLayerDefinition = null with get, set
+    member val LineLensAdornmentLayerDefinition : AdornmentLayerDefinition? = null with get, set
 
     interface IViewTaggerProvider with
         override __.CreateTagger(view, buffer) =
diff --git a/vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs b/vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs
index f7248253fd0..a772a62fa00 100644
--- a/vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs
+++ b/vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs
@@ -35,7 +35,7 @@ type internal CodeLens(taggedText, computed, fullTypeSignature, uiElement) =
     member val TaggedText: Async<(ResizeArray * QuickInfoNavigation) option> = taggedText
     member val Computed: bool = computed with get, set
     member val FullTypeSignature: string = fullTypeSignature 
-    member val UiElement: UIElement = uiElement with get, set
+    member val UiElement: UIElement? = uiElement with get, set
 
 type internal FSharpCodeLensService
     (
@@ -306,7 +306,10 @@ type internal FSharpCodeLensService
                         if res then
                             do! Async.SwitchToContext uiContext
                             logInfof "Adding ui element for %A" (codeLens.TaggedText)
-                            let uiElement = codeLens.UiElement
+                            // TODO NULLNESS - check that doing nothing when codeLens.UiElement is null is ok
+                            match codeLens.UiElement with 
+                            | null -> ()
+                            | NonNull uiElement ->
                             let animation = 
                                 DoubleAnimation(
                                     To = Nullable 0.8,
@@ -331,9 +334,12 @@ type internal FSharpCodeLensService
                 lineLens.RemoveCodeLens trackingSpan |> ignore
                 let Grid = lineLens.AddCodeLens newTrackingSpan
                 // logInfof "Trackingspan %A is being added." trackingSpan 
-                if codeLens.Computed && (isNull codeLens.UiElement |> not) then
-                    let uiElement = codeLens.UiElement
-                    lineLens.AddUiElementToCodeLensOnce (newTrackingSpan, uiElement)
+                if codeLens.Computed then 
+                    // TODO NULLNESS: this slightly changes control flow in the case where codeLens.UIElement is noll
+                    match codeLens.UiElement with 
+                    | null -> ()
+                    | NonNull uiElement ->
+                        lineLens.AddUiElementToCodeLensOnce (newTrackingSpan, uiElement)
                 else
                     Grid.IsVisibleChanged
                     |> Event.filter (fun eventArgs -> eventArgs.NewValue :?> bool)
diff --git a/vsintegration/src/FSharp.Editor/Commands/FsiCommandService.fs b/vsintegration/src/FSharp.Editor/Commands/FsiCommandService.fs
index 389d50b3cba..8bd4779ab2c 100644
--- a/vsintegration/src/FSharp.Editor/Commands/FsiCommandService.fs
+++ b/vsintegration/src/FSharp.Editor/Commands/FsiCommandService.fs
@@ -17,13 +17,12 @@ open Microsoft.VisualStudio.FSharp.Interactive
 
 type internal FsiCommandFilter(serviceProvider: System.IServiceProvider) =
 
-    let loadPackage (guidString: string) =
+    let loadPackage (guidString: string) : Lazy =
       lazy(
         let shell = serviceProvider.GetService(typeof) :?> IVsShell
         let packageToBeLoadedGuid = ref (Guid(guidString))       
         match shell.LoadPackage packageToBeLoadedGuid with
-        | VSConstants.S_OK, pkg ->
-            pkg :?> Package
+        | VSConstants.S_OK, pkg -> unbox pkg 
         | _ -> null)
 
     let fsiPackage = loadPackage FSharpConstants.fsiPackageGuidString
diff --git a/vsintegration/src/FSharp.Editor/Common/Extensions.fs b/vsintegration/src/FSharp.Editor/Common/Extensions.fs
index 694d3a401a8..1a9057fdc68 100644
--- a/vsintegration/src/FSharp.Editor/Common/Extensions.fs
+++ b/vsintegration/src/FSharp.Editor/Common/Extensions.fs
@@ -272,13 +272,13 @@ module Array =
     /// Optimized arrays equality. ~100x faster than `array1 = array2` on strings.
     /// ~2x faster for floats
     /// ~0.8x slower for ints
-    let areEqual (xs: 'T []) (ys: 'T []) =
+    let areEqual (xs: 'T []?) (ys: 'T []?) =
         match xs, ys with
         | null, null -> true
         | [||], [||] -> true
         | null, _ | _, null -> false
-        | _ when xs.Length <> ys.Length -> false
-        | _ ->
+        | NonNull xs, NonNull ys when xs.Length <> ys.Length -> false
+        | NonNull xs, NonNull ys ->
             let mutable stop = false
             let mutable i = 0
             let mutable result = true
@@ -291,9 +291,11 @@ module Array =
     
     /// check if subArray is found in the wholeArray starting 
     /// at the provided index
-    let isSubArray (subArray: 'T []) (wholeArray:'T []) index = 
-        if isNull subArray || isNull wholeArray then false
-        elif subArray.Length = 0 then true
+    let isSubArray (subArray: 'T []?) (wholeArray:'T []?) index = 
+        match subArray, wholeArray with 
+        | null, _ | _, null -> false
+        | NonNull subArray, NonNull wholeArray -> 
+        if subArray.Length = 0 then true
         elif subArray.Length > wholeArray.Length then false
         elif subArray.Length = wholeArray.Length then areEqual subArray wholeArray else
         let rec loop subidx idx =
@@ -318,10 +320,10 @@ module Exception =
     /// messages recursively.
     let flattenMessage (root: System.Exception) =
 
-        let rec flattenInner (exc: System.Exception) =
+        let rec flattenInner (exc: System.Exception?) =
             match exc with
             | null -> []
-            | _ -> [exc.Message] @ (flattenInner exc.InnerException)
+            | NonNull exc -> [exc.Message] @ (flattenInner exc.InnerException)
         
         // If an aggregate exception only has a single inner exception, use that as the root
         match root with
diff --git a/vsintegration/src/FSharp.Editor/Common/Logging.fs b/vsintegration/src/FSharp.Editor/Common/Logging.fs
index cc37f948f42..ef3f72481e0 100644
--- a/vsintegration/src/FSharp.Editor/Common/Logging.fs
+++ b/vsintegration/src/FSharp.Editor/Common/Logging.fs
@@ -29,7 +29,9 @@ open Config
 
 type [] Logger []
     ([)>] serviceProvider: IServiceProvider) =
-    let outputWindow = serviceProvider.GetService() |> Option.ofObj
+    let outputWindow =
+        serviceProvider.GetService()
+        |> Option.ofObj
 
     let createPane () =
         outputWindow |> Option.iter (fun x -> 
diff --git a/vsintegration/src/FSharp.Editor/Common/Vs.fs b/vsintegration/src/FSharp.Editor/Common/Vs.fs
index ee17ab8b381..2d56ef60419 100644
--- a/vsintegration/src/FSharp.Editor/Common/Vs.fs
+++ b/vsintegration/src/FSharp.Editor/Common/Vs.fs
@@ -65,14 +65,14 @@ module internal VsTextLines =
         dataBuffer.CurrentSnapshot.GetText()
 
 module internal VsRunningDocumentTable = 
-    let FindDocumentWithoutLocking(rdt:IVsRunningDocumentTable, url:string) : (IVsHierarchy * IVsTextLines) option =
-        let (hr:int, hier:IVsHierarchy, _itemid:uint32, unkData:IntPtr, _cookie:uint32) = rdt.FindAndLockDocument(uint32 _VSRDTFLAGS.RDT_NoLock, url)
+    let FindDocumentWithoutLocking(rdt:IVsRunningDocumentTable, url:string) : (IVsHierarchy? * IVsTextLines?) option =
+        let (hr:int, hier:IVsHierarchy?, _itemid:uint32, unkData:IntPtr, _cookie:uint32) = rdt.FindAndLockDocument(uint32 _VSRDTFLAGS.RDT_NoLock, url)
         try
             if Com.Succeeded(hr) then 
                 let bufferObject = 
                     if unkData=IntPtr.Zero then null
                     else Marshal.GetObjectForIUnknown(unkData)
-                let buffer = 
+                let buffer : IVsTextLines? = 
                     match bufferObject with 
                     | :? IVsTextLines as tl -> tl
                     | _ -> null
diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs
index 4b80da57009..a0daa928249 100644
--- a/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs
+++ b/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs
@@ -156,7 +156,7 @@ type internal FSharpCompletionProvider
                     | _, idents -> Array.last idents
 
                 let completionItem = 
-                    CommonCompletionItem.Create(name, null, glyph = Nullable glyph, rules = getRules intellisenseOptions.ShowAfterCharIsTyped, filterText = filterText)
+                    CommonCompletionItem.Create(name, displayTextSuffix = null, glyph = Nullable glyph, rules = getRules intellisenseOptions.ShowAfterCharIsTyped, filterText = filterText)
                                         .AddProperty(FullNamePropName, declarationItem.FullName)
                         
                 let completionItem =
diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj
index 5f78b109805..d82e204e449 100644
--- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj
+++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj
@@ -10,6 +10,7 @@
     true
     $(SystemValueTuplePackageVersion)
     $(OtherFlags) --warnon:1182 --subsystemversion:6.00
+    $(OtherFlags) /checknulls
     false
   
 
diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpEditorFactory.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpEditorFactory.fs
index cadf0d33e06..95364adfe46 100644
--- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpEditorFactory.fs
+++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpEditorFactory.fs
@@ -29,10 +29,8 @@ module Constants =
 []
 type FSharpEditorFactory(parentPackage: ShellPackage) =
 
-    let serviceProvider = 
-        if parentPackage = null then
-            nullArg "parentPackage"
-        parentPackage :> IServiceProvider
+    let parentPackage = nullArgCheck "parentPackage" parentPackage 
+    let serviceProvider = parentPackage :> IServiceProvider
     let componentModel = serviceProvider.GetService(typeof) :?> IComponentModel
     let editorAdaptersFactoryService = componentModel.GetService()
     let contentTypeRegistryService = componentModel.GetService()
diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
index da7ae84baf2..790cd4828c3 100644
--- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
+++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
@@ -51,11 +51,11 @@ type internal FSharpCheckerWorkspaceService =
 type internal RoamingProfileStorageLocation(keyName: string) =
     inherit OptionStorageLocation()
     
-    member __.GetKeyNameForLanguage(languageName: string) =
+    member __.GetKeyNameForLanguage(languageName: string?) =
         let unsubstitutedKeyName = keyName
         match languageName with
         | null -> unsubstitutedKeyName
-        | _ ->
+        | NonNull languageName ->
             let substituteLanguageName = if languageName = FSharpConstants.FSharpLanguageName then "FSharp" else languageName
             unsubstitutedKeyName.Replace("%LANGUAGE%", substituteLanguageName)
  
diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LegacyProjectWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/LegacyProjectWorkspaceMap.fs
index 0bf2e5c8063..cc20b56ba83 100644
--- a/vsintegration/src/FSharp.Editor/LanguageService/LegacyProjectWorkspaceMap.fs
+++ b/vsintegration/src/FSharp.Editor/LanguageService/LegacyProjectWorkspaceMap.fs
@@ -113,7 +113,7 @@ type internal LegacyProjectWorkspaceMap(solution: IVsSolution,
             // Roslyn is expecting site to be an IVsHierarchy.
             // It just so happens that the object that implements IProvideProjectSite is also
             // an IVsHierarchy. This assertion is to ensure that the assumption holds true.
-            Debug.Assert(not (isNull hierarchy), "About to CreateProjectContext with a non-hierarchy site")
+            Debug.Assert(not (isNull (box hierarchy)), "About to CreateProjectContext with a non-hierarchy site")
 
             let projectContext = 
                 projectContextFactory.CreateProjectContext(
diff --git a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs
index 5ba172edc4b..65e8f8d5f3d 100644
--- a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs
+++ b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs
@@ -22,16 +22,16 @@ open FSharp.Compiler.SourceCodeServices
 
 module private Symbol =
     let fullName (root: ISymbol) : string =
-        let rec inner parts (sym: ISymbol) =
+        let rec inner parts (sym: ISymbol?) =
             match sym with
             | null ->
                 parts
             // TODO: do we have any other terminating cases?
-            | sym when sym.Kind = SymbolKind.NetModule || sym.Kind = SymbolKind.Assembly ->
+            | NonNull sym when sym.Kind = SymbolKind.NetModule || sym.Kind = SymbolKind.Assembly ->
                 parts
-            | sym when sym.MetadataName <> "" ->
+            | NonNull sym when sym.MetadataName <> "" ->
                 inner (sym.MetadataName :: parts) sym.ContainingSymbol
-            | sym ->
+            | NonNull sym ->
                 inner parts sym.ContainingSymbol
 
         inner [] root |> String.concat "."
diff --git a/vsintegration/src/FSharp.Editor/Navigation/NavigableSymbolsService.fs b/vsintegration/src/FSharp.Editor/Navigation/NavigableSymbolsService.fs
index e433733f4d0..3b8c31752b1 100644
--- a/vsintegration/src/FSharp.Editor/Navigation/NavigableSymbolsService.fs
+++ b/vsintegration/src/FSharp.Editor/Navigation/NavigableSymbolsService.fs
@@ -17,7 +17,6 @@ open Microsoft.VisualStudio.Shell.Interop
 open Microsoft.VisualStudio.Utilities
 open Microsoft.VisualStudio.Shell
 
-[]
 type internal FSharpNavigableSymbol(item: INavigableItem, span: SnapshotSpan, gtd: GoToDefinition, statusBar: StatusBar) =
     interface INavigableSymbol with
         member __.Navigate(_: INavigableRelationship) =
@@ -34,7 +33,7 @@ type internal FSharpNavigableSymbolSource(checkerProvider: FSharpCheckerProvider
     let statusBar = StatusBar(serviceProvider.GetService())
 
     interface INavigableSymbolSource with
-        member __.GetNavigableSymbolAsync(triggerSpan: SnapshotSpan, cancellationToken: CancellationToken) =
+        member __.GetNavigableSymbolAsync(triggerSpan: SnapshotSpan, cancellationToken: CancellationToken) : Task =
             // Yes, this is a code smell. But this is how the editor API accepts what we would treat as None.
             if disposed then null
             else
@@ -63,7 +62,7 @@ type internal FSharpNavigableSymbolSource(checkerProvider: FSharpCheckerProvider
                             let declarationSpan = Span(declarationTextSpan.Start, declarationTextSpan.Length)
                             let symbolSpan = SnapshotSpan(snapshot, declarationSpan)
 
-                            return FSharpNavigableSymbol(navigableItem, symbolSpan, gtd, statusBar) :> INavigableSymbol
+                            return FSharpNavigableSymbol(navigableItem, symbolSpan, gtd, statusBar) :> INavigableSymbol?
                         else 
                             statusBar.TempMessage(SR.CannotDetermineSymbol())
 
@@ -75,6 +74,8 @@ type internal FSharpNavigableSymbolSource(checkerProvider: FSharpCheckerProvider
                         // The NavigableSymbols API accepts 'null' when there's nothing to navigate to.
                         return null
                 }
+                // Async
+                // --> Async
                 |> Async.map Option.toObj
                 |> RoslynHelpers.StartAsyncAsTask cancellationToken
         
diff --git a/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs b/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs
index f80d10422d3..9df3e2945cc 100644
--- a/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs
+++ b/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs
@@ -15,7 +15,7 @@ open Microsoft.CodeAnalysis.Notification
 
 open FSharp.Compiler.SourceCodeServices
 
-type internal NavigationBarSymbolItem(text, glyph, spans, childItems) =
+type internal NavigationBarSymbolItem(text, glyph, spans, childItems: NavigationBarItem[]?) =
     inherit NavigationBarItem(text, glyph, spans, childItems)
 
 [, FSharpConstants.FSharpLanguageName); Shared>]
diff --git a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs
index 01edaa39eb8..e6c8c2197e0 100644
--- a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs
+++ b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs
@@ -204,10 +204,10 @@ type internal FSharpAsyncQuickInfoSource
 
         // This method can be called from the background thread.
         // Do not call IServiceProvider.GetService here.
-        override __.GetQuickInfoItemAsync(session:IAsyncQuickInfoSession, cancellationToken:CancellationToken) : Task =
+        override __.GetQuickInfoItemAsync(session:IAsyncQuickInfoSession, cancellationToken:CancellationToken) : Task =
             let triggerPoint = session.GetTriggerPoint(textBuffer.CurrentSnapshot)
             match triggerPoint.HasValue with
-            | false -> Task.FromResult(null)
+            | false -> Task.FromResult(null)
             | true ->
                 let triggerPoint = triggerPoint.GetValueOrDefault()
                 let documentationBuilder = XmlDocumentation.CreateDocumentationBuilder(xmlMemberIndexService)
@@ -226,7 +226,7 @@ type internal FSharpAsyncQuickInfoSource
                         let navigation = QuickInfoNavigation(statusBar, checkerProvider.Checker, projectInfoManager, document, symbolUse.RangeAlternate)
                         let content = QuickInfoViewProvider.provideContent(imageId, mainDescription, docs, navigation)
                         let span = getTrackingSpan quickInfo.Span
-                        return QuickInfoItem(span, content)
+                        return (QuickInfoItem(span, content) : QuickInfoItem?)
 
                     | Some sigQuickInfo, Some targetQuickInfo ->
                         let mainDescription, targetDocumentation, sigDocumentation, typeParameterMap, exceptions, usage = ResizeArray(), ResizeArray(), ResizeArray(), ResizeArray(), ResizeArray(), ResizeArray()
diff --git a/vsintegration/src/FSharp.VS.FSI/fsiPackageHooks.fs b/vsintegration/src/FSharp.VS.FSI/fsiPackageHooks.fs
index bbe816faf91..0f0b1dbda15 100644
--- a/vsintegration/src/FSharp.VS.FSI/fsiPackageHooks.fs
+++ b/vsintegration/src/FSharp.VS.FSI/fsiPackageHooks.fs
@@ -66,7 +66,7 @@ module internal Hooks =
     let private withFSIToolWindow (this:Package) f =
         queryFSIToolWindow true this f ()
 
-    let OnMLSend (this:Package) (action : FsiEditorSendAction) (sender:obj) (e:EventArgs) =
+    let OnMLSend (this:Package) (action : FsiEditorSendAction) (sender:obj) (e:EventArgs?) =
         withFSIToolWindow this (fun window ->
             match action with
             | ExecuteSelection -> window.MLSendSelection(sender, e)
diff --git a/vsintegration/src/FSharp.VS.FSI/sessions.fs b/vsintegration/src/FSharp.VS.FSI/sessions.fs
index 5e07e4672ea..39174d5ac5b 100644
--- a/vsintegration/src/FSharp.VS.FSI/sessions.fs
+++ b/vsintegration/src/FSharp.VS.FSI/sessions.fs
@@ -247,8 +247,6 @@ let fsiStartInfo channelName =
     procInfo
 
 
-let nonNull = function null -> false | (s:string) -> true
-
 /// Represents an active F# Interactive process to which Visual Studio is connected via stdin/stdout/stderr and a remoting channel
 type FsiSession() = 
     let randomSalt = System.Random()
@@ -328,9 +326,9 @@ type FsiSession() =
 
     member x.SendInput (str: string) = inputQueue.Post(str)
 
-    member x.Output      = Observable.filter nonNull fsiOutput.Publish
+    member x.Output      = Observable.filter (isNull >> not) fsiOutput.Publish
 
-    member x.Error       = Observable.filter nonNull fsiError.Publish
+    member x.Error       = Observable.filter (isNull >> not) fsiError.Publish
 
     member x.Exited      = (cmdProcess.Exited |> Observable.map id)
 
diff --git a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs
index f01c8bdac18..bf318be647d 100644
--- a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs
+++ b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs
@@ -596,7 +596,7 @@ module internal Misc =
     let isEmpty s = s = ExpectedStackState.Empty
     let isAddress s = s = ExpectedStackState.Address
 
-    let nonNull str x = if x=null then failwith ("Null in " + str) else x
+    let failIfNull str x = if x=null then failwith ("Null in " + str) else x
     
     let notRequired opname item = 
         let msg = sprintf "The operation '%s' on item '%s' should not be called on provided type, member or parameter" opname item
@@ -844,7 +844,7 @@ type ProvidedConstructor(parameters : ProvidedParameter list) =
     override __.GetParameters() = parameters |> List.toArray 
     override __.Attributes = ctorAttributes
     override __.Name = if isStatic() then ".cctor" else ".ctor"
-    override __.DeclaringType = declaringType |> nonNull "ProvidedConstructor.DeclaringType"                                   
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedConstructor.DeclaringType"                                   
     override __.IsDefined(_attributeType, _inherit) = true 
 
     override __.Invoke(_invokeAttr, _binder, _parameters, _culture)      = notRequired "Invoke" (nameText())
@@ -930,7 +930,7 @@ type ProvidedMethod(methodName: string, parameters: ProvidedParameter list, retu
     override __.GetParameters() = argParams |> Array.ofList
     override __.Attributes = methodAttrs
     override __.Name = methodName
-    override __.DeclaringType = declaringType |> nonNull "ProvidedMethod.DeclaringType"                                   
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedMethod.DeclaringType"                                   
     override __.IsDefined(_attributeType, _inherit) : bool = true
     override __.MemberType = MemberTypes.Method
     override __.CallingConvention = 
@@ -1013,7 +1013,7 @@ type ProvidedProperty(propertyName: string, propertyType: Type, ?parameters: Pro
     override __.CanWrite = hasSetter()
     override __.GetValue(_obj, _invokeAttr, _binder, _index, _culture) : obj = notRequired "GetValue" propertyName
     override __.Name = propertyName
-    override __.DeclaringType = declaringType |> nonNull "ProvidedProperty.DeclaringType"
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedProperty.DeclaringType"
     override __.MemberType : MemberTypes = MemberTypes.Property
 
     override __.ReflectedType                                     = notRequired "ReflectedType" propertyName
@@ -1067,7 +1067,7 @@ type ProvidedEvent(eventName:string,eventHandlerType:Type) =
     override __.GetRemoveMethod _nonPublic = remover.Force() :> MethodInfo
     override __.Attributes = EventAttributes.None
     override __.Name = eventName
-    override __.DeclaringType = declaringType |> nonNull "ProvidedEvent.DeclaringType"
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedEvent.DeclaringType"
     override __.MemberType : MemberTypes = MemberTypes.Event
 
     override __.GetRaiseMethod _nonPublic                      = notRequired "GetRaiseMethod" eventName
@@ -1102,7 +1102,7 @@ type ProvidedLiteralField(fieldName:string,fieldType:Type,literalValue:obj) =
     override __.GetRawConstantValue()  = literalValue
     override __.Attributes = FieldAttributes.Static ||| FieldAttributes.Literal ||| FieldAttributes.Public
     override __.Name = fieldName
-    override __.DeclaringType = declaringType |> nonNull "ProvidedLiteralField.DeclaringType"
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedLiteralField.DeclaringType"
     override __.MemberType : MemberTypes = MemberTypes.Field
 
     override __.ReflectedType                                     = notRequired "ReflectedType" fieldName
@@ -1141,7 +1141,7 @@ type ProvidedField(fieldName:string,fieldType:Type) =
     override __.GetRawConstantValue()  = null
     override __.Attributes = fieldAttrs
     override __.Name = fieldName
-    override __.DeclaringType = declaringType |> nonNull "ProvidedField.DeclaringType"
+    override __.DeclaringType = declaringType |> failIfNull "ProvidedField.DeclaringType"
     override __.MemberType : MemberTypes = MemberTypes.Field
 
     override __.ReflectedType                                     = notRequired "ReflectedType" fieldName
diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs
index 8c22810bb06..00ed720db1d 100644
--- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs
+++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs
@@ -57,6 +57,10 @@ type UsingMSBuild() as this =
         let ok = errors |> List.exists (fun err -> err.Message = text)
         Assert.IsTrue(ok, sprintf "Error list should contain '%s' message" text)
 
+    let assertContainsContains (errors : list) text = 
+        let ok = errors |> List.exists (fun err -> err.Message.Contains(text))
+        Assert.IsTrue(ok, sprintf "Error list should contain '%s' message" text)
+
 
     //verify the error list Count
     member private this.VerifyErrorListCountAtOpenProject(fileContents : string, num : int) =
@@ -274,7 +278,7 @@ let x =
         CheckErrorList content <|
             fun errors ->
                 Assert.AreEqual(1, List.length errors)
-                assertContains errors "A unique overload for method 'WriteLine' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: System.Console.WriteLine(buffer: char []) : unit, System.Console.WriteLine(format: string, [] arg: obj []) : unit, System.Console.WriteLine(value: obj) : unit, System.Console.WriteLine(value: string) : unit"
+                assertContainsContains errors "A unique overload for method 'WriteLine' could not be determined based on type information prior to this program point."
 
     []
     member public this.``InvalidMethodOverload2``() =