diff --git a/Directory.Build.props b/Directory.Build.props
index 3dd057f702b..e8e24051b1d 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -6,6 +6,7 @@
true
net8.0
+
+ $(OtherFlags) --realsig-
+ $(OtherFlags) --realsig+
+
+
diff --git a/FSharp.Compiler.Service.sln.DotSettings b/FSharp.Compiler.Service.sln.DotSettings
index 59e0b85499d..9dc83c0360c 100644
--- a/FSharp.Compiler.Service.sln.DotSettings
+++ b/FSharp.Compiler.Service.sln.DotSettings
@@ -426,7 +426,7 @@
True
True
True
- True
+ True
True
True
True
diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props
index d0b155bb410..f991ba6b072 100644
--- a/FSharpBuild.Directory.Build.props
+++ b/FSharpBuild.Directory.Build.props
@@ -114,7 +114,7 @@
"typed input"
/// isIncrementalFragment = false --> "#load"
-let AddIncrementalLocalAssemblyFragmentToIlxGenEnv
- (
- cenv: cenv,
- isIncrementalFragment,
- g,
- ccu,
- fragName,
- intraAssemblyInfo,
- eenv,
- implFiles
- ) =
+let AddIncrementalLocalAssemblyFragmentToIlxGenEnv (cenv: cenv, isIncrementalFragment, ccu, fragName, eenv, implFiles) =
let cloc = CompLocForFragment fragName ccu
let allocVal =
- ComputeAndAddStorageForLocalValWithValReprInfo(cenv, g, intraAssemblyInfo, true, NoShadowLocal)
+ ComputeAndAddStorageForLocalValWithValReprInfo(cenv, eenv.intraAssemblyInfo, true, NoShadowLocal)
(eenv, implFiles)
||> List.fold (fun eenv implFile ->
@@ -1928,6 +1961,8 @@ type TypeDefBuilder(tdef: ILTypeDef, tdefDiscards) =
this
+ member _.ILTypeDef = tdef
+
and TypeDefsBuilder() =
let tdefs =
@@ -2093,7 +2128,7 @@ type AnonTypeGenerationTable() =
let tycon =
let lmtyp = MaybeLazy.Strict(Construct.NewEmptyModuleOrNamespaceType ModuleOrType)
- let cpath = CompPath(ilTypeRef.Scope, [])
+ let cpath = CompPath(ilTypeRef.Scope, SyntaxAccess.Unknown, [])
Construct.NewTycon(
Some cpath,
@@ -2264,7 +2299,10 @@ and AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbuf
let vtdef = mkRawDataValueTypeDef g.iltyp_ValueType (name, size, 0us)
let vtref = NestedTypeRefForCompLoc cloc vtdef.Name
let vtspec = mkILTySpec (vtref, [])
- let vtdef = vtdef.WithAccess(ComputeTypeAccess vtref true)
+
+ let vtdef =
+ vtdef.WithAccess(ComputeTypeAccess vtref true taccessInternal cenv.g.realsig)
+
mgbuf.AddTypeDef(vtref, vtdef, false, true, None)
vtspec),
keyComparer = HashIdentity.Structural
@@ -2329,6 +2367,8 @@ and AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbuf
.FindNestedTypeDefsBuilder(tref.Enclosing)
.AddTypeDef(tdef, eliminateIfEmpty, addAtEnd, tdefDiscards)
+ member _.FindNestedTypeDefBuilder(tref: ILTypeRef) = gtdefs.FindNestedTypeDefBuilder(tref)
+
member _.GetCurrentFields(tref: ILTypeRef) =
gtdefs.FindNestedTypeDefBuilder(tref).GetCurrentFields()
@@ -6115,7 +6155,7 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel
) do
// Suppress the "ResumptionDynamicInfo" from generated state machines
if templateFld.LogicalName <> "ResumptionDynamicInfo" then
- let access = ComputeMemberAccess false
+ let access = ComputeMemberAccess false taccessPublic cenv.g.realsig
let fty = GenType cenv m eenvinner.tyenv templateFld.FieldType
let fdef =
@@ -6136,7 +6176,7 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel
// Fields for captured variables
for ilCloFreeVar in ilCloFreeVars do
- let access = ComputeMemberAccess false
+ let access = ComputeMemberAccess false taccessPublic cenv.g.realsig
let fdef =
ILFieldDef(
@@ -6181,7 +6221,7 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel
)
.WithSealed(true)
.WithSpecialName(true)
- .WithAccess(ComputeTypeAccess ilCloTypeRef true)
+ .WithAccess(ComputeTypeAccess ilCloTypeRef true taccessInternal cenv.g.realsig)
.WithLayout(ILTypeDefLayout.Auto)
.WithEncoding(ILDefaultPInvokeEncoding.Auto)
.WithInitSemantics(ILTypeInit.BeforeField)
@@ -6610,7 +6650,7 @@ and GenClosureTypeDefs
.WithSealed(true)
.WithSerializable(true)
.WithSpecialName(true)
- .WithAccess(ComputeTypeAccess tref true)
+ .WithAccess(ComputeTypeAccess tref true taccessInternal cenv.g.realsig)
.WithLayout(ILTypeDefLayout.Auto)
.WithEncoding(ILDefaultPInvokeEncoding.Auto)
.WithInitSemantics(ILTypeInit.BeforeField)
@@ -6797,13 +6837,12 @@ and GenFreevar cenv m eenvouter tyenvinner (fv: Val) =
#endif
| _ -> GenType cenv m tyenvinner fv.Type
-and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenvouter takenNames expr =
+and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenv takenNames expr =
let g = cenv.g
// Choose a base name for the closure
let basename =
- let boundv =
- eenvouter.letBoundVars |> List.tryFind (fun v -> not v.IsCompilerGenerated)
+ let boundv = eenv.letBoundVars |> List.tryFind (fun v -> not v.IsCompilerGenerated)
match boundv with
| Some v -> v.CompiledName cenv.g.CompilerGlobalState
@@ -6821,6 +6860,7 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenvouter takenN
let ilCloTypeRef =
// FSharp 1.0 bug 3404: System.Reflection doesn't like '.' and '`' in type names
let basenameSafeForUseAsTypename = CleanUpGeneratedTypeName basename
+
let suffixmark = expr.Range
let cloName =
@@ -6828,14 +6868,14 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenvouter takenN
assert (g.CompilerGlobalState |> Option.isSome)
g.CompilerGlobalState.Value.StableNameGenerator.GetUniqueCompilerGeneratedName(basenameSafeForUseAsTypename, suffixmark, uniq)
- NestedTypeRefForCompLoc eenvouter.cloc cloName
+ NestedTypeRefForCompLoc eenv.cloc cloName
// Collect the free variables of the closure
let cloFreeVarResults =
let opts = CollectTyparsAndLocalsWithStackGuard()
let opts =
- match eenvouter.tyenv.TemplateReplacement with
+ match eenv.tyenv.TemplateReplacement with
| None -> opts
| Some(tcref, _, typars, _) -> opts.WithTemplateReplacement(tyconRefEq g tcref, typars)
@@ -6850,7 +6890,7 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenvouter takenN
freeLocals
|> List.filter (fun fv ->
(thisVars |> List.forall (fun v -> not (valRefEq g (mkLocalValRef fv) v)))
- && (match StorageForVal m fv eenvouter with
+ && (match StorageForVal m fv eenv with
| StaticPropertyWithField _
| StaticProperty _
| Method _
@@ -6862,14 +6902,14 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenvouter takenN
let cloFreeTyvars =
(cloFreeVarResults.FreeTyvars, freeLocals)
||> List.fold (fun ftyvs fv ->
- match StorageForVal m fv eenvouter with
+ match StorageForVal m fv eenv with
| Env(_, _, Some(moreFtyvs, _))
| Local(_, _, Some(moreFtyvs, _)) -> unionFreeTyvars ftyvs moreFtyvs
| _ -> ftyvs)
let cloFreeTyvars = cloFreeTyvars.FreeTypars |> Zset.elements
- let eenvinner = eenvouter |> EnvForTypars cloFreeTyvars
+ let eenvinner = eenv |> EnvForTypars cloFreeTyvars
let ilCloTyInner =
let ilCloGenericParams = GenGenericParams cenv eenvinner cloFreeTyvars
@@ -6905,13 +6945,13 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenvouter takenN
(cloFreeVars, names)
||> List.map2 (fun fv nm ->
let localCloInfo =
- match StorageForVal m fv eenvouter with
+ match StorageForVal m fv eenv with
| Local(_, _, localCloInfo)
| Env(_, _, localCloInfo) -> localCloInfo
| _ -> None
let ilFv =
- mkILFreeVar (nm, fv.IsCompilerGenerated, GenFreevar cenv m eenvouter eenvinner.tyenv fv)
+ mkILFreeVar (nm, fv.IsCompilerGenerated, GenFreevar cenv m eenv eenvinner.tyenv fv)
let storage =
let ilField = mkILFieldSpecInTy (ilCloTyInner, ilFv.fvName, ilFv.fvType)
@@ -8074,7 +8114,7 @@ and GenLetRecFixup cenv cgbuf eenv (ilxCloSpec: IlxClosureSpec, e, ilField: ILFi
CG.EmitInstr cgbuf (pop 2) Push0 (mkNormalStfld (mkILFieldSpec (ilField.FieldRef, ilxCloSpec.ILType)))
/// Generate letrec bindings
-and GenLetRecBindings cenv (cgbuf: CodeGenBuffer) eenv (allBinds: Bindings, m) =
+and GenLetRecBindings cenv (cgbuf: CodeGenBuffer) eenv (allBinds: Bindings, m) (dict: Dictionary option) =
// 'let rec' bindings are always considered to be in loops, that is each may have backward branches for the
// tailcalls back to the entry point. This means we don't rely on zero-init of mutable locals
@@ -8146,6 +8186,23 @@ and GenLetRecBindings cenv (cgbuf: CodeGenBuffer) eenv (allBinds: Bindings, m) =
let fixups = ref []
+ let updateForwardReferenceSet (bind: Binding) (forwardReferenceSet: Zset) =
+ // Record the variable as defined
+ let forwardReferenceSet = Zset.remove bind.Var forwardReferenceSet
+
+ // Execute and discard any fixups that can now be committed
+ let newFixups =
+ fixups.Value
+ |> List.filter (fun (boundv, fv, action) ->
+ if (Zset.contains boundv forwardReferenceSet || Zset.contains fv forwardReferenceSet) then
+ true
+ else
+ action ()
+ false)
+
+ fixups.Value <- newFixups
+ forwardReferenceSet
+
let recursiveVars =
Zset.addList (bindsPossiblyRequiringFixup |> List.map (fun v -> v.Var)) (Zset.empty valOrder)
@@ -8164,39 +8221,74 @@ and GenLetRecBindings cenv (cgbuf: CodeGenBuffer) eenv (allBinds: Bindings, m) =
"internal error: should never need to set non-delayed recursive val: "
+ bind.Var.LogicalName
)))
+
// Record the variable as defined
let forwardReferenceSet = Zset.remove bind.Var forwardReferenceSet
forwardReferenceSet)
- // Generate the actual bindings
- let _ =
- (recursiveVars, allBinds)
- ||> List.fold (fun forwardReferenceSet (bind: Binding) ->
- GenBinding cenv cgbuf eenv bind false
+ let getStampForVal (v: Val) =
+ match v.HasDeclaringEntity with
+ | false -> 0L
+ | true -> v.DeclaringEntity.Deref.Stamp
- // Record the variable as defined
- let forwardReferenceSet = Zset.remove bind.Var forwardReferenceSet
+ let groupBinds =
+ let rec loopAllBinds bindings remainder =
+ match remainder with
+ | [] -> bindings |> List.rev
+ | _ ->
+ let stamp = remainder |> List.head |> (fun (TBind(v, _, _)) -> getStampForVal v)
- // Execute and discard any fixups that can now be committed
- let newFixups =
- fixups.Value
- |> List.filter (fun (boundv, fv, action) ->
- if (Zset.contains boundv forwardReferenceSet || Zset.contains fv forwardReferenceSet) then
- true
- else
- action ()
- false)
+ let taken =
+ remainder |> List.takeWhile (fun (TBind(v, _, _)) -> stamp = getStampForVal v)
- fixups.Value <- newFixups
+ let remainder =
+ remainder |> List.skipWhile (fun (TBind(v, _, _)) -> stamp = getStampForVal v)
- forwardReferenceSet)
+ loopAllBinds (taken :: bindings) remainder
+
+ loopAllBinds [ [] ] allBinds
+
+ let _ =
+ (recursiveVars, groupBinds)
+ ||> List.fold (fun forwardReferenceSet (binds: Binding list) ->
+ match dict, cenv.g.realsig, binds with
+ | _, false, _
+ | None, _, _
+ | _, _, [] ->
+ (forwardReferenceSet, binds)
+ ||> List.fold (fun forwardReferenceSet (bind: Binding) ->
+ GenBinding cenv cgbuf eenv bind false
+ updateForwardReferenceSet bind forwardReferenceSet)
+ | Some dict, true, _ ->
+ let (TBind(v, _, _)) = binds |> List.head
+
+ match dict.TryGetValue(getStampForVal v) with
+ | false, _ ->
+ (forwardReferenceSet, binds)
+ ||> List.fold (fun forwardReferenceSet (bind: Binding) ->
+ GenBinding cenv cgbuf eenv bind false
+ updateForwardReferenceSet bind forwardReferenceSet)
+ | true, tref ->
+ CodeGenInitMethod
+ cenv
+ cgbuf
+ (AddEnclosingToEnv eenv tref.Enclosing tref.Name None)
+ tref
+ (fun cgbuf eenv ->
+ // Generate chunks of non-nested bindings together to allow recursive fixups.
+ GenLetRecBindings cenv cgbuf eenv (binds, m) None
+ CG.EmitInstr cgbuf (pop 0) Push0 I_ret)
+ m
+
+ (forwardReferenceSet, binds)
+ ||> List.fold (fun forwardReferenceSet (bind: Binding) -> updateForwardReferenceSet bind forwardReferenceSet))
()
and GenLetRec cenv cgbuf eenv (binds, body, m) sequel =
let _, endMark as scopeMarks = StartLocalScope "letrec" cgbuf
let eenv = AllocStorageForBinds cenv cgbuf scopeMarks eenv binds
- GenLetRecBindings cenv cgbuf eenv (binds, m)
+ GenLetRecBindings cenv cgbuf eenv (binds, m) None
GenExpr cenv cgbuf eenv body (EndLocalScope(sequel, endMark))
//-------------------------------------------------------------------------
@@ -8212,17 +8304,22 @@ and GenBinding cenv cgbuf eenv (bind: Binding) (isStateVar: bool) =
GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar None
and ComputeMethodAccessRestrictedBySig eenv vspec =
+ let vspec =
+ if eenv.realsig then
+ DoRemapVal eenv.sigToImplRemapInfo vspec
+ else
+ vspec
+
+ let isHiddenBySignatureVal = IsHiddenVal eenv.sigToImplRemapInfo vspec
+
let isHidden =
- // Anything hidden by a signature gets assembly visibility
- IsHiddenVal eenv.sigToImplRemapInfo vspec
- ||
+ isHiddenBySignatureVal
// Anything that's not a module or member binding gets assembly visibility
- not vspec.IsMemberOrModuleBinding
- ||
+ || not vspec.IsMemberOrModuleBinding
// Compiler generated members for class function 'let' bindings get assembly visibility
- vspec.IsIncrClassGeneratedMember
+ || vspec.IsIncrClassGeneratedMember
- ComputeMemberAccess isHidden
+ ComputeMemberAccess isHidden vspec.Accessibility eenv.realsig
and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt =
let g = cenv.g
@@ -8249,12 +8346,13 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt =
let access = ComputeMethodAccessRestrictedBySig eenv vspec
+ // because of reflection back-compatability private constructors are treated the same as internal constructors
// Workaround for .NET and Visual Studio restriction w.r.t debugger type proxys
- // Mark internal constructors in internal classes as public.
+ // Mark internal and private constructors in internal classes as public.
let access =
+ // private and internal constructors from source are treated the same
if
- access = ILMemberAccess.Assembly
- && vspec.IsConstructor
+ vspec.IsConstructor
&& IsHiddenTycon eenv.sigToImplRemapInfo vspec.MemberApparentEntity.Deref
then
ILMemberAccess.Public
@@ -8407,8 +8505,9 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt =
/// Generate a static field definition...
let ilFieldDefs =
- let access =
- ComputeMemberAccess(not hasLiteralAttr || IsHiddenVal eenv.sigToImplRemapInfo vspec)
+ let hidden = not hasLiteralAttr || IsHiddenVal eenv.sigToImplRemapInfo vspec
+
+ let access = ComputeMemberAccess hidden vspec.Accessibility cenv.g.realsig
let ilFieldDef = mkILStaticField (fspec.Name, fty, None, None, access)
@@ -9718,17 +9817,15 @@ and AllocValForBind cenv cgbuf (scopeMarks: Mark * Mark) eenv (TBind(v, repr, _)
| Some _ -> None, AllocValReprWithinExpr cenv cgbuf (snd scopeMarks) eenv.cloc v eenv
and AllocValReprWithinExpr cenv cgbuf endMark cloc v eenv =
- let g = cenv.g
-
// decide whether to use a shadow local or not
let useShadowLocal =
cenv.options.generateDebugSymbols
&& not cenv.options.localOptimizationsEnabled
&& not v.IsCompilerGenerated
&& not v.IsMutable
- &&
// Don't use shadow locals for things like functions which are not compiled as static values/properties
- IsCompiledAsStaticProperty g v
+ && (not eenv.realsig)
+ && IsCompiledAsStaticProperty cenv.g v
let optShadowLocal, eenv =
if useShadowLocal then
@@ -9738,7 +9835,7 @@ and AllocValReprWithinExpr cenv cgbuf endMark cloc v eenv =
else
NoShadowLocal, eenv
- ComputeAndAddStorageForLocalValWithValReprInfo (cenv, g, cenv.intraAssemblyInfo, cenv.options.isInteractive, optShadowLocal) cloc v eenv
+ ComputeAndAddStorageForLocalValWithValReprInfo (cenv, eenv.intraAssemblyInfo, cenv.options.isInteractive, optShadowLocal) cloc v eenv
//--------------------------------------------------------------------------
// Generate stack save/restore and assertions - pulled into letrec by alloc*
@@ -9928,7 +10025,19 @@ and CreatePermissionSets cenv eenv (securityAttributes: Attrib list) =
//--------------------------------------------------------------------------
/// Generate a static class at the given cloc
-and GenTypeDefForCompLoc (cenv, eenv, mgbuf: AssemblyBuilder, cloc, hidden, attribs, initTrigger, eliminateIfEmpty, addAtEnd) =
+and GenTypeDefForCompLoc
+ (
+ cenv,
+ eenv,
+ mgbuf: AssemblyBuilder,
+ cloc,
+ hidden,
+ accessibility: Accessibility,
+ attribs,
+ initTrigger,
+ eliminateIfEmpty,
+ addAtEnd
+ ) =
let g = cenv.g
let tref = TypeRefForCompLoc cloc
@@ -9936,7 +10045,7 @@ and GenTypeDefForCompLoc (cenv, eenv, mgbuf: AssemblyBuilder, cloc, hidden, attr
mkILSimpleClass
g.ilg
(tref.Name,
- ComputeTypeAccess tref hidden,
+ ComputeTypeAccess tref hidden accessibility cenv.g.realsig,
emptyILMethods,
emptyILFields,
emptyILTypeDefs,
@@ -9980,16 +10089,69 @@ and GenImplFileContents cenv cgbuf qname lazyInitInfo eenv mty def =
let _eenvEnd = GenModuleOrNamespaceContents cenv cgbuf qname lazyInitInfo eenv def
())
+and CodeGenInitMethod cenv (cgbuf: CodeGenBuffer) eenv tref (codeGenInitFunc: CodeGenBuffer -> IlxGenEnv -> unit) m =
+
+ // Generate the declarations in the module and its initialization code
+ let _, body =
+ CodeGenMethod cenv cgbuf.mgbuf ([], eenv.staticInitializationName, eenv, 0, None, codeGenInitFunc, m)
+
+ if CheckCodeDoesSomething body.Code then
+ // We are here because the module we just grabbed has an interesting static initializer
+ let feefee, seqpt =
+ if body.Code.Instrs.Length > 0 then
+ match body.Code.Instrs[0] with
+ | I_seqpoint sp as i -> [ FeeFeeInstr cenv sp.Document ], [ i ]
+ | _ -> [], []
+ else
+ [], []
+
+ let ilDebugRange = GenPossibleILDebugRange cenv m
+
+ // Call global file initializer
+ match eenv.initClassFieldSpec with
+ | Some fs -> cgbuf.mgbuf.AddExplicitInitToCctor(tref, fs.Force(), ilDebugRange, eenv.imports, feefee, seqpt)
+ | None -> ()
+
+ // Add code to invoke envinner's class static initializer
+ let access = ComputeMemberAccess true taccessInternal eenv.realsig
+
+ let ilBody = MethodBody.IL(InterruptibleLazy.FromValue body)
+ let ilReturn = mkILReturn ILType.Void
+
+ let method =
+ (mkILNonGenericStaticMethod (eenv.staticInitializationName, access, [], ilReturn, ilBody))
+ .WithSpecialName
+
+ cgbuf.mgbuf.AddMethodDef(tref, method)
+ CountMethodDef()
+
+ let ty =
+ let td = cgbuf.mgbuf.FindNestedTypeDefBuilder(tref).ILTypeDef
+ let boxity = if td.IsStruct then ILBoxity.AsValue else ILBoxity.AsObject
+ mkILFormalNamedTy boxity tref td.GenericParams
+
+ let methodSpec =
+ mkILNonGenericStaticMethSpecInTy (ty, eenv.staticInitializationName, [], ILType.Void)
+
+ cgbuf.EmitInstr((pop 0), Push0, mkNormalCall (methodSpec))
+
and GenModuleOrNamespaceContents cenv (cgbuf: CodeGenBuffer) qname lazyInitInfo eenv x =
match x with
| TMDefRec(_isRec, opens, tycons, mbinds, m) ->
let eenvinner = AddDebugImportsToEnv cenv eenv opens
+ let dict = Some(Dictionary())
+
for tc in tycons do
- if tc.IsFSharpException then
- GenExnDef cenv cgbuf.mgbuf eenvinner m tc
- else
- GenTypeDef cenv cgbuf.mgbuf lazyInitInfo eenvinner m tc
+ let optTref =
+ if tc.IsFSharpException then
+ GenExnDef cenv cgbuf.mgbuf eenv m tc
+ else
+ GenTypeDef cenv cgbuf.mgbuf lazyInitInfo eenv m tc
+
+ match optTref with
+ | Some tref -> dict.Value.Add(tc.Stamp, tref)
+ | None -> ()
// Generate chunks of non-nested bindings together to allow recursive fixups.
let mutable bindsRemaining = mbinds
@@ -9997,6 +10159,7 @@ and GenModuleOrNamespaceContents cenv (cgbuf: CodeGenBuffer) qname lazyInitInfo
while not bindsRemaining.IsEmpty do
match bindsRemaining with
| ModuleOrNamespaceBinding.Binding _ :: _ ->
+
let recBinds =
bindsRemaining
|> List.takeWhile (function
@@ -10012,7 +10175,7 @@ and GenModuleOrNamespaceContents cenv (cgbuf: CodeGenBuffer) qname lazyInitInfo
| ModuleOrNamespaceBinding.Binding _ -> true
| _ -> false)
- GenLetRecBindings cenv cgbuf eenv (recBinds, m)
+ GenLetRecBindings cenv cgbuf eenv (recBinds, m) dict
bindsRemaining <- otherBinds
| (ModuleOrNamespaceBinding.Module _ as mbind) :: rest ->
GenModuleBinding cenv cgbuf qname lazyInitInfo eenvinner m mbind
@@ -10040,21 +10203,24 @@ and GenModuleOrNamespaceContents cenv (cgbuf: CodeGenBuffer) qname lazyInitInfo
// Generate a module binding
and GenModuleBinding cenv (cgbuf: CodeGenBuffer) (qname: QualifiedNameOfFile) lazyInitInfo eenv m x =
match x with
- | ModuleOrNamespaceBinding.Binding bind -> GenLetRecBindings cenv cgbuf eenv ([ bind ], m)
+ | ModuleOrNamespaceBinding.Binding bind -> GenLetRecBindings cenv cgbuf eenv ([ bind ], m) None
+
+ | ModuleOrNamespaceBinding.Module(mspec, mdef) when mspec.IsNamespace ->
+ // Generate the declarations in the namespace and its initialization code
+ GenModuleOrNamespaceContents cenv cgbuf qname lazyInitInfo eenv mdef |> ignore
| ModuleOrNamespaceBinding.Module(mspec, mdef) ->
+
+ // Evaluate bindings for module
let hidden = IsHiddenTycon eenv.sigToImplRemapInfo mspec
let eenvinner =
- if mspec.IsNamespace then
- eenv
- else
- { eenv with
- cloc = CompLocForFixedModule cenv.options.fragName qname.Text mspec
- initLocals =
- eenv.initLocals
- && not (HasFSharpAttribute cenv.g cenv.g.attrib_SkipLocalsInitAttribute mspec.Attribs)
- }
+ { eenv with
+ cloc = CompLocForFixedModule cenv.options.fragName qname.Text mspec
+ initLocals =
+ eenv.initLocals
+ && not (HasFSharpAttribute cenv.g cenv.g.attrib_SkipLocalsInitAttribute mspec.Attribs)
+ }
// Create the class to hold the contents of this module. No class needed if
// we're compiling it as a namespace.
@@ -10063,44 +10229,46 @@ and GenModuleBinding cenv (cgbuf: CodeGenBuffer) (qname: QualifiedNameOfFile) la
// However mutable static fields go into the class for the module itself.
// So this static class ends up with a .cctor if it has mutable fields.
//
- if not mspec.IsNamespace then
- // The use of ILTypeInit.OnAny prevents the execution of the cctor before the
- // "main" method in the case where the "main" method is implicit.
- let staticClassTrigger = (* if eenv.isFinalFile then *)
- ILTypeInit.OnAny (* else ILTypeInit.BeforeField *)
-
- GenTypeDefForCompLoc(
- cenv,
- eenvinner,
- cgbuf.mgbuf,
- eenvinner.cloc,
- hidden,
- mspec.Attribs,
- staticClassTrigger,
- false (* atEnd= *) ,
- true
- )
- // Generate the declarations in the module and its initialization code
- let _envAtEnd =
- GenModuleOrNamespaceContents cenv cgbuf qname lazyInitInfo eenvinner mdef
+ // The use of ILTypeInit.OnAny prevents the execution of the cctor before the
+ // "main" method in the case where the "main" method is implicit.
+ let staticClassTrigger = ILTypeInit.OnAny
+
+ GenTypeDefForCompLoc(
+ cenv,
+ eenvinner,
+ cgbuf.mgbuf,
+ eenvinner.cloc,
+ hidden,
+ mspec.Accessibility,
+ mspec.Attribs,
+ staticClassTrigger,
+ false (* atEnd= *) ,
+ true
+ )
- // If the module has a .cctor for some mutable fields, we need to ensure that when
- // those fields are "touched" the InitClass .cctor is forced. The InitClass .cctor will
- // then fill in the value of the mutable fields.
- if
- not mspec.IsNamespace
- && (cgbuf.mgbuf.GetCurrentFields(TypeRefForCompLoc eenvinner.cloc)
- |> Seq.isEmpty
- |> not)
- then
- GenForceWholeFileInitializationAsPartOfCCtor
+ let tref = TypeRefForCompLoc eenvinner.cloc
+
+ if eenv.realsig then
+ CodeGenInitMethod
cenv
- cgbuf.mgbuf
- lazyInitInfo
- (TypeRefForCompLoc eenvinner.cloc)
- eenv.imports
- mspec.Range
+ cgbuf
+ eenvinner
+ tref
+ (fun cgbuf eenv ->
+ GenModuleOrNamespaceContents cenv cgbuf qname lazyInitInfo eenv mdef |> ignore
+ CG.EmitInstr cgbuf (pop 0) Push0 I_ret //)
+ )
+ m
+ else
+ GenModuleOrNamespaceContents cenv cgbuf qname lazyInitInfo eenvinner mdef
+ |> ignore
+
+ // If the module has a .cctor for some mutable fields, we need to ensure that when
+ // those fields are "touched" the InitClass .cctor is forced. The InitClass .cctor will
+ // then fill in the value of the mutable fields.
+ if not (cgbuf.mgbuf.GetCurrentFields(tref) |> Seq.isEmpty) then
+ GenForceWholeFileInitializationAsPartOfCCtor cenv cgbuf.mgbuf lazyInitInfo tref eenv.imports mspec.Range
/// Generate the namespace fragments in a single file
and GenImplFile cenv (mgbuf: AssemblyBuilder) mainInfoOpt eenv (implFile: CheckedImplFileAfterOptimization) =
@@ -10108,7 +10276,6 @@ and GenImplFile cenv (mgbuf: AssemblyBuilder) mainInfoOpt eenv (implFile: Checke
implFile.ImplFile
let optimizeDuringCodeGen = implFile.OptimizeDuringCodeGen
- let g = cenv.g
let m = qname.Range
// Generate all the anonymous record types mentioned anywhere in this module
@@ -10130,21 +10297,38 @@ and GenImplFile cenv (mgbuf: AssemblyBuilder) mainInfoOpt eenv (implFile: Checke
let initClassCompLoc = CompLocForInitClass eenv.cloc
let initClassTy = mkILTyForCompLoc initClassCompLoc
+ let initClassTrigger = ILTypeInit.OnAny
+
+ let initClassFieldSpec =
+ lazy
+ let ilFieldDef =
+ mkILStaticField (
+ eenv.initFieldName,
+ cenv.g.ilg.typ_Int32,
+ None,
+ None,
+ ComputeMemberAccess true taccessInternal cenv.g.realsig
+ )
+ |> cenv.g.AddFieldNeverAttributes
+ |> cenv.g.AddFieldGeneratedAttributes
- let initClassTrigger = (* if isFinalFile then *)
- ILTypeInit.OnAny (* else ILTypeInit.BeforeField *)
+ CountStaticFieldDef()
+ mgbuf.AddFieldDef(initClassTy.TypeRef, ilFieldDef)
+ mkILFieldSpecInTy (initClassTy, eenv.initFieldName, cenv.g.ilg.typ_Int32)
let eenv =
{ eenv with
cloc = initClassCompLoc
+ initClassCompLoc = Some initClassCompLoc
isFinalFile = isFinalFile
someTypeInThisAssembly = initClassTy
+ initClassFieldSpec = Some initClassFieldSpec
}
// Create the class to hold the initialization code and static fields for this file.
// internal static class $ {}
// Put it at the end since that gives an approximation of dependency order (to aid FSI.EXE's code generator - see FSharp 1.0 5548)
- GenTypeDefForCompLoc(cenv, eenv, mgbuf, initClassCompLoc, useHiddenInitCode, [], initClassTrigger, false, true)
+ GenTypeDefForCompLoc(cenv, eenv, mgbuf, initClassCompLoc, useHiddenInitCode, taccessInternal, [], initClassTrigger, false, true)
// lazyInitInfo is an accumulator of functions which add the forced initialization of the storage module to
// - mutable fields in public modules
@@ -10259,30 +10443,24 @@ and GenImplFile cenv (mgbuf: AssemblyBuilder) mainInfoOpt eenv (implFile: Checke
// Create the field to act as the target for the forced initialization.
// Why do this for the final file?
// There is no need to do this for a final file with an implicit entry point. For an explicit entry point in lazyInitInfo.
- let initFieldName = CompilerGeneratedName "init"
-
- let ilFieldDef =
- mkILStaticField (initFieldName, g.ilg.typ_Int32, None, None, ComputeMemberAccess true)
- |> g.AddFieldNeverAttributes
- |> g.AddFieldGeneratedAttributes
-
- let fspec = mkILFieldSpecInTy (initClassTy, initFieldName, cenv.g.ilg.typ_Int32)
- CountStaticFieldDef()
- mgbuf.AddFieldDef(initClassTy.TypeRef, ilFieldDef)
+ initClassFieldSpec.Force() |> ignore
// Run the imperative (yuck!) actions that force the generation
// of references to the cctor for nested modules etc.
- lazyInitInfo |> Seq.iter (fun f -> f fspec feefee seqpt)
+ match eenv.initClassFieldSpec with
+ | Some fspec ->
+ lazyInitInfo |> Seq.iter (fun f -> f (fspec.Force()) feefee seqpt)
- if isScript && not isFinalFile then
- mgbuf.AddScriptInitFieldSpec(fspec, m)
+ if isScript && not isFinalFile then
+ mgbuf.AddScriptInitFieldSpec(fspec.Force(), m)
+ | None -> ()
// Compute the ilxgenEnv after the generation of the module, i.e. the residue need to generate anything that
// uses the constructs exported from this module.
// We add the module type all over again. Note no shadow locals for static fields needed here since they are only relevant to the main/.cctor
let eenvafter =
let allocVal =
- ComputeAndAddStorageForLocalValWithValReprInfo(cenv, g, cenv.intraAssemblyInfo, cenv.options.isInteractive, NoShadowLocal)
+ ComputeAndAddStorageForLocalValWithValReprInfo(cenv, eenv.intraAssemblyInfo, cenv.options.isInteractive, NoShadowLocal)
AddBindingsForLocalModuleOrNamespaceType allocVal clocCcu eenv signature
@@ -10528,12 +10706,12 @@ and GenPrintingMethod cenv eenv methName ilThisTy m =
| _ -> ()
]
-and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
+and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option =
let g = cenv.g
let tcref = mkLocalTyconRef tycon
if tycon.IsTypeAbbrev then
- ()
+ None
else
match tycon.TypeReprInfo with
#if !NO_TYPEPROVIDERS
@@ -10543,7 +10721,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
| TNoRepr
| TAsmRepr _
| TILObjectRepr _
- | TMeasureableRepr _ -> ()
+ | TMeasureableRepr _ -> None
| TFSharpTyconRepr _ ->
let eenvinner = EnvForTycon tycon eenv
let thisTy = generalizedTyconRef g tcref
@@ -10559,8 +10737,17 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
let ilTypeName = tref.Name
let hidden = IsHiddenTycon eenv.sigToImplRemapInfo tycon
+
let hiddenRepr = hidden || IsHiddenTyconRepr eenv.sigToImplRemapInfo tycon
- let access = ComputeTypeAccess tref hidden
+
+ let tyconAccess =
+ let tycon =
+ if eenv.realsig then
+ DoRemapTycon eenv.sigToImplRemapInfo tycon
+ else
+ tycon
+
+ ComputeTypeAccess tref hidden tycon.Accessibility cenv.g.realsig
// The implicit augmentation doesn't actually create CompareTo(object) or Object.Equals
// So we do it here.
@@ -10662,7 +10849,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
let tyconRepr = tycon.TypeReprInfo
- let reprAccess = ComputeMemberAccess hiddenRepr
+ let reprAccess = ComputeMemberAccess hiddenRepr taccessPublic cenv.g.realsig
// DebugDisplayAttribute gets copied to the subtypes generated as part of DU compilation
let debugDisplayAttrs, normalAttrs =
@@ -10828,7 +11015,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
[ g.CompilerGeneratedAttribute; g.DebuggerBrowsableNeverAttribute ]
| _ -> [] // don't hide fields in classes in debug display
- let access = ComputeMemberAccess isFieldHidden
+ let access = ComputeMemberAccess isFieldHidden taccessPublic cenv.g.realsig
let literalValue = Option.map (GenFieldInit m) fspec.LiteralValue
@@ -10898,7 +11085,9 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
if not useGenuineField then
let ilPropName = fspec.LogicalName
let ilMethName = "get_" + ilPropName
- let access = ComputeMemberAccess isPropHidden
+
+ let access = ComputeMemberAccess isPropHidden taccessPublic cenv.g.realsig
+
let isStruct = isStructTyconRef tcref
let attrs =
@@ -10921,7 +11110,8 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
let ilMethName = "set_" + ilPropName
let ilParams = [ mkILParamNamed ("value", ilPropType) ]
let ilReturn = mkILReturn ILType.Void
- let iLAccess = ComputeMemberAccess isPropHidden
+
+ let iLAccess = ComputeMemberAccess isPropHidden taccessPublic cenv.g.realsig
let ilMethodDef =
if isStatic then
@@ -11128,7 +11318,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
match tycon.TypeReprInfo with
| TILObjectRepr _ ->
- let tdef = tycon.ILTyconRawMetadata.WithAccess access
+ let tdef = tycon.ILTyconRawMetadata.WithAccess tyconAccess
let tdef =
tdef.With(customAttrs = mkILCustomAttrs ilCustomAttrs, genericParams = ilGenParams)
@@ -11170,7 +11360,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
let tdef =
mkILGenericClass (
ilTypeName,
- access,
+ tyconAccess,
ilGenParams,
ilBaseTy,
ilIntfTys,
@@ -11369,7 +11559,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
.WithSerializable(isSerializable)
.WithSealed(true)
.WithEncoding(ILDefaultPInvokeEncoding.Auto)
- .WithAccess(access)
+ .WithAccess(tyconAccess)
// If there are static fields in the union, use the same kind of trigger as
// for class types
.WithInitSemantics(
@@ -11428,26 +11618,39 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
// In this case, the .cctor for this type must force the .cctor of the backing static class for the file.
if
tycon.TyparsNoRange.IsEmpty
+ && not (eenv.realsig)
&& tycon.MembersOfFSharpTyconSorted
|> List.exists (fun vref -> vref.Deref.IsClassConstructor)
then
GenForceWholeFileInitializationAsPartOfCCtor cenv mgbuf lazyInitInfo tref eenv.imports m
+ Some tref
+
/// Generate the type for an F# exception declaration.
-and GenExnDef cenv mgbuf eenv m (exnc: Tycon) =
+and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option =
let g = cenv.g
let exncref = mkLocalEntityRef exnc
match exnc.ExceptionInfo with
| TExnAbbrevRepr _
| TExnAsmRepr _
- | TExnNone -> ()
+ | TExnNone -> None
| TExnFresh _ ->
let ilThisTy = GenExnType cenv m eenv.tyenv exncref
let tref = ilThisTy.TypeRef
let isHidden = IsHiddenTycon eenv.sigToImplRemapInfo exnc
- let access = ComputeTypeAccess tref isHidden
- let reprAccess = ComputeMemberAccess isHidden
+
+ let access =
+ let tycon =
+ if eenv.realsig then
+ DoRemapTycon eenv.sigToImplRemapInfo exnc
+ else
+ exnc
+
+ ComputeTypeAccess tref isHidden tycon.Accessibility cenv.g.realsig
+
+ let reprAccess = ComputeMemberAccess isHidden taccessPublic cenv.g.realsig
+
let fspecs = exnc.TrueInstanceFieldsAsList
let ilMethodDefsForProperties, ilFieldDefs, ilPropertyDefs, fieldNamesAndTypes =
@@ -11579,6 +11782,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) =
let tdef = tdef.WithSerializable(true)
mgbuf.AddTypeDef(tref, tdef, false, false, None)
+ Some tref
let CodegenAssembly cenv eenv mgbuf implFiles =
match List.tryFrontAndBack implFiles with
@@ -11631,11 +11835,12 @@ let CodegenAssembly cenv eenv mgbuf implFiles =
//-------------------------------------------------------------------------
let GetEmptyIlxGenEnv (g: TcGlobals) ccu =
- let thisCompLoc = CompLocForCcu ccu
-
{
tyenv = TypeReprEnv.Empty
- cloc = thisCompLoc
+ cloc = CompLocForCcu ccu
+ initClassCompLoc = None
+ initFieldName = CompilerGeneratedName "init"
+ staticInitializationName = CompilerGeneratedName "staticInitialization"
exitSequel = Return
valsInScope = ValMap<_>.Empty
witnessesInScope = EmptyTraitWitnessInfoHashMap g
@@ -11652,6 +11857,9 @@ let GetEmptyIlxGenEnv (g: TcGlobals) ccu =
imports = None
delayCodeGen = true
delayedFileGenReverse = []
+ intraAssemblyInfo = IlxGenIntraAssemblyInfo.Create()
+ realsig = g.realsig
+ initClassFieldSpec = None
}
type IlxGenResults =
@@ -11722,6 +11930,7 @@ let GenerateCode (cenv, anonTypeTable, eenv, CheckedAssemblyAfterOptimization im
mgbuf,
CompLocForPrivateImplementationDetails eenv.cloc,
useHiddenInitCode,
+ taccessInternal,
[],
ILTypeInit.BeforeField,
true (* atEnd= *) ,
@@ -11879,26 +12088,21 @@ let ClearGeneratedValue (ctxt: ExecutionContext) eenv (v: Val) =
()
/// The published API from the ILX code generator
-type IlxAssemblyGenerator(amap: ImportMap, tcGlobals: TcGlobals, tcVal: ConstraintSolver.TcValF, ccu: CcuThunk) =
+type IlxAssemblyGenerator(amap: ImportMap, g: TcGlobals, tcVal: ConstraintSolver.TcValF, ccu: CcuThunk) =
// The incremental state held by the ILX code generator
- let mutable ilxGenEnv = GetEmptyIlxGenEnv tcGlobals ccu
+ let mutable ilxGenEnv = GetEmptyIlxGenEnv g ccu
let anonTypeTable = AnonTypeGenerationTable()
- let intraAssemblyInfo =
- {
- StaticFieldInfo = ConcurrentDictionary<_, _>(HashIdentity.Structural)
- }
-
let cenv =
{
- g = tcGlobals
+ g = g
ilxPubCloEnv =
EraseClosures.newIlxPubCloEnv (
- tcGlobals.ilg,
- tcGlobals.AddMethodGeneratedAttributes,
- tcGlobals.AddFieldGeneratedAttributes,
- tcGlobals.AddFieldNeverAttributes
+ g.ilg,
+ g.AddMethodGeneratedAttributes,
+ g.AddFieldGeneratedAttributes,
+ g.AddFieldNeverAttributes
)
tcVal = tcVal
viewCcu = ccu
@@ -11906,7 +12110,6 @@ type IlxAssemblyGenerator(amap: ImportMap, tcGlobals: TcGlobals, tcVal: Constrai
namedDebugPointsForInlinedCode = Map.empty
amap = amap
casApplied = ConcurrentDictionary()
- intraAssemblyInfo = intraAssemblyInfo
optionsOpt = None
optimizeDuringCodeGen = (fun _flag expr -> expr)
stackGuard = getEmptyStackGuard ()
@@ -11915,22 +12118,12 @@ type IlxAssemblyGenerator(amap: ImportMap, tcGlobals: TcGlobals, tcVal: Constrai
/// Register a set of referenced assemblies with the ILX code generator
member _.AddExternalCcus ccus =
- ilxGenEnv <- AddExternalCcusToIlxGenEnv cenv tcGlobals ilxGenEnv ccus
+ ilxGenEnv <- AddExternalCcusToIlxGenEnv cenv ilxGenEnv ccus
/// Register a fragment of the current assembly with the ILX code generator. If 'isIncrementalFragment' is true then the input
/// is assumed to be a fragment 'typed' into FSI.EXE, otherwise the input is assumed to be the result of a '#load'
member _.AddIncrementalLocalAssemblyFragment(isIncrementalFragment, fragName, typedImplFiles) =
- ilxGenEnv <-
- AddIncrementalLocalAssemblyFragmentToIlxGenEnv(
- cenv,
- isIncrementalFragment,
- tcGlobals,
- ccu,
- fragName,
- intraAssemblyInfo,
- ilxGenEnv,
- typedImplFiles
- )
+ ilxGenEnv <- AddIncrementalLocalAssemblyFragmentToIlxGenEnv(cenv, isIncrementalFragment, ccu, fragName, ilxGenEnv, typedImplFiles)
/// Generate ILX code for an assembly fragment
member _.GenerateCode(codeGenOpts, typedAssembly: CheckedAssemblyAfterOptimization, assemAttribs, moduleAttribs) =
diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs
index 32298c0cf05..54a69b05f8c 100644
--- a/src/Compiler/Driver/CompilerConfig.fs
+++ b/src/Compiler/Driver/CompilerConfig.fs
@@ -610,6 +610,8 @@ type TcConfigBuilder =
mutable typeCheckingConfig: TypeCheckingConfig
mutable dumpSignatureData: bool
+
+ mutable realsig: bool
}
// Directories to start probing in
@@ -817,6 +819,7 @@ type TcConfigBuilder =
DumpGraph = false
}
dumpSignatureData = false
+ realsig = false
strictIndentation = None
}
@@ -1360,6 +1363,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
member _.captureIdentifiersWhenParsing = data.captureIdentifiersWhenParsing
member _.typeCheckingConfig = data.typeCheckingConfig
member _.dumpSignatureData = data.dumpSignatureData
+ member _.realsig = data.realsig
static member Create(builder, validate) =
use _ = UseBuildPhase BuildPhase.Parameter
diff --git a/src/Compiler/Driver/CompilerConfig.fsi b/src/Compiler/Driver/CompilerConfig.fsi
index f59950f9e28..f5360fbb972 100644
--- a/src/Compiler/Driver/CompilerConfig.fsi
+++ b/src/Compiler/Driver/CompilerConfig.fsi
@@ -519,6 +519,8 @@ type TcConfigBuilder =
mutable typeCheckingConfig: TypeCheckingConfig
mutable dumpSignatureData: bool
+
+ mutable realsig: bool
}
static member CreateNew:
@@ -894,6 +896,8 @@ type TcConfig =
member dumpSignatureData: bool
+ member realsig: bool
+
/// Represents a computation to return a TcConfig. Normally this is just a constant immutable TcConfig,
/// but for F# Interactive it may be based on an underlying mutable TcConfigBuilder.
[]
diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs
index d8d9ccd9866..090e5597440 100644
--- a/src/Compiler/Driver/CompilerImports.fs
+++ b/src/Compiler/Driver/CompilerImports.fs
@@ -1667,6 +1667,7 @@ and [] TcImports
let cpath =
CompPath(
ILScopeRef.Local,
+ SyntaxAccess.Unknown,
injectedNamespace
|> List.rev
|> List.map (fun n -> (n, ModuleOrNamespaceKind.Namespace true))
@@ -2522,7 +2523,8 @@ and [] TcImports
tcConfig.emitDebugInfoInQuotations,
tcConfig.noDebugAttributes,
tcConfig.pathMap,
- tcConfig.langVersion
+ tcConfig.langVersion,
+ tcConfig.realsig
)
#if DEBUG
diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs
index d1618dd19d6..e742a20e139 100644
--- a/src/Compiler/Driver/CompilerOptions.fs
+++ b/src/Compiler/Driver/CompilerOptions.fs
@@ -568,6 +568,9 @@ let SetTailcallSwitch (tcConfigB: TcConfigBuilder) switch =
let SetDeterministicSwitch (tcConfigB: TcConfigBuilder) switch =
tcConfigB.deterministic <- (switch = OptionSwitch.On)
+let SetRealsig (tcConfigB: TcConfigBuilder) switch =
+ tcConfigB.realsig <- (switch = OptionSwitch.On)
+
let SetReferenceAssemblyOnlySwitch (tcConfigB: TcConfigBuilder) switch =
match tcConfigB.emitMetadataAssembly with
| MetadataAssemblyGeneration.None when (not tcConfigB.standalone) && tcConfigB.extraStaticLinkRoots.IsEmpty ->
@@ -1026,6 +1029,8 @@ let codeGenerationFlags isFsi (tcConfigB: TcConfigBuilder) =
Some(FSComp.SR.optsDeterministic ())
)
+ CompilerOption("realsig", tagNone, OptionSwitch(SetRealsig tcConfigB), None, Some(FSComp.SR.optsRealsig ()))
+
CompilerOption("pathmap", tagPathMap, OptionStringList(AddPathMapping tcConfigB), None, Some(FSComp.SR.optsPathMap ()))
CompilerOption(
diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt
index a1086629fbe..cdd483858e0 100644
--- a/src/Compiler/FSComp.txt
+++ b/src/Compiler/FSComp.txt
@@ -879,6 +879,7 @@ optsDebug,"Specify debugging type: full, portable, embedded, pdbonly. ('%s' is t
optsOptimize,"Enable optimizations (Short form: -O)"
optsTailcalls,"Enable or disable tailcalls"
optsDeterministic,"Produce a deterministic assembly (including module version GUID and timestamp)"
+optsRealsig,"Generate assembly with IL visibility that matches the source code visibility"
optsRefOnly,"Produce a reference assembly, instead of a full assembly, as the primary output"
optsRefOut,"Produce a reference assembly with the specified file path."
optsPathMap,"Maps physical paths to source path names output by the compiler"
@@ -993,7 +994,6 @@ lexhlpIdentifierReserved,"The identifier '%s' is reserved for future use by F#"
1112,impImportedAssemblyUsesNotPublicType,"An imported assembly uses the type '%s' but that type is not public"
1113,optValueMarkedInlineButIncomplete,"The value '%s' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible"
1114,optValueMarkedInlineButWasNotBoundInTheOptEnv,"The value '%s' was marked inline but was not bound in the optimization environment"
-1115,optLocalValueNotFoundDuringOptimization,"Local value %s not found during optimization"
1116,optValueMarkedInlineHasUnexpectedValue,"A value marked as 'inline' has an unexpected value"
1117,optValueMarkedInlineCouldNotBeInlined,"A value marked as 'inline' could not be inlined"
1118,optFailedToInlineValue,"Failed to inline the value '%s' marked 'inline', perhaps because a recursive value was marked 'inline'"
diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj
index 6a52de46022..e1fe24ea421 100644
--- a/src/Compiler/FSharp.Compiler.Service.fsproj
+++ b/src/Compiler/FSharp.Compiler.Service.fsproj
@@ -21,7 +21,6 @@
$(OtherFlags) --warnon:3218
$(OtherFlags) --warnon:3390
-
true
$(IntermediateOutputPath)$(TargetFramework)\
$(IntermediateOutputPath)$(TargetFramework)\
diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs
index e5ff5b6c754..a6ea4f1867e 100644
--- a/src/Compiler/Interactive/fsi.fs
+++ b/src/Compiler/Interactive/fsi.fs
@@ -1606,7 +1606,10 @@ let rec ConvReflectionTypeToILType (reflectionTy: Type) =
let internal mkBoundValueTypedImpl tcGlobals m moduleName name ty =
let vis = Accessibility.TAccess([])
- let compPath = (CompilationPath.CompPath(ILScopeRef.Local, []))
+
+ let compPath =
+ (CompilationPath.CompPath(ILScopeRef.Local, SyntaxAccess.Unknown, []))
+
let mutable mty = Unchecked.defaultof<_>
let entity =
diff --git a/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs b/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs
index 37b3f26c429..291e24fe6e9 100644
--- a/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs
+++ b/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs
@@ -129,10 +129,10 @@ let mkLocalNameTypeArity compgen m name ty valReprInfo =
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
-// pass1: GetValsBoundUnderMustInline (see comment further below)
+// pass1: GetValsBoundUnderShouldInline (see comment further below)
//-------------------------------------------------------------------------
-let GetValsBoundUnderMustInline xinfo =
+let GetValsBoundUnderShouldInline xinfo =
let accRejectFrom (v: Val) repr rejectS =
if v.InlineInfo = ValInline.Always then
Zset.union (GetValsBoundInExpr repr) rejectS
@@ -194,8 +194,14 @@ module Pass1_DetermineTLRAndArities =
let nFormals = vss.Length
let nMaxApplied = GetMaxNumArgsAtUses xinfo f
let arity = Operators.min nFormals nMaxApplied
- if atTopLevel || arity<>0 || not (isNil tps) then Some (f, arity)
- else None
+ if atTopLevel then
+ Some (f, arity)
+ elif g.realsig then
+ None
+ else if arity<>0 || not (isNil tps) then
+ Some (f, arity)
+ else
+ None
/// Check if f involves any value recursion (so can skip those).
/// ValRec considered: recursive && some f in mutual binding is not bound to a lambda
@@ -213,21 +219,21 @@ module Pass1_DetermineTLRAndArities =
let xinfo = GetUsageInfoOfImplFile g expr
let fArities = Zmap.chooseL (SelectTLRVals g xinfo) xinfo.Defns
let fArities = List.filter (fst >> IsValueRecursionFree xinfo) fArities
- // Do not TLR v if it is bound under a mustinline defn
+ // Do not TLR v if it is bound under a shouldinline defn
// There is simply no point - the original value will be duplicated and TLR'd anyway
- let rejectS = GetValsBoundUnderMustInline xinfo
+ let rejectS = GetValsBoundUnderShouldInline xinfo
let fArities = List.filter (fun (v, _) -> not (Zset.contains v rejectS)) fArities
(*-*)
let tlrS = Zset.ofList valOrder (List.map fst fArities)
- let topValS = xinfo.TopLevelBindings (* genuinely top level *)
- let topValS = Zset.filter (IsMandatoryNonTopLevel g >> not) topValS (* restrict *)
- (* REPORT MISSED CASES *)
+ let topValS = xinfo.TopLevelBindings (* genuinely top level *)
+ let topValS = Zset.filter (IsMandatoryNonTopLevel g >> not) topValS (* restrict *)
#if DEBUG
+ (* REPORT MISSED CASES *)
if verboseTLR then
let missed = Zset.diff xinfo.TopLevelBindings tlrS
missed |> Zset.iter (fun v -> dprintf "TopLevel but not TLR = %s\n" v.LogicalName)
-#endif
(* REPORT OVER *)
+#endif
let arityM = Zmap.ofList valOrder fArities
#if DEBUG
if verboseTLR then DumpArity arityM
@@ -885,24 +891,24 @@ module Pass4_RewriteAssembly =
/// Any TLR repr bindings under lambdas can be filtered out (and collected),
/// giving pre-declarations to insert before the outermost lambda expr.
type RewriteState =
- { rws_mustinline: bool
+ { rws_shouldinline: bool
/// counts level of enclosing "lambdas"
rws_innerLevel: int
/// collected preDecs (fringe is in-order)
rws_preDecs: Tree
}
- let rewriteState0 = {rws_mustinline=false;rws_innerLevel=0;rws_preDecs=emptyTR}
+ let rewriteState0 = {rws_shouldinline=false;rws_innerLevel=0;rws_preDecs=emptyTR}
// move in/out of lambdas (or lambda containing construct)
let EnterInner z = {z with rws_innerLevel = z.rws_innerLevel + 1}
let ExitInner z = {z with rws_innerLevel = z.rws_innerLevel - 1}
- let EnterMustInline b z f =
- let orig = z.rws_mustinline
- let x, z' = f (if b then {z with rws_mustinline = true } else z)
- {z' with rws_mustinline = orig }, x
+ let EnterShouldInline b z f =
+ let orig = z.rws_shouldinline
+ let x, z' = f (if b then {z with rws_shouldinline = true } else z)
+ {z' with rws_shouldinline = orig }, x
/// extract PreDecs (iff at top-level)
let ExtractPreDecs z =
@@ -1263,8 +1269,8 @@ module Pass4_RewriteAssembly =
TObjExprMethod(slotsig, attribs, tps, vs, e, m), z
and TransBindingRhs penv z (TBind(v, e, letSeqPtOpt)) : Binding * RewriteState =
- let mustInline = v.MustInline
- let z, e = EnterMustInline mustInline z (fun z -> TransExpr penv z e)
+ let shouldInline = v.ShouldInline
+ let z, e = EnterShouldInline shouldInline z (fun z -> TransExpr penv z e)
TBind (v, e, letSeqPtOpt), z
and TransDecisionTree penv z x: DecisionTree * RewriteState =
diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs
index afdc0616505..fafb8184600 100644
--- a/src/Compiler/Optimize/Optimizer.fs
+++ b/src/Compiler/Optimize/Optimizer.fs
@@ -435,6 +435,7 @@ type cenv =
stackGuard: StackGuard
+ realsig: bool
}
override x.ToString() = ""
@@ -499,7 +500,7 @@ let rec IsPartialExprVal x =
| SizeValue (_, a) -> IsPartialExprVal a
let CheckInlineValueIsComplete (v: Val) res =
- if v.MustInline && IsPartialExprVal res then
+ if v.ShouldInline && IsPartialExprVal res then
errorR(Error(FSComp.SR.optValueMarkedInlineButIncomplete(v.DisplayName), v.Range))
//System.Diagnostics.Debug.Assert(false, sprintf "Break for incomplete inline value %s" v.DisplayName)
@@ -557,7 +558,7 @@ let UnknownValInfo = { ValExprInfo=UnknownValue; ValMakesNoCriticalTailcalls=fal
let mkValInfo info (v: Val) = { ValExprInfo=info.Info; ValMakesNoCriticalTailcalls= v.MakesNoCriticalTailcalls }
(* Bind a value *)
-let BindInternalLocalVal cenv (v: Val) vval env =
+let BindInternalLocalVal cenv (v: Val) vval env =
let vval = if v.IsMutable then UnknownValInfo else vval
match vval.ValExprInfo with
@@ -565,7 +566,7 @@ let BindInternalLocalVal cenv (v: Val) vval env =
| _ ->
cenv.localInternalVals[v.Stamp] <- vval
env
-
+
let BindExternalLocalVal cenv (v: Val) vval env =
let g = cenv.g
@@ -635,7 +636,7 @@ let GetInfoForLocalValue cenv env (v: Val) m =
match env.localExternalVals.TryFind v.Stamp with
| Some vval -> vval
| None ->
- if v.MustInline then
+ if v.ShouldInline then
errorR(Error(FSComp.SR.optValueMarkedInlineButWasNotBoundInTheOptEnv(fullDisplayTextOfValRef (mkLocalValRef v)), m))
UnknownValInfo
@@ -663,7 +664,7 @@ let GetInfoForNonLocalVal cenv env (vref: ValRef) =
if vref.IsDispatchSlot then
UnknownValInfo
// REVIEW: optionally turn x-module on/off on per-module basis or
- elif cenv.settings.crossAssemblyOpt () || vref.MustInline then
+ elif cenv.settings.crossAssemblyOpt () || vref.ShouldInline then
match TryGetInfoForNonLocalEntityRef env vref.nlr.EnclosingEntity.nlr with
| Some structInfo ->
match structInfo.ValInfos.TryFind vref with
@@ -1415,7 +1416,7 @@ let AbstractOptimizationInfoToEssentials =
let rec abstractModulInfo (ss: ModuleInfo) =
{ ModuleOrNamespaceInfos = NameMap.map (InterruptibleLazy.force >> abstractModulInfo >> notlazy) ss.ModuleOrNamespaceInfos
- ValInfos = ss.ValInfos.Filter (fun (v, _) -> v.MustInline) }
+ ValInfos = ss.ValInfos.Filter (fun (v, _) -> v.ShouldInline) }
and abstractLazyModulInfo ss = ss |> InterruptibleLazy.force |> abstractModulInfo |> notlazy
@@ -2354,8 +2355,17 @@ let rec OptimizeExpr cenv (env: IncrementalOptimizationEnv) expr =
| Expr.Const (c, m, ty) ->
OptimizeConst cenv env expr (c, m, ty)
- | Expr.Val (v, _vFlags, m) ->
- OptimizeVal cenv env expr (v, m)
+ | Expr.Val (v, _vFlags, m) ->
+ if not (v.Accessibility.IsPrivate) then
+ OptimizeVal cenv env expr (v, m)
+ else
+ expr,
+ { TotalSize = 10
+ FunctionSize = 1
+ HasEffect = false
+ MightMakeCriticalTailcall=false
+ Info=UnknownValue }
+
| Expr.Quote (ast, splices, isFromQueryExpression, m, ty) ->
let doData data = map3Of4 (List.map (OptimizeExpr cenv env >> fst)) data
@@ -3035,8 +3045,7 @@ and CopyExprForInlining cenv isInlineIfLambda expr (m: range) =
/// Make optimization decisions once we know the optimization information
/// for a value
-and TryOptimizeVal cenv env (vOpt: ValRef option, mustInline, inlineIfLambda, valInfoForVal, m) =
-
+and TryOptimizeVal cenv env (vOpt: ValRef option, shouldInline, inlineIfLambda, valInfoForVal, m) =
let g = cenv.g
match valInfoForVal with
@@ -3045,13 +3054,13 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, mustInline, inlineIfLambda, va
Some (Expr.Const (c, m, ty))
| SizeValue (_, detail) ->
- TryOptimizeVal cenv env (vOpt, mustInline, inlineIfLambda, detail, m)
+ TryOptimizeVal cenv env (vOpt, shouldInline, inlineIfLambda, detail, m)
| ValValue (vR, detail) ->
// Inline values bound to other values immediately
// Prefer to inline using the more specific info if possible
// If the more specific info didn't reveal an inline then use the value
- match TryOptimizeVal cenv env (vOpt, mustInline, inlineIfLambda, detail, m) with
+ match TryOptimizeVal cenv env (vOpt, shouldInline, inlineIfLambda, detail, m) with
| Some e -> Some e
| None ->
// If we have proven 'v = compilerGeneratedValue'
@@ -3069,22 +3078,30 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, mustInline, inlineIfLambda, va
| ConstExprValue(_size, expr) ->
Some (remarkExpr m (copyExpr g CloneAllAndMarkExprValsAsCompilerGenerated expr))
- | CurriedLambdaValue (_, _, _, expr, _) when mustInline || inlineIfLambda ->
- let exprCopy = CopyExprForInlining cenv inlineIfLambda expr m
- Some exprCopy
+ | CurriedLambdaValue (_, _, _, expr, _) when shouldInline || inlineIfLambda ->
+ let fvs = freeInExpr CollectLocals expr
+ if fvs.UsesMethodLocalConstructs then
+ // Discarding lambda for binding because uses protected members --- TBD: Should we warn or error here
+ None
+ elif fvs.FreeLocals |> Seq.exists(fun v -> v.Accessibility.IsPrivate ) then
+ // Discarding lambda for binding because uses private members --- TBD: Should we warn or error here
+ None
+ else
+ let exprCopy = CopyExprForInlining cenv inlineIfLambda expr m
+ Some exprCopy
- | TupleValue _ | UnionCaseValue _ | RecdValue _ when mustInline ->
+ | TupleValue _ | UnionCaseValue _ | RecdValue _ when shouldInline ->
failwith "tuple, union and record values cannot be marked 'inline'"
- | UnknownValue when mustInline ->
+ | UnknownValue when shouldInline ->
warning(Error(FSComp.SR.optValueMarkedInlineHasUnexpectedValue(), m))
None
- | _ when mustInline ->
+ | _ when shouldInline ->
warning(Error(FSComp.SR.optValueMarkedInlineCouldNotBeInlined(), m))
None
- | _ -> None
+ | _ -> None
and TryOptimizeValInfo cenv env m vinfo =
if vinfo.HasEffect then None else TryOptimizeVal cenv env (None, false, false, vinfo.Info, m)
@@ -3109,7 +3126,7 @@ and OptimizeVal cenv env expr (v: ValRef, m) =
let valInfoForVal = GetInfoForValWithCheck cenv env m v
- match TryOptimizeVal cenv env (Some v, v.MustInline, v.InlineIfLambda, valInfoForVal.ValExprInfo, m) with
+ match TryOptimizeVal cenv env (Some v, v.ShouldInline, v.InlineIfLambda, valInfoForVal.ValExprInfo, m) with
| Some e ->
// don't reoptimize inlined lambdas until they get applied to something
match e with
@@ -3125,9 +3142,9 @@ and OptimizeVal cenv env expr (v: ValRef, m) =
let e, einfo = OptimizeExpr cenv env e
e, AddValEqualityInfo g m v einfo
- | None ->
- if v.MustInline then
- error(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m))
+ | None ->
+ if v.ShouldInline then
+ warning(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m))
if v.InlineIfLambda then
warning(Error(FSComp.SR.optFailedToInlineSuggestedValue(v.DisplayName), m))
expr, (AddValEqualityInfo g m v
@@ -3578,45 +3595,46 @@ and OptimizeApplication cenv env (f0, f0ty, tyargs, args, m) =
| Choice2Of2 (newf0, remake) ->
match TryInlineApplication cenv env finfo (tyargs, args, m) with
- | Some (res, info) ->
+ | Some (res, info) ->
// inlined
(res |> remake), info
- | None ->
- let shapes =
- match newf0 with
- | Expr.Val (vref, _, _) ->
- match vref.ValReprInfo with
- | Some(ValReprInfo(_, detupArgsL, _)) ->
- let nargs = args.Length
- let nDetupArgsL = detupArgsL.Length
- let nShapes = min nargs nDetupArgsL
- let detupArgsShapesL =
- List.truncate nShapes detupArgsL
- |> List.map (fun detupArgs ->
- match detupArgs with
- | [] | [_] -> UnknownValue
- | _ -> TupleValue(Array.ofList (List.map (fun _ -> UnknownValue) detupArgs)))
- List.zip (detupArgsShapesL @ List.replicate (nargs - nShapes) UnknownValue) args
- | _ -> args |> List.map (fun arg -> UnknownValue, arg)
- | _ -> args |> List.map (fun arg -> UnknownValue, arg)
-
- let newArgs, arginfos = OptimizeExprsThenReshapeAndConsiderSplits cenv env shapes
- // beta reducing
- let reducedExpr = MakeApplicationAndBetaReduce g (newf0, f0ty, [tyargs], newArgs, m)
- let newExpr = reducedExpr |> remake
-
- match newf0, reducedExpr with
- | (Expr.Lambda _ | Expr.TyLambda _), Expr.Let _ ->
- // we beta-reduced, hence reoptimize
- OptimizeExpr cenv env newExpr
| _ ->
- // regular
- // Determine if this application is a critical tailcall
- let mayBeCriticalTailcall =
+ let shapes =
match newf0 with
- | KnownValApp(vref, _typeArgs, otherArgs) ->
+ | Expr.Val (vref, _, _) ->
+ match vref.ValReprInfo with
+ | Some(ValReprInfo(_, detupArgsL, _)) ->
+ let nargs = args.Length
+ let nDetupArgsL = detupArgsL.Length
+ let nShapes = min nargs nDetupArgsL
+ let detupArgsShapesL =
+ List.truncate nShapes detupArgsL
+ |> List.map (fun detupArgs ->
+ match detupArgs with
+ | [] | [_] -> UnknownValue
+ | _ -> TupleValue(Array.ofList (List.map (fun _ -> UnknownValue) detupArgs)))
+ List.zip (detupArgsShapesL @ List.replicate (nargs - nShapes) UnknownValue) args
+ | _ -> args |> List.map (fun arg -> UnknownValue, arg)
+ | _ -> args |> List.map (fun arg -> UnknownValue, arg)
+
+ let newArgs, arginfos = OptimizeExprsThenReshapeAndConsiderSplits cenv env shapes
+ // beta reducing
+ let reducedExpr = MakeApplicationAndBetaReduce g (newf0, f0ty, [tyargs], newArgs, m)
+ let newExpr = reducedExpr |> remake
+
+ match newf0, reducedExpr with
+ | (Expr.Lambda _ | Expr.TyLambda _), Expr.Let _ ->
+ // we beta-reduced, hence reoptimize
+ OptimizeExpr cenv env newExpr
+ | _ ->
+ // regular
+
+ // Determine if this application is a critical tailcall
+ let mayBeCriticalTailcall =
+ match newf0 with
+ | KnownValApp(vref, _typeArgs, otherArgs) ->
// Check if this is a call to a function of known arity that has been inferred to not be a critical tailcall when used as a direct call
// This includes recursive calls to the function being defined (in which case we get a non-critical, closed-world tailcall).
@@ -3635,16 +3653,16 @@ and OptimizeApplication cenv env (f0, f0ty, tyargs, args, m) =
| None -> true // over-application of a known function, which presumably returns a function. This counts as an indirect call
else
true // application of a function that may make a critical tailcall
-
- | _ ->
- // All indirect calls (calls to unknown functions) are assumed to be critical tailcalls
- true
- newExpr, { TotalSize=finfo.TotalSize + AddTotalSizes arginfos
- FunctionSize=finfo.FunctionSize + AddFunctionSizes arginfos
- HasEffect=true
- MightMakeCriticalTailcall = mayBeCriticalTailcall
- Info=ValueOfExpr newExpr }
+ | _ ->
+ // All indirect calls (calls to unknown functions) are assumed to be critical tailcalls
+ true
+
+ newExpr, { TotalSize=finfo.TotalSize + AddTotalSizes arginfos
+ FunctionSize=finfo.FunctionSize + AddFunctionSizes arginfos
+ HasEffect=true
+ MightMakeCriticalTailcall = mayBeCriticalTailcall
+ Info=ValueOfExpr newExpr }
/// Extract a sequence of pipe-right operations (note the pipe-right operator is left-associative
/// so we start with the full thing and descend down taking apps off the end first)
@@ -4087,7 +4105,7 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) =
let exprOptimized, einfo =
let env = if vref.IsCompilerGenerated && Option.isSome env.latestBoundId then env else {env with latestBoundId=Some vref.Id}
- let cenv = if vref.InlineInfo.MustInline then { cenv with optimizing=false} else cenv
+ let cenv = if vref.InlineInfo.ShouldInline then { cenv with optimizing=false} else cenv
let arityInfo = InferValReprInfoOfBinding g AllowTypeDirectedDetupling.No vref expr
let exprOptimized, einfo = OptimizeLambdas (Some vref) cenv env arityInfo expr vref.Type
let size = localVarSize
@@ -4106,6 +4124,9 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) =
if fvs.UsesMethodLocalConstructs then
// Discarding lambda for binding because uses protected members
UnknownValue
+ elif fvs.FreeLocals.ToArray() |> Seq.fold(fun acc v -> if not acc then v.Accessibility.IsPrivate else acc) false then
+ // Discarding lambda for binding because uses private members
+ UnknownValue
else
ivalue
@@ -4116,10 +4137,10 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) =
| UnknownValue | ConstValue _ | ConstExprValue _ -> ivalue
| SizeValue(_, a) -> MakeSizedValueInfo (cut a)
- let einfo = if vref.MustInline || vref.InlineIfLambda then einfo else {einfo with Info = cut einfo.Info }
+ let einfo = if vref.ShouldInline || vref.InlineIfLambda then einfo else {einfo with Info = cut einfo.Info }
let einfo =
- if (not vref.MustInline && not vref.InlineIfLambda && not cenv.settings.KeepOptimizationValues) ||
+ if (not vref.ShouldInline && not vref.InlineIfLambda && not cenv.settings.KeepOptimizationValues) ||
// Bug 4916: do not record inline data for initialization trigger expressions
// Note: we can't eliminate these value infos at the file boundaries because that would change initialization
@@ -4166,8 +4187,8 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) =
valRefEq g nvref g.generic_hash_inner_vref))
then {einfo with Info=UnknownValue}
else einfo
- if vref.MustInline && IsPartialExprVal einfo.Info then
- errorR(InternalError("the mustinline value '"+vref.LogicalName+"' was not inferred to have a known value", vref.Range))
+ if vref.ShouldInline && IsPartialExprVal einfo.Info then
+ errorR(InternalError("the inline value '"+vref.LogicalName+"' was not inferred to have a known value", vref.Range))
let env = BindInternalLocalVal cenv vref (mkValInfo einfo vref) env
(TBind(vref, exprOptimized, spBind), einfo), env
@@ -4366,7 +4387,8 @@ let OptimizeImplFile (settings, ccu, tcGlobals, tcVal, importMap, optEnv, isIncr
localInternalVals=Dictionary(10000)
emitTailcalls=emitTailcalls
casApplied=Dictionary()
- stackGuard = StackGuard(OptimizerStackGuardDepth, "OptimizerStackGuardDepth")
+ stackGuard = StackGuard(OptimizerStackGuardDepth, "OptimizerStackGuardDepth")
+ realsig = tcGlobals.realsig
}
let env, _, _, _ as results = OptimizeImplFileInternal cenv optEnv isIncrementalFragment fsiMultiAssemblyEmit hidden mimpls
diff --git a/src/Compiler/Symbols/Symbols.fs b/src/Compiler/Symbols/Symbols.fs
index b5b244a6e5c..19fbfe9306b 100644
--- a/src/Compiler/Symbols/Symbols.fs
+++ b/src/Compiler/Symbols/Symbols.fs
@@ -32,9 +32,9 @@ type FSharpAccessibility(a:Accessibility, ?isProtected) =
let isInternalCompPath x =
match x with
- | CompPath(ILScopeRef.Local, []) -> true
+ | CompPath(ILScopeRef.Local, _, []) -> true
| _ -> false
-
+
let (|Public|Internal|Private|) (TAccess p) =
match p with
| [] -> Public
@@ -53,7 +53,7 @@ type FSharpAccessibility(a:Accessibility, ?isProtected) =
override _.ToString() =
let (TAccess paths) = a
- let mangledTextOfCompPath (CompPath(scoref, path)) = getNameOfScopeRef scoref + "/" + textOfPath (List.map fst path)
+ let mangledTextOfCompPath (CompPath(scoref, _, path)) = getNameOfScopeRef scoref + "/" + textOfPath (List.map fst path)
String.concat ";" (List.map mangledTextOfCompPath paths)
type SymbolEnv(g: TcGlobals, thisCcu: CcuThunk, thisCcuTyp: ModuleOrNamespaceType option, tcImports: TcImports, amap: Import.ImportMap, infoReader: InfoReader) =
@@ -122,7 +122,7 @@ module Impl =
| ILScopeRef.Assembly aref -> aref.Name
| ILScopeRef.Module mref -> mref.Name
| ILScopeRef.PrimaryAssembly -> ilg.primaryAssemblyName
- let canAccessCompPathFromCrossProject (CompPath(scoref1, cpath1)) (CompPath(scoref2, cpath2)) =
+ let canAccessCompPathFromCrossProject (CompPath(scoref1, _, cpath1)) (CompPath(scoref2, _, cpath2)) =
let rec loop p1 p2 =
match p1, p2 with
| (a1, k1) :: rest1, (a2, k2) :: rest2 -> (a1=a2) && (k1=k2) && loop rest1 rest2
@@ -141,7 +141,7 @@ module Impl =
| ILMemberAccess.CompilerControlled
| ILMemberAccess.FamilyAndAssembly
| ILMemberAccess.Assembly ->
- taccessPrivate (CompPath(declaringEntity.CompilationPath.ILScopeRef, []))
+ taccessPrivate (CompPath(declaringEntity.CompilationPath.ILScopeRef, SyntaxAccess.Unknown, []))
| ILMemberAccess.Private ->
taccessPrivate declaringEntity.CompilationPath
@@ -166,7 +166,7 @@ module Impl =
match td.Access with
| ILTypeDefAccess.Public
| ILTypeDefAccess.Nested ILMemberAccess.Public -> taccessPublic
- | ILTypeDefAccess.Private -> taccessPrivate (CompPath(entity.CompilationPath.ILScopeRef, []))
+ | ILTypeDefAccess.Private -> taccessPrivate (CompPath(entity.CompilationPath.ILScopeRef, SyntaxAccess.Unknown, []))
| ILTypeDefAccess.Nested nested -> getApproxFSharpAccessibilityOfMember entity nested
| FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata ->
@@ -409,13 +409,13 @@ type FSharpEntity(cenv: SymbolEnv, entity: EntityRef, tyargs: TType list) =
checkIsResolved()
match entity.CompilationPathOpt with
| None -> "global"
- | Some (CompPath(_, [])) -> "global"
+ | Some (CompPath(_, _, [])) -> "global"
| Some cp -> buildAccessPath (Some cp)
member x.DeclaringEntity =
match entity.CompilationPathOpt with
| None -> None
- | Some (CompPath(_, [])) -> None
+ | Some (CompPath(_, _, [])) -> None
| Some cp ->
match x.Assembly.Contents.FindEntityByPath cp.MangledPath with
| Some res -> Some res
@@ -431,7 +431,7 @@ type FSharpEntity(cenv: SymbolEnv, entity: EntityRef, tyargs: TType list) =
checkIsResolved()
match entity.CompilationPathOpt with
| None -> None
- | Some (CompPath(_, [])) -> None
+ | Some (CompPath(_, _, [])) -> None
| Some cp when cp.AccessPath |> List.forall (function _, ModuleOrNamespaceKind.Namespace _ -> true | _ -> false) ->
Some (buildAccessPath (Some cp))
| Some _ -> None
@@ -774,7 +774,7 @@ type FSharpEntity(cenv: SymbolEnv, entity: EntityRef, tyargs: TType list) =
member _.AllCompilationPaths =
checkIsResolved()
- let (CompPath(_, parts)) = entity.CompilationPath
+ let (CompPath(_, _, parts)) = entity.CompilationPath
let partsList =
[ yield parts
match parts with
diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs
index 3830dd008e5..4f713fb4d5d 100644
--- a/src/Compiler/TypedTree/TcGlobals.fs
+++ b/src/Compiler/TypedTree/TcGlobals.fs
@@ -193,7 +193,8 @@ type TcGlobals(
emitDebugInfoInQuotations: bool,
noDebugAttributes: bool,
pathMap: PathMap,
- langVersion: LanguageVersion) =
+ langVersion: LanguageVersion,
+ realsig: bool) =
// empty flags
let v_knownWithoutNull = 0uy
@@ -354,7 +355,7 @@ type TcGlobals(
let attrRef = ILTypeRef.Create(ILScopeRef.Local, [], nm)
let attrTycon =
Construct.NewTycon(
- Some (CompPath(ILScopeRef.Local, [])),
+ Some (CompPath(ILScopeRef.Local, SyntaxAccess.Internal, [])),
attrRef.Name,
range0,
taccessInternal,
@@ -1104,6 +1105,8 @@ type TcGlobals(
member _.langVersion = langVersion
+ member _.realsig = realsig
+
member _.unionCaseRefEq x y = primUnionCaseRefEq compilingFSharpCore fslibCcu x y
member _.valRefEq x y = primValRefEq compilingFSharpCore fslibCcu x y
diff --git a/src/Compiler/TypedTree/TypedTree.fs b/src/Compiler/TypedTree/TypedTree.fs
index da8e43bfba5..7c2a454ae36 100644
--- a/src/Compiler/TypedTree/TypedTree.fs
+++ b/src/Compiler/TypedTree/TypedTree.fs
@@ -48,8 +48,8 @@ type ValInline =
/// Indicates the value must never be inlined by the optimizer
| Never
- /// Returns true if the implementation of a value must always be inlined
- member x.MustInline =
+ /// Returns true if the implementation of a value should be inlined
+ member x.ShouldInline =
match x with
| ValInline.Always -> true
| ValInline.Optional | ValInline.Never -> false
@@ -519,14 +519,21 @@ type PublicPath =
assert (pp.Length >= 1)
pp[0..pp.Length-2]
+/// Represents the specified visibility of the accessibility -- used to ensure IL visibility
+[]
+type SyntaxAccess =
+ | Public
+ | Internal
+ | Private
+ | Unknown
/// The information ILXGEN needs about the location of an item
-type CompilationPath =
- | CompPath of ILScopeRef * (string * ModuleOrNamespaceKind) list
+type CompilationPath =
+ | CompPath of ILScopeRef * SyntaxAccess * (string * ModuleOrNamespaceKind) list
- member x.ILScopeRef = let (CompPath(scoref, _)) = x in scoref
+ member x.ILScopeRef = let (CompPath(scoref, _, _)) = x in scoref
- member x.AccessPath = let (CompPath(_, p)) = x in p
+ member x.AccessPath = let (CompPath(_, _, p)) = x in p
member x.MangledPath = List.map fst x.AccessPath
@@ -534,10 +541,10 @@ type CompilationPath =
member x.ParentCompPath =
let a, _ = List.frontAndBack x.AccessPath
- CompPath(x.ILScopeRef, a)
+ CompPath(x.ILScopeRef, x.SyntaxAccess, a)
member x.NestedCompPath n moduleKind =
- CompPath(x.ILScopeRef, x.AccessPath@[(n, moduleKind)])
+ CompPath(x.ILScopeRef, x.SyntaxAccess, x.AccessPath@[(n, moduleKind)])
member x.DemangledPath =
x.AccessPath |> List.map (fun (nm, k) -> CompilationPath.DemangleEntityName nm k)
@@ -548,6 +555,8 @@ type CompilationPath =
| FSharpModuleWithSuffix -> String.dropSuffix nm FSharpModuleSuffix
| _ -> nm
+ member x.SyntaxAccess = let (CompPath(_, access, _)) = x in access
+
[]
type EntityOptionalData =
{
@@ -1271,7 +1280,7 @@ type Entity =
| TProvidedNamespaceRepr _ -> failwith "No compiled representation for provided namespace"
| _ ->
#endif
- let ilTypeRefForCompilationPath (CompPath(sref, p)) item =
+ let ilTypeRefForCompilationPath (CompPath(sref, _, p)) item =
let rec top racc p =
match p with
| [] -> ILTypeRef.Create(sref, [], textOfPath (List.rev (item :: racc)))
@@ -2138,19 +2147,78 @@ type ModuleOrNamespaceType(kind: ModuleOrNamespaceKind, vals: QueueList, en
type ModuleOrNamespace = Entity
/// Represents a type or exception definition in the typed AST
-type Tycon = Entity
+type Tycon = Entity
+
+let getNameOfScopeRef sref =
+ match sref with
+ | ILScopeRef.Local -> ""
+ | ILScopeRef.Module mref -> mref.Name
+ | ILScopeRef.Assembly aref -> aref.Name
+ | ILScopeRef.PrimaryAssembly -> ""
+
+let private isInternalCompPath x =
+ match x with
+ | CompPath(ILScopeRef.Local, _, []) -> true
+ | _ -> false
+
+let private (|Public|Internal|Private|) (TAccess p) =
+ match p with
+ | [] -> Public
+ | _ when List.forall isInternalCompPath p -> Internal
+ | _ -> Private
+
+let getSyntaxAccessForCompPath (TAccess a) = match a with | CompPath(_, sa, _) :: _ -> sa | _ -> TypedTree.SyntaxAccess.Unknown
+
+let updateSyntaxAccessForCompPath access syntaxAccess =
+ match access with
+ | CompPath(sc, sa, p) :: rest when sa <> syntaxAccess -> ([CompPath(sc, syntaxAccess, p)]@rest)
+ | _ -> access
/// Represents the constraint on access for a construct
[]
-type Accessibility =
-
+type Accessibility =
/// Indicates the construct can only be accessed from any code in the given type constructor, module or assembly. [] indicates global scope.
| TAccess of compilationPaths: CompilationPath list
-
+
+ member public x.IsPublic = match x with Public -> true | _ -> false
+
+ member public x.IsInternal = match x with Internal -> true | _ -> false
+
+ member public x.IsPrivate = match x with Private -> true | _ -> false
+
[]
member x.DebugText = x.ToString()
- override x.ToString() = "Accessibility(...)"
+ member x.AsILMemberAccess () =
+ match getSyntaxAccessForCompPath x with
+ | TypedTree.SyntaxAccess.Public -> ILMemberAccess.Public
+ | TypedTree.SyntaxAccess.Internal -> ILMemberAccess.Assembly
+ | TypedTree.SyntaxAccess.Private -> ILMemberAccess.Private
+ | _ ->
+ if x.IsPublic then ILMemberAccess.Public
+ elif x.IsInternal then ILMemberAccess.Assembly
+ else ILMemberAccess.Private
+
+ member x.AsILTypeDefAccess () =
+ if x.IsPublic then ILTypeDefAccess.Public
+ else ILTypeDefAccess.Private
+
+ member x.CompilationPaths = match x with | TAccess compilationPaths -> compilationPaths
+
+ override x.ToString() =
+ match x with
+ | TAccess (paths) ->
+ let mangledTextOfCompPath (CompPath(scoref, _, path)) = getNameOfScopeRef scoref + "/" + textOfPath (List.map fst path)
+ let scopename =
+ if x.IsPublic then "public"
+ elif x.IsInternal then "internal"
+ else "private"
+ let paths = String.concat ";" (List.map mangledTextOfCompPath paths)
+ if paths = "" then
+ scopename
+ else
+ $"{scopename} {paths}"
+
/// Represents less-frequently-required data about a type parameter of type inference variable
[]
@@ -2906,8 +2974,8 @@ type Val =
/// Determines if the values is implied by another construct, e.g. a `IsA` property is implied by the union case for A
member x.IsImplied = x.val_flags.IsImplied
- /// Indicates whether the inline declaration for the value indicate that the value must be inlined?
- member x.MustInline = x.InlineInfo.MustInline
+ /// Indicates whether the inline declaration for the value indicate that the value should be inlined?
+ member x.ShouldInline = x.InlineInfo.ShouldInline
/// Indicates whether this value was generated by the compiler.
///
@@ -4065,7 +4133,7 @@ type ValRef =
member x.InlineIfLambda = x.Deref.InlineIfLambda
/// Indicates whether the inline declaration for the value indicate that the value must be inlined?
- member x.MustInline = x.Deref.MustInline
+ member x.ShouldInline = x.Deref.ShouldInline
/// Indicates whether this value was generated by the compiler.
///
@@ -5898,7 +5966,7 @@ type Construct() =
| None ->
let ilScopeRef = st.TypeProviderAssemblyRef
let enclosingName = GetFSharpPathToProvidedType(st, m)
- CompPath(ilScopeRef, enclosingName |> List.map(fun id->id, ModuleOrNamespaceKind.Namespace true))
+ CompPath(ilScopeRef, SyntaxAccess.Unknown, enclosingName |> List.map(fun id->id, ModuleOrNamespaceKind.Namespace true))
| Some p -> p
let pubpath = cpath.NestedPublicPath id
@@ -6127,7 +6195,7 @@ type Construct() =
/// Create the new contents of an overall assembly
static member NewCcuContents sref m nm mty =
- Construct.NewModuleOrNamespace (Some(CompPath(sref, []))) taccessPublic (ident(nm, m)) XmlDoc.Empty [] (MaybeLazy.Strict mty)
+ Construct.NewModuleOrNamespace (Some(CompPath(sref, SyntaxAccess.Unknown, []))) taccessPublic (ident(nm, m)) XmlDoc.Empty [] (MaybeLazy.Strict mty)
/// Create a tycon based on an existing one using the function 'f'.
/// We require that we be given the new parent for the new tycon.
diff --git a/src/Compiler/TypedTree/TypedTree.fsi b/src/Compiler/TypedTree/TypedTree.fsi
index 7f0a0ef4ed3..00aee7a92ef 100644
--- a/src/Compiler/TypedTree/TypedTree.fsi
+++ b/src/Compiler/TypedTree/TypedTree.fsi
@@ -17,6 +17,8 @@ open FSharp.Compiler.TypeProviders
open FSharp.Compiler.Xml
open FSharp.Core.CompilerServices
+val getNameOfScopeRef: sref: ILScopeRef -> string
+
type Stamp = int64
type StampMap<'T> = Map
@@ -34,7 +36,7 @@ type ValInline =
| Never
/// Returns true if the implementation of a value must always be inlined
- member MustInline: bool
+ member ShouldInline: bool
/// A flag associated with values that indicates whether the recursive scope of the value is currently being processed, type
/// if the value has been generalized or not as yet.
@@ -320,9 +322,17 @@ type PublicPath =
member EnclosingPath: string[]
+/// Represents the specified visibility of the accessibility -- used to ensure IL visibility
+[]
+type SyntaxAccess =
+ | Public
+ | Internal
+ | Private
+ | Unknown
+
/// The information ILXGEN needs about the location of an item
type CompilationPath =
- | CompPath of ILScopeRef * (string * ModuleOrNamespaceKind) list
+ | CompPath of ILScopeRef * SyntaxAccess * (string * ModuleOrNamespaceKind) list
/// String 'Module' off an F# module name, if FSharpModuleWithSuffix is used
static member DemangleEntityName: nm: string -> k: ModuleOrNamespaceKind -> string
@@ -341,6 +351,8 @@ type CompilationPath =
member ParentCompPath: CompilationPath
+ member SyntaxAccess: SyntaxAccess
+
[]
type EntityOptionalData =
{
@@ -1424,6 +1436,8 @@ type ModuleOrNamespace = Entity
/// Represents a type or exception definition in the typed AST
type Tycon = Entity
+val updateSyntaxAccessForCompPath: CompilationPath list -> TypedTree.SyntaxAccess -> CompilationPath list
+
/// Represents the constraint on access for a construct
[]
type Accessibility =
@@ -1431,6 +1445,19 @@ type Accessibility =
/// Indicates the construct can only be accessed from any code in the given type constructor, module or assembly. [] indicates global scope.
| TAccess of compilationPaths: CompilationPath list
+ member AsILMemberAccess: unit -> ILMemberAccess
+
+ member AsILTypeDefAccess: unit -> ILTypeDefAccess
+
+ member CompilationPaths: CompilationPath list
+
+ member IsPublic: bool
+
+ member IsInternal: bool
+
+ member IsPrivate: bool
+
+ /// Readable rendering of Accessibility
override ToString: unit -> string
[]
@@ -2155,8 +2182,8 @@ type Val =
/// a true body. These cases are often causes of bugs in the compiler.
member MemberInfo: ValMemberInfo option
- /// Indicates whether the inline declaration for the value indicate that the value must be inlined?
- member MustInline: bool
+ /// Indicates whether the inline declaration for the value indicates that the value should be inlined.
+ member ShouldInline: bool
/// Get the number of 'this'/'self' object arguments for the member. Instance extension members return '1'.
member NumObjArgs: int
@@ -2870,8 +2897,8 @@ type ValRef =
/// Is this a member, if so some more data about the member.
member MemberInfo: ValMemberInfo option
- /// Indicates whether the inline declaration for the value indicate that the value must be inlined?
- member MustInline: bool
+ /// Indicates whether the inline declaration for the value indicate that the value should be inlined?
+ member ShouldInline: bool
/// Get the number of 'this'/'self' object arguments for the member. Instance extension members return '1'.
member NumObjArgs: int
diff --git a/src/Compiler/TypedTree/TypedTreeBasics.fs b/src/Compiler/TypedTree/TypedTreeBasics.fs
index c71994685d3..1fca2981579 100644
--- a/src/Compiler/TypedTree/TypedTreeBasics.fs
+++ b/src/Compiler/TypedTree/TypedTreeBasics.fs
@@ -19,13 +19,6 @@ assert (sizeof = 8)
assert (sizeof = 4)
#endif
-let getNameOfScopeRef sref =
- match sref with
- | ILScopeRef.Local -> ""
- | ILScopeRef.Module mref -> mref.Name
- | ILScopeRef.Assembly aref -> aref.Name
- | ILScopeRef.PrimaryAssembly -> ""
-
/// Metadata on values (names of arguments etc.)
module ValReprInfo =
@@ -436,11 +429,11 @@ let primValRefEq compilingFSharpCore fslibCcu (x: ValRef) (y: ValRef) =
//---------------------------------------------------------------------------
let fullCompPathOfModuleOrNamespace (m: ModuleOrNamespace) =
- let (CompPath(scoref, cpath)) = m.CompilationPath
- CompPath(scoref, cpath@[(m.LogicalName, m.ModuleOrNamespaceType.ModuleOrNamespaceKind)])
+ let (CompPath(scoref, sa, cpath)) = m.CompilationPath
+ CompPath(scoref, sa, cpath@[(m.LogicalName, m.ModuleOrNamespaceType.ModuleOrNamespaceKind)])
// Can cpath2 be accessed given a right to access cpath1. That is, is cpath2 a nested type or namespace of cpath1. Note order of arguments.
-let inline canAccessCompPathFrom (CompPath(scoref1, cpath1)) (CompPath(scoref2, cpath2)) =
+let inline canAccessCompPathFrom (CompPath(scoref1, _, cpath1)) (CompPath(scoref2, _, cpath2)) =
let rec loop p1 p2 =
match p1, p2 with
| (a1, k1) :: rest1, (a2, k2) :: rest2 -> (a1=a2) && (k1=k2) && loop rest1 rest2
@@ -465,12 +458,20 @@ let accessSubstPaths (newPath, oldPath) (TAccess paths) =
let subst cpath = if cpath=oldPath then newPath else cpath
TAccess (List.map subst paths)
-let compPathOfCcu (ccu: CcuThunk) = CompPath(ccu.ILScopeRef, [])
+let compPathOfCcu (ccu: CcuThunk) = CompPath(ccu.ILScopeRef, SyntaxAccess.Unknown, [])
let taccessPublic = TAccess []
-let taccessPrivate accessPath = TAccess [accessPath]
-let compPathInternal = CompPath(ILScopeRef.Local, [])
+let compPathInternal = CompPath(ILScopeRef.Local, SyntaxAccess.Internal, [])
let taccessInternal = TAccess [compPathInternal]
-let combineAccess (TAccess a1) (TAccess a2) = TAccess(a1@a2)
+let taccessPrivate accessPath = let (CompPath(sc,_, paths)) = accessPath in TAccess [CompPath(sc, TypedTree.SyntaxAccess.Private, paths)]
+
+let combineAccess access1 access2 =
+ let (TAccess a1) = access1
+ let (TAccess a2) = access2
+ let combined =
+ if access1 = taccessPublic then updateSyntaxAccessForCompPath (a1@a2) TypedTree.SyntaxAccess.Public
+ elif access1 = taccessInternal then updateSyntaxAccessForCompPath (a1@a2) TypedTree.SyntaxAccess.Internal
+ else (a1@a2)
+ TAccess combined
exception Duplicate of string * string * range
exception NameClash of string * string * string * range * string * string * range
diff --git a/src/Compiler/TypedTree/TypedTreeBasics.fsi b/src/Compiler/TypedTree/TypedTreeBasics.fsi
index ea1f5979262..c3edc900871 100644
--- a/src/Compiler/TypedTree/TypedTreeBasics.fsi
+++ b/src/Compiler/TypedTree/TypedTreeBasics.fsi
@@ -12,8 +12,6 @@ open FSharp.Compiler.Syntax
open FSharp.Compiler.Text
open FSharp.Compiler.TypedTree
-val getNameOfScopeRef: sref: ILScopeRef -> string
-
/// Metadata on values (names of arguments etc.
module ValReprInfo =
diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs
index 8ef6ce62182..68b924df6a2 100644
--- a/src/Compiler/TypedTree/TypedTreeOps.fs
+++ b/src/Compiler/TypedTree/TypedTreeOps.fs
@@ -1198,7 +1198,7 @@ let mkMultiLambdaTy g m vs bodyTy = mkFunTy g (typeOfLambdaArg m vs) bodyTy
/// the library arising from env.fs. Part of this means that we have to be able to resolve these
/// references. This function artificially forces the existence of a module or namespace at a
/// particular point in order to do this.
-let ensureCcuHasModuleOrNamespaceAtPath (ccu: CcuThunk) path (CompPath(_, cpath)) xml =
+let ensureCcuHasModuleOrNamespaceAtPath (ccu: CcuThunk) path (CompPath(_, sa, cpath)) xml =
let scoref = ccu.ILScopeRef
let rec loop prior_cpath (path: Ident list) cpath (modul: ModuleOrNamespace) =
let mtype = modul.ModuleOrNamespaceType
@@ -1207,7 +1207,7 @@ let ensureCcuHasModuleOrNamespaceAtPath (ccu: CcuThunk) path (CompPath(_, cpath)
let modName = hpath.idText
if not (Map.containsKey modName mtype.AllEntitiesByCompiledAndLogicalMangledNames) then
let mty = Construct.NewEmptyModuleOrNamespaceType mkind
- let cpath = CompPath(scoref, prior_cpath)
+ let cpath = CompPath(scoref, sa, prior_cpath)
let smodul = Construct.NewModuleOrNamespace (Some cpath) taccessPublic hpath xml [] (MaybeLazy.Strict mty)
mtype.AddModuleOrNamespaceByMutation smodul
let modul = Map.find modName mtype.AllEntitiesByCompiledAndLogicalMangledNames
@@ -4150,7 +4150,7 @@ module DebugPrint =
let typeOfValL (v: Val) =
valL v
- ^^ (if v.MustInline then wordL (tagText "inline ") else emptyL)
+ ^^ (if v.ShouldInline then wordL (tagText "inline ") else emptyL)
^^ (if v.IsMutable then wordL(tagText "mutable ") else emptyL)
^^ (if layoutTypes then wordL (tagText ":") ^^ typeL v.Type else emptyL)
@@ -4940,20 +4940,36 @@ let rec accImplHidingInfoAtAssemblyBoundary mdef acc =
let ComputeImplementationHidingInfoAtAssemblyBoundary mty acc =
accImplHidingInfoAtAssemblyBoundary mty acc
+let DoRemap setF remapF =
+ let rec remap mrmi x =
+
+ match mrmi with
+ | [] -> x
+ | (rpi, mhi) :: rest ->
+ // Explicitly hidden?
+ if Zset.contains x (setF mhi) then
+ x
+ else
+ remap rest (remapF rpi x)
+ fun mrmi x -> remap mrmi x
+
+let DoRemapTycon mrmi x = DoRemap (fun mhi -> mhi.HiddenTycons) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) mrmi x
+
+let DoRemapVal mrmi x = DoRemap (fun mhi -> mhi.HiddenVals) (fun rpi x -> (remapValRef rpi (mkLocalValRef x)).Deref) mrmi x
+
//--------------------------------------------------------------------------
// Compute instances of the above for mexpr -> mty
//--------------------------------------------------------------------------
-
let IsHidden setF accessF remapF =
- let rec check mrmi x =
- // Internal/private?
- not (canAccessFromEverywhere (accessF x)) ||
- (match mrmi with
- | [] -> false // Ah! we escaped to freedom!
- | (rpi, mhi) :: rest ->
- // Explicitly hidden?
- Zset.contains x (setF mhi) ||
- // Recurse...
+ let rec check mrmi x =
+ // Internal/private?
+ not (canAccessFromEverywhere (accessF x)) ||
+ (match mrmi with
+ | [] -> false // Ah! we escaped to freedom!
+ | (rpi, mhi) :: rest ->
+ // Explicitly hidden?
+ Zset.contains x (setF mhi) ||
+ // Recurse...
check rest (remapF rpi x))
check
@@ -5752,7 +5768,7 @@ and mapImmediateValsAndTycons ft fv (x: ModuleOrNamespaceType) =
let vals = x.AllValsAndMembers |> QueueList.map fv
let tycons = x.AllEntities |> QueueList.map ft
ModuleOrNamespaceType(x.ModuleOrNamespaceKind, vals, tycons)
-
+
and copyVal compgen (v: Val) =
match compgen with
| OnlyCloneExprVals when v.IsMemberOrModuleBinding -> v
@@ -6129,10 +6145,7 @@ and copyAndRemapAndBindModTy ctxt compgen tmenv mty =
let tycons = allEntitiesOfModuleOrNamespaceTy mty
let vs = allValsOfModuleOrNamespaceTy mty
let _, _, tmenvinner = copyAndRemapAndBindTyconsAndVals ctxt compgen tmenv tycons vs
- remapModTy compgen tmenvinner mty, tmenvinner
-
-and remapModTy _compgen tmenv mty =
- mapImmediateValsAndTycons (renameTycon tmenv) (renameVal tmenv) mty
+ (mapImmediateValsAndTycons (renameTycon tmenvinner) (renameVal tmenvinner) mty), tmenvinner
and renameTycon tyenv x =
let tcref =
diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi
index bec1e031185..534eefc7762 100755
--- a/src/Compiler/TypedTree/TypedTreeOps.fsi
+++ b/src/Compiler/TypedTree/TypedTreeOps.fsi
@@ -1331,6 +1331,12 @@ val MakeExportRemapping: CcuThunk -> ModuleOrNamespace -> Remap
/// Make a remapping table for viewing a module or namespace 'from the outside'
val ApplyExportRemappingToEntity: TcGlobals -> Remap -> ModuleOrNamespace -> ModuleOrNamespace
+/// Get the value including fsi remapping
+val DoRemapTycon: (Remap * SignatureHidingInfo) list -> Tycon -> Tycon
+
+/// Get the value including fsi remapping
+val DoRemapVal: (Remap * SignatureHidingInfo) list -> Val -> Val
+
/// Determine if a type definition is hidden by a signature
val IsHiddenTycon: (Remap * SignatureHidingInfo) list -> Tycon -> bool
diff --git a/src/Compiler/TypedTree/TypedTreePickle.fs b/src/Compiler/TypedTree/TypedTreePickle.fs
index f2fd9887772..fe71dc1429f 100644
--- a/src/Compiler/TypedTree/TypedTreePickle.fs
+++ b/src/Compiler/TypedTree/TypedTreePickle.fs
@@ -1777,7 +1777,7 @@ let p_istype x st =
| ModuleOrType -> p_byte 1 st
| Namespace _ -> p_byte 2 st
-let p_cpath (CompPath(a, b)) st =
+let p_cpath (CompPath(a, _, b)) st =
p_tup2 p_ILScopeRef (p_list (p_tup2 p_string p_istype)) (a, b) st
let u_ranges st = u_option (u_tup2 u_range u_range) st
@@ -1792,7 +1792,7 @@ let u_istype st =
let u_cpath st =
let a, b = u_tup2 u_ILScopeRef (u_list (u_tup2 u_string u_istype)) st
- CompPath(a, b)
+ CompPath(a, SyntaxAccess.Unknown, b)
let rec p_tycon_repr x st =
// The leading "p_byte 1" and "p_byte 0" come from the F# 2.0 format, which used an option value at this point.
diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf
index d4142d783fa..875c2a1e4b2 100644
--- a/src/Compiler/xlf/FSComp.txt.cs.xlf
+++ b/src/Compiler/xlf/FSComp.txt.cs.xlf
@@ -827,6 +827,11 @@
Název výstupního souboru pdb se nemůže shodovat s výstupním názvem souboru sestavení pomocí --pdb:filename.pdb.
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
Vytvoří referenční sestavení místo úplného sestavení jako primární výstup.
@@ -6217,11 +6222,6 @@
Hodnota {0} má označení inline, ale není svázaná s prostředím optimalizace.
-
- Local value {0} not found during optimization
- Lokální hodnota {0} se během optimalizace nenašla.
-
-
A value marked as 'inline' has an unexpected value
Hodnota s označením inline má neočekávanou hodnotu.
diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf
index fa0904ef50f..7f878306f1f 100644
--- a/src/Compiler/xlf/FSComp.txt.de.xlf
+++ b/src/Compiler/xlf/FSComp.txt.de.xlf
@@ -827,6 +827,11 @@
Der Name der PDB-Ausgabedatei kann nicht mit dem Ausgabedateinamen für den Build übereinstimmen, verwenden Sie --pdb:filename.pdb
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
Erstellen einer Referenzassembly anstelle einer vollständigen Assembly als primäre Ausgabe
@@ -6217,11 +6222,6 @@
Der Wert "{0}" war als inline markiert, aber nicht in der Optimierungsumgebung gebunden.
-
- Local value {0} not found during optimization
- Der lokale Wert "{0}" wurde während der Optimierung nicht gefunden.
-
-
A value marked as 'inline' has an unexpected value
Ein als "inline" markierter Wert hat einen unerwarteten Wert.
diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf
index 2d5ada63574..23f6709525f 100644
--- a/src/Compiler/xlf/FSComp.txt.es.xlf
+++ b/src/Compiler/xlf/FSComp.txt.es.xlf
@@ -827,6 +827,11 @@
El nombre del archivo de salida pdb no puede coincidir con el nombre de archivo de salida de compilación. Use --pdb:filename.pdb
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
Generar un ensamblado de referencia, en lugar de un ensamblado completo, como salida principal
@@ -6217,11 +6222,6 @@
El valor '{0}' estaba marcado como inline pero no estaba enlazado en el entorno de optimización.
-
- Local value {0} not found during optimization
- No se encontró el valor local {0} durante la optimización.
-
-
A value marked as 'inline' has an unexpected value
Un valor marcado como 'inline' tiene un valor inesperado.
diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf
index da3c6f4b9b6..4777bed5789 100644
--- a/src/Compiler/xlf/FSComp.txt.fr.xlf
+++ b/src/Compiler/xlf/FSComp.txt.fr.xlf
@@ -827,6 +827,11 @@
Le nom du fichier de sortie pdb ne peut pas correspondre au nom de fichier de sortie de build utilisé --pdb:filename.pdb.
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
Produire un assembly de référence, au lieu d’un assembly complet, en tant que sortie principale
@@ -6217,11 +6222,6 @@
La valeur '{0}' a été marquée comme inline mais n'a pas été liée dans l'environnement d'optimisation
-
- Local value {0} not found during optimization
- Valeur locale {0} introuvable durant l'optimisation
-
-
A value marked as 'inline' has an unexpected value
Une valeur marquée comme 'inline' a une valeur inattendue
diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf
index 010e34a81a2..683a5a6cec8 100644
--- a/src/Compiler/xlf/FSComp.txt.it.xlf
+++ b/src/Compiler/xlf/FSComp.txt.it.xlf
@@ -827,6 +827,11 @@
Il nome del file di output pdb non può corrispondere all’uso del nome file di output della compilazione --pdb:filename.pdb
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
Produce un assembly di riferimento, anziché un assembly completo, come output primario
@@ -6217,11 +6222,6 @@
Il valore '{0}' è stato contrassegnato come inline, tuttavia non è stato associato nell'ambiente di ottimizzazione
-
- Local value {0} not found during optimization
- Valore locale {0} non trovato durante l'ottimizzazione
-
-
A value marked as 'inline' has an unexpected value
Valore imprevisto contrassegnato come 'inline'
diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf
index 8a92ac2ea9e..7618f5faa11 100644
--- a/src/Compiler/xlf/FSComp.txt.ja.xlf
+++ b/src/Compiler/xlf/FSComp.txt.ja.xlf
@@ -827,6 +827,11 @@
PDB 出力ファイル名がビルド出力ファイル名と一致しません - --pdb:filename.pdb を使用してください
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
完全なアセンブリではなく、参照アセンブリをプライマリ出力として生成します
@@ -6217,11 +6222,6 @@
値 '{0}' は 'inline' とマークされましたが、最適化環境ではバインドされません
-
- Local value {0} not found during optimization
- 最適化中にローカルの値 {0} が見つかりませんでした
-
-
A value marked as 'inline' has an unexpected value
'inline' とマークされた値に予期しない値が含まれます
diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf
index 51778bd4145..8b2ddd074be 100644
--- a/src/Compiler/xlf/FSComp.txt.ko.xlf
+++ b/src/Compiler/xlf/FSComp.txt.ko.xlf
@@ -827,6 +827,11 @@
pdb 출력 파일 이름은 빌드 출력 파일 이름 사용 --pdb:filename.pdb와 일치할 수 없습니다.
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
주 출력으로 전체 어셈블리 대신 참조 어셈블리를 생성합니다.
@@ -6217,11 +6222,6 @@
값 '{0}'이(가) inline으로 표시되었지만 최적화 환경에 바인딩되지 않았습니다.
-
- Local value {0} not found during optimization
- 최적화하는 동안 로컬 값 {0}을(를) 찾을 수 없습니다.
-
-
A value marked as 'inline' has an unexpected value
'inline'으로 표시된 값에 예기치 않은 값이 있습니다.
diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf
index a8a3f05ba9a..43f58a77a97 100644
--- a/src/Compiler/xlf/FSComp.txt.pl.xlf
+++ b/src/Compiler/xlf/FSComp.txt.pl.xlf
@@ -827,6 +827,11 @@
Nazwa pliku wyjściowego pdb nie może być zgodna z nazwą pliku wyjściowego kompilacji, użyj parametru --pdb:filename.pdb
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
Utwórz zestaw odwołania zamiast pełnego zestawu jako podstawowe dane wyjściowe
@@ -6217,11 +6222,6 @@
Wartość „{0}” została oznaczona jako śródwierszowa, ale nie powiązano jej w środowisku optymalizacji
-
- Local value {0} not found during optimization
- Nie znaleziono wartości lokalnej {0} podczas optymalizacji
-
-
A value marked as 'inline' has an unexpected value
Wartość oznaczona jako „inline” ma nieoczekiwaną wartość
diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf
index 1f62f9a3d04..f3e8b583783 100644
--- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf
+++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf
@@ -827,6 +827,11 @@
O nome do arquivo de saída pdb não pode corresponder ao nome do arquivo de saída do build. Use --pdb:filename.pdb
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
Produzir um assembly de referência, em vez de um assembly completo, como a saída primária
@@ -6217,11 +6222,6 @@
O valor '{0}' foi marcado como embutido, mas não está associado no ambiente de otimização
-
- Local value {0} not found during optimization
- O valor local {0} não foi encontrado durante a otimização
-
-
A value marked as 'inline' has an unexpected value
Um valor marcado como 'embutido' possui um valor inesperado
diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf
index 64ce92b6125..d6f3358a690 100644
--- a/src/Compiler/xlf/FSComp.txt.ru.xlf
+++ b/src/Compiler/xlf/FSComp.txt.ru.xlf
@@ -827,6 +827,11 @@
Имя выходного файла pdb не может совпадать с именем выходного файла сборки. Используйте --pdb:filename.pdb
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
Создайте базовую сборку вместо полной сборки в качестве основных выходных данных
@@ -6217,11 +6222,6 @@
Значение "{0}" отмечено как "inline", однако не было привязано в среде оптимизации
-
- Local value {0} not found during optimization
- В процессе оптимизации не найдено локальное значение {0}
-
-
A value marked as 'inline' has an unexpected value
Недопустимое значение для значения, отмеченного как "inline"
diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf
index d77dfd672ec..2f313d8c492 100644
--- a/src/Compiler/xlf/FSComp.txt.tr.xlf
+++ b/src/Compiler/xlf/FSComp.txt.tr.xlf
@@ -827,6 +827,11 @@
pdb çıkış dosyası adı, derleme çıkış dosya adı kullanımı --pdb:filename.pdb ile eşleşmiyor
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
Birincil çıktı olarak, tam bir derleme yerine, başvuru bütünleştirilmiş kodu üretin
@@ -6217,11 +6222,6 @@
'{0}' değeri satır içi olarak işaretlenmiş ancak iyileştirme ortamında bağlanmamış
-
- Local value {0} not found during optimization
- İyileştirme sırasında {0} yerel değeri bulunamadı
-
-
A value marked as 'inline' has an unexpected value
'inline' olarak işaretlenmiş değerde beklenmeyen bir değer var
diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf
index 5393d25202a..d115f81d27e 100644
--- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf
+++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf
@@ -827,6 +827,11 @@
pdb 输出文件名不能与生成输出文件名 use --pdb: filename.pdb 匹配
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
生成引用程序集而不是完整程序集作为主输出
@@ -6217,11 +6222,6 @@
值“{0}”已标记为“inline”,但其未在优化环境中绑定
-
- Local value {0} not found during optimization
- 优化过程中未找到本地值 {0}
-
-
A value marked as 'inline' has an unexpected value
标记为“inline”的值具有意外的值
diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf
index f75fc155fde..2dadd07ff73 100644
--- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf
+++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf
@@ -827,6 +827,11 @@
pdb 輸出檔案名與使用 --pdb:filename.pdb 的建置輸出檔案名不相符
+
+ Generate assembly with IL visibility that matches the source code visibility
+ Generate assembly with IL visibility that matches the source code visibility
+
+
Produce a reference assembly, instead of a full assembly, as the primary output
產生參考組件,而非完整組件作為主要輸出
@@ -6217,11 +6222,6 @@
值 '{0}' 已標記為內嵌,但是未在最佳化環境中繫結
-
- Local value {0} not found during optimization
- 最佳化期間找不到區域數值 {0}
-
-
A value marked as 'inline' has an unexpected value
標記為 'inline' 的值有未預期的值
diff --git a/src/FSharp.Core/FSharp.Core.fsproj b/src/FSharp.Core/FSharp.Core.fsproj
index cf267f6f914..c2ad1d456a3 100644
--- a/src/FSharp.Core/FSharp.Core.fsproj
+++ b/src/FSharp.Core/FSharp.Core.fsproj
@@ -25,10 +25,11 @@
$(OtherFlags) --nowarn:3513
$(OtherFlags) --compiling-fslib --compiling-fslib-40 --maxerrors:100 --extraoptimizationloops:1
+
+ $(OtherFlags) --realsig-
true
true
-
true
FSharp.Core
$(FSCorePackageVersion)
diff --git a/src/FSharp.Core/array.fs b/src/FSharp.Core/array.fs
index a2797467b7c..344d7e3e7cf 100644
--- a/src/FSharp.Core/array.fs
+++ b/src/FSharp.Core/array.fs
@@ -2,6 +2,8 @@
namespace Microsoft.FSharp.Collections
+//#nowarn "1118" // 'Make' marked 'inline', perhaps because a recursive value was marked 'inline'
+
open System
open System.Diagnostics
open System.Collections.Generic
@@ -2081,10 +2083,10 @@ module Array =
// The following two parameters were benchmarked and found to be optimal.
// Benchmark was run using: 11th Gen Intel Core i9-11950H 2.60GHz, 1 CPU, 16 logical and 8 physical cores
- let private maxPartitions = Environment.ProcessorCount // The maximum number of partitions to use
- let private minChunkSize = 256 // The minimum size of a chunk to be sorted in parallel
+ let maxPartitions = Environment.ProcessorCount // The maximum number of partitions to use
+ let minChunkSize = 256 // The minimum size of a chunk to be sorted in parallel
- let private createPartitionsUpToWithMinChunkSize maxIdxExclusive minChunkSize (array: 'T array) =
+ let createPartitionsUpToWithMinChunkSize maxIdxExclusive minChunkSize (array: 'T array) =
[|
let chunkSize =
match maxIdxExclusive with
@@ -2101,7 +2103,7 @@ module Array =
yield new ArraySegment<'T>(array, offset, maxIdxExclusive - offset)
|]
- let private createPartitionsUpTo maxIdxExclusive (array: 'T array) =
+ let createPartitionsUpTo maxIdxExclusive (array: 'T array) =
createPartitionsUpToWithMinChunkSize maxIdxExclusive minChunkSize array
(* This function is there also as a support vehicle for other aggregations.
diff --git a/src/FSharp.Core/fslib-extra-pervasives.fs b/src/FSharp.Core/fslib-extra-pervasives.fs
index def5d42c2e5..b62d5b16eb8 100644
--- a/src/FSharp.Core/fslib-extra-pervasives.fs
+++ b/src/FSharp.Core/fslib-extra-pervasives.fs
@@ -13,6 +13,7 @@ module ExtraTopLevelOperators =
open Microsoft.FSharp.Core.Operators
open Microsoft.FSharp.Collections
open Microsoft.FSharp.Control
+ open Microsoft.FSharp.Linq
open Microsoft.FSharp.Primitives.Basics
open Microsoft.FSharp.Core.CompilerServices
@@ -334,7 +335,7 @@ module ExtraTopLevelOperators =
let (|Lazy|) (input: Lazy<_>) =
input.Force()
- let query = Microsoft.FSharp.Linq.QueryBuilder()
+ let query = QueryBuilder()
namespace Microsoft.FSharp.Core.CompilerServices
diff --git a/src/FSharp.Core/fslib-extra-pervasives.fsi b/src/FSharp.Core/fslib-extra-pervasives.fsi
index bd4bf0ee8b5..ffd6f6f6a00 100644
--- a/src/FSharp.Core/fslib-extra-pervasives.fsi
+++ b/src/FSharp.Core/fslib-extra-pervasives.fsi
@@ -13,6 +13,8 @@ module ExtraTopLevelOperators =
open Microsoft.FSharp.Core
open Microsoft.FSharp.Control
open Microsoft.FSharp.Collections
+ open Microsoft.FSharp.Control
+ open Microsoft.FSharp.Linq
open Microsoft.FSharp.Quotations
/// Print to stdout using the given format.
@@ -129,7 +131,7 @@ module ExtraTopLevelOperators =
///
///
[]
- val async: Microsoft.FSharp.Control.AsyncBuilder
+ val async: AsyncBuilder
/// Converts the argument to 32-bit float.
///
@@ -358,7 +360,7 @@ module ExtraTopLevelOperators =
///
/// Evaluates to [4; 4; 12; 12].
///
- val query: Microsoft.FSharp.Linq.QueryBuilder
+ val query: QueryBuilder
namespace Microsoft.FSharp.Core.CompilerServices
diff --git a/src/FSharp.Core/printf.fs b/src/FSharp.Core/printf.fs
index 7afcce1e66b..a326492c672 100644
--- a/src/FSharp.Core/printf.fs
+++ b/src/FSharp.Core/printf.fs
@@ -546,7 +546,7 @@ module internal PrintfImpl =
/// A wrapper struct used to slightly strengthen the types of "ValueConverter" objects produced during composition of
/// the dynamic implementation. These are always functions but sometimes they take one argument, sometimes two.
[]
- type ValueConverter private (f: obj) =
+ type ValueConverter internal (f: obj) =
member x.FuncObj = f
static member inline Make (f: obj -> string) = ValueConverter(box f)
@@ -981,9 +981,9 @@ module internal PrintfImpl =
let defaultFormat = getFormatForFloat spec.TypeChar DefaultPrecision
FloatAndDecimal.withPadding spec (getFormatForFloat spec.TypeChar) defaultFormat
- let private NonPublicStatics = BindingFlags.NonPublic ||| BindingFlags.Static
+ let private AllStatics = BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Static
- let mi_GenericToString = typeof.GetMethod("GenericToString", NonPublicStatics)
+ let mi_GenericToString = typeof.GetMethod("GenericToString", AllStatics)
let private getValueConverter (ty: Type) (spec: FormatSpecifier) : ValueConverter =
match spec.TypeChar with
@@ -1103,7 +1103,7 @@ module internal PrintfImpl =
// %a has an existential type which must be converted to obj
assert (argTys.Length = 2)
let captureMethName = "CaptureLittleA"
- let mi = typeof>.GetMethod(captureMethName, NonPublicStatics)
+ let mi = typeof>.GetMethod(captureMethName, AllStatics)
let mi = mi.MakeGenericMethod([| argTys.[1]; retTy |])
let factoryObj = mi.Invoke(null, [| next |])
factoryObj, false, argTys, retTy, None
@@ -1115,20 +1115,20 @@ module internal PrintfImpl =
match nextNextOpt with
| None ->
let captureMethName = "CaptureFinal" + string captureCount
- let mi = typeof>.GetMethod(captureMethName, NonPublicStatics)
+ let mi = typeof>.GetMethod(captureMethName, AllStatics)
let mi = mi.MakeGenericMethod(combinedArgTys)
let factoryObj = mi.Invoke(null, [| allSteps |])
factoryObj, true, combinedArgTys, nextRetTy, None
| Some nextNext ->
let captureMethName = "Capture" + string captureCount
- let mi = typeof>.GetMethod(captureMethName, NonPublicStatics)
+ let mi = typeof>.GetMethod(captureMethName, AllStatics)
let mi = mi.MakeGenericMethod(Array.append combinedArgTys [| nextRetTy |])
let factoryObj = mi.Invoke(null, [| nextNext |])
factoryObj, true, combinedArgTys, nextRetTy, nextNextOpt
| captureCount, _ ->
let captureMethName = "Capture" + string captureCount
- let mi = typeof>.GetMethod(captureMethName, NonPublicStatics)
+ let mi = typeof>.GetMethod(captureMethName, AllStatics)
let mi = mi.MakeGenericMethod(Array.append argTys [| retTy |])
let factoryObj = mi.Invoke(null, [| next |])
factoryObj, true, argTys, retTy, Some next
@@ -1277,7 +1277,7 @@ module internal PrintfImpl =
// If there is one simple format specifier then we can create an even better factory function
| [| StepWithArg (prefix1, conv1); StepString prefix2 |] ->
let captureMethName = "OneStepWithArg"
- let mi = typeof>.GetMethod(captureMethName, NonPublicStatics)
+ let mi = typeof>.GetMethod(captureMethName, AllStatics)
let mi = mi.MakeGenericMethod(combinedArgTys)
let factoryObj = mi.Invoke(null, [| box prefix1; box conv1; box prefix2 |])
factoryObj
@@ -1285,7 +1285,7 @@ module internal PrintfImpl =
// If there are two simple format specifiers then we can create an even better factory function
| [| StepWithArg (prefix1, conv1); StepWithArg (prefix2, conv2); StepString prefix3 |] ->
let captureMethName = "TwoStepWithArg"
- let mi = typeof>.GetMethod(captureMethName, NonPublicStatics)
+ let mi = typeof>.GetMethod(captureMethName, AllStatics)
let mi = mi.MakeGenericMethod(combinedArgTys)
let factoryObj = mi.Invoke(null, [| box prefix1; box conv1; box prefix2; box conv2; box prefix3 |])
factoryObj
diff --git a/tests/AheadOfTime/Trimming/check.ps1 b/tests/AheadOfTime/Trimming/check.ps1
index 8528710b76f..1dcdf28f8af 100644
--- a/tests/AheadOfTime/Trimming/check.ps1
+++ b/tests/AheadOfTime/Trimming/check.ps1
@@ -41,5 +41,5 @@ function CheckTrim($root, $tfm, $outputfile, $expected_len) {
# Check net7.0 trimmed assemblies
CheckTrim -root "SelfContained_Trimming_Test" -tfm "net8.0" -outputfile "FSharp.Core.dll" -expected_len 287232
-# Check net7.0 trimmed assemblies
+# Check net8.0 trimmed assemblies
CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net8.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 8820736
diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl
index 2e064aacf82..8e207799112 100644
--- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl
+++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl
@@ -59,6 +59,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved.
--tailcalls[+|-] Enable or disable tailcalls
--deterministic[+|-] Produce a deterministic assembly (including module version GUID and
timestamp)
+--realsig[+|-] Generate assembly with IL visibility that matches the source code visibility
--pathmap: Maps physical paths to source path names output by the compiler
--crossoptimize[+|-] Enable or disable cross-module optimizations
--reflectionfree Disable implicit generation of constructs using reflection
diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs
index c7861ee3e56..b9d20fe0caf 100644
--- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs
+++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs
@@ -34,7 +34,7 @@ module CustomAttributes_AttributeUsage =
|> verifyCompileAndRun
|> shouldSucceed
- // SOURCE=AssemblyVersion03.fs # AssemblyVersion03.fs
+ // SOURCE=AssemblyVersion03.fs # AssemblyVersion03.fs
[]
let ``AssemblyVersion03_fs`` compilation =
compilation
diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution.fs
index 3ac3d49ce4b..f6145c01abc 100644
--- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution.fs
+++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution.fs
@@ -34,7 +34,7 @@ if returnvalue2<> true && value2 <> 7 then
|> ignore
[]
- let ``Method with optional and out parameters resolves correctly (verify IL)`` () =
+ let ``Method with optional and out parameters resolves correctly withRealInternalSignatureOff (verify IL)`` () =
FSharp """
module OutOptionalTests
open System.Runtime.InteropServices
@@ -47,6 +47,7 @@ let (_:bool), (_:int) = Thing.Do(i = 42)
let (_:bool), (_:int) = Thing.Do()
"""
|> ignoreWarnings
+ |> withRealInternalSignatureOff
|> compile
|> shouldSucceed
|> verifyIL [
@@ -203,6 +204,195 @@ extends [runtime]System.Object
}
"""]
+ []
+ let ``Method with optional and out parameters resolves correctly withRealInternalSignatureOn (verify IL)`` () =
+ FSharp """
+module OutOptionalTests
+open System.Runtime.InteropServices
+
+type Thing =
+ static member Do(o: outref, []i: int) =
+ o <- i
+ i = 7
+let (_:bool), (_:int) = Thing.Do(i = 42)
+let (_:bool), (_:int) = Thing.Do()
+ """
+ |> ignoreWarnings
+ |> withRealInternalSignatureOn
+ |> compile
+ |> shouldSucceed
+ |> verifyIL [
+ """
+.class public abstract auto ansi sealed OutOptionalTests
+ extends [runtime]System.Object
+{
+ .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 )
+ .class auto ansi serializable nested public Thing
+ extends [runtime]System.Object
+ {
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 )
+ .method public static bool Do([out] int32& o,
+ [opt] int32 i) cil managed
+ {
+ .param [2] = int32(0x00000001)
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: stobj [runtime]System.Int32
+ IL_0007: ldarg.1
+ IL_0008: ldc.i4.7
+ IL_0009: ceq
+ IL_000b: ret
+ }
+
+ }
+
+ .field static assembly class [runtime]System.Tuple`2 patternInput@9
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .field static assembly int32 outArg@9
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .field static assembly class [runtime]System.Tuple`2 'patternInput@10-1'
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .field static assembly int32 'outArg@10-1'
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .method assembly specialname static class [runtime]System.Tuple`2 get_patternInput@9() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldsfld class [runtime]System.Tuple`2 OutOptionalTests::patternInput@9
+ IL_0005: ret
+ }
+
+ .method assembly specialname static int32 get_outArg@9() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldsfld int32 OutOptionalTests::outArg@9
+ IL_0005: ret
+ }
+
+ .method assembly specialname static void set_outArg@9(int32 'value') cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: stsfld int32 OutOptionalTests::outArg@9
+ IL_0006: ret
+ }
+
+ .method assembly specialname static class [runtime]System.Tuple`2 'get_patternInput@10-1'() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldsfld class [runtime]System.Tuple`2 OutOptionalTests::'patternInput@10-1'
+ IL_0005: ret
+ }
+
+ .method assembly specialname static int32 'get_outArg@10-1'() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldsfld int32 OutOptionalTests::'outArg@10-1'
+ IL_0005: ret
+ }
+
+ .method assembly specialname static void 'set_outArg@10-1'(int32 'value') cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: stsfld int32 OutOptionalTests::'outArg@10-1'
+ IL_0006: ret
+ }
+
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$OutOptionalTests::init@
+ IL_0006: ldsfld int32 ''.$OutOptionalTests::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 4
+ .locals init (int32& V_0)
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 OutOptionalTests::outArg@9
+ IL_0006: ldsflda int32 OutOptionalTests::outArg@9
+ IL_000b: stloc.0
+ IL_000c: ldloc.0
+ IL_000d: ldc.i4.s 42
+ IL_000f: stobj [runtime]System.Int32
+ IL_0014: ldc.i4.0
+ IL_0015: call int32 OutOptionalTests::get_outArg@9()
+ IL_001a: newobj instance void class [runtime]System.Tuple`2::.ctor(!0,
+ !1)
+ IL_001f: stsfld class [runtime]System.Tuple`2 OutOptionalTests::patternInput@9
+ IL_0024: ldc.i4.0
+ IL_0025: stsfld int32 OutOptionalTests::'outArg@10-1'
+ IL_002a: ldsflda int32 OutOptionalTests::'outArg@10-1'
+ IL_002f: stloc.0
+ IL_0030: ldloc.0
+ IL_0031: ldc.i4.1
+ IL_0032: stobj [runtime]System.Int32
+ IL_0037: ldc.i4.0
+ IL_0038: call int32 OutOptionalTests::'get_outArg@10-1'()
+ IL_003d: newobj instance void class [runtime]System.Tuple`2::.ctor(!0,
+ !1)
+ IL_0042: stsfld class [runtime]System.Tuple`2 OutOptionalTests::'patternInput@10-1'
+ IL_0047: ret
+ }
+
+ .property class [runtime]System.Tuple`2
+ patternInput@9()
+ {
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 )
+ .get class [runtime]System.Tuple`2 OutOptionalTests::get_patternInput@9()
+ }
+ .property int32 outArg@9()
+ {
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 )
+ .set void OutOptionalTests::set_outArg@9(int32)
+ .get int32 OutOptionalTests::get_outArg@9()
+ }
+ .property class [runtime]System.Tuple`2
+ 'patternInput@10-1'()
+ {
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 )
+ .get class [runtime]System.Tuple`2 OutOptionalTests::'get_patternInput@10-1'()
+ }
+ .property int32 'outArg@10-1'()
+ {
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 )
+ .set void OutOptionalTests::'set_outArg@10-1'(int32)
+ .get int32 OutOptionalTests::'get_outArg@10-1'()
+ }
+}
+
+.class private abstract auto ansi sealed ''.$OutOptionalTests
+ extends [runtime]System.Object
+{
+ .field static assembly int32 init@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: call void OutOptionalTests::staticInitialization@()
+ IL_0005: ret
+ }
+
+}
+ """]
+
[]
let ``Method with optional and out parameters resolves correctly (examples from original issue: https://github.com/dotnet/fsharp/issues/12515)`` () =
Fsx """
diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecords.fs
index 32e090ebdbf..4facec5630e 100644
--- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecords.fs
+++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecords.fs
@@ -7,7 +7,7 @@ type MyRecord<'T> =
}
static let sizeOfT = sizeof<'T>
- static let cachedVal =
+ static let cachedVal =
printfn "Creating cached val for %s" (typeof<'T>.Name)
{ X = Unchecked.defaultof<'T> ; Y = 15}
static let mutable perTyparInstMutableCounter = 0
diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecordsILtest.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecordsILtest.fs
index 738bd09f0fd..ef2414db2ed 100644
--- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecordsILtest.fs
+++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInGenericRecordsILtest.fs
@@ -9,7 +9,7 @@ type MyRecord<'T> =
X: 'T
}
// Init per typar
- static let cachedVal =
+ static let cachedVal =
Console.WriteLine(typeof<'T>.Name)
typeof<'T>.Name
diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs
index 257fb1eeab3..17c7c03c808 100644
--- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs
+++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs
@@ -396,7 +396,7 @@ Case2 1"""
[]
-let ``Static let IL init single file test`` () =
+let ``Static let IL init single file test withRealInternalSignatureOff`` () =
FSharp """
module Test
open System
@@ -408,6 +408,7 @@ type X =
do Console.WriteLine("module after type")
"""
|> withLangVersion80
+ |> withRealInternalSignatureOff
|> compile
|> shouldSucceed
|> verifyIL ["""
@@ -461,7 +462,99 @@ do Console.WriteLine("module after type")
}"""]
[]
-let ``Static let in penultimate file IL test`` () =
+let ``Static let IL init single file test withRealInternalSignatureOn`` () =
+ FSharp """
+module Test
+open System
+
+do Console.WriteLine("module before type")
+[]
+type X =
+ static do Console.WriteLine("from type")
+do Console.WriteLine("module after type")
+"""
+ |> withLangVersion80
+ |> withRealInternalSignatureOn
+ |> compile
+ |> shouldSucceed
+ |> verifyIL ["""
+.class public abstract auto ansi sealed Test
+ extends [runtime]System.Object
+{
+ .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 )
+ .class auto ansi serializable nested public X
+ extends [runtime]System.Object
+ {
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 )
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$Test::init@
+ IL_0006: ldsfld int32 ''.$Test::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldstr "from type"
+ IL_0005: call void [runtime]System.Console::WriteLine(string)
+ IL_000a: ret
+ }
+
+ }
+
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$Test::init@
+ IL_0006: ldsfld int32 ''.$Test::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldstr "module before type"
+ IL_0005: call void [runtime]System.Console::WriteLine(string)
+ IL_000a: call void Test/X::staticInitialization@()
+ IL_000f: ldstr "module after type"
+ IL_0014: call void [runtime]System.Console::WriteLine(string)
+ IL_0019: ret
+ }
+
+}
+
+.class private abstract auto ansi sealed ''.$Test
+ extends [runtime]System.Object
+{
+ .field static assembly int32 init@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: call void Test::staticInitialization@()
+ IL_0005: ret
+ }
+
+}
+"""]
+
+[]
+let ``Static let in penultimate file IL test withRealInternalSignatureOff`` () =
let types = """
namespace MyTypes
open System
@@ -483,6 +576,7 @@ Console.Write(MyTypes.X.GetX)
FSharp types
|> withAdditionalSourceFiles [SourceCodeFileKind.Create("program.fs", program)]
|> withLangVersion80
+ |> withRealInternalSignatureOff
|> compile
|> shouldSucceed
|> verifyIL ["""
@@ -578,6 +672,148 @@ Console.Write(MyTypes.X.GetX)
}"""]
+[]
+let ``Static let in penultimate file IL test withRealInternalSignatureOn`` () =
+ let types = """
+namespace MyTypes
+open System
+
+[]
+type X =
+ static do Console.WriteLine("from type")
+ static let mutable x_value = 42
+ static member GetX = x_value
+
+"""
+
+ let program = """
+module ProgramMain
+open System
+Console.Write(MyTypes.X.GetX)
+"""
+
+ FSharp types
+ |> withAdditionalSourceFiles [SourceCodeFileKind.Create("program.fs", program)]
+ |> withLangVersion80
+ |> withRealInternalSignatureOn
+ |> compile
+ |> shouldSucceed
+ |> verifyIL ["""
+.class public auto ansi serializable MyTypes.X
+ extends [runtime]System.Object
+{
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 )
+ .field static assembly int32 x_value
+ .field static assembly int32 init@6
+ .method public specialname static int32 get_GetX() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: volatile.
+ IL_0002: ldsfld int32 MyTypes.X::init@6
+ IL_0007: ldc.i4.0
+ IL_0008: bge.s IL_0011
+
+ IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit()
+ IL_000f: br.s IL_0011
+
+ IL_0011: ldsfld int32 MyTypes.X::x_value
+ IL_0016: ret
+ }
+
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$Test::init@
+ IL_0006: ldsfld int32 ''.$Test::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldstr "from type"
+ IL_0005: call void [runtime]System.Console::WriteLine(string)
+ IL_000a: ldc.i4.s 42
+ IL_000c: stsfld int32 MyTypes.X::x_value
+ IL_0011: ldc.i4.0
+ IL_0012: volatile.
+ IL_0014: stsfld int32 MyTypes.X::init@6
+ IL_0019: ret
+ }
+
+ .property int32 GetX()
+ {
+ .get int32 MyTypes.X::get_GetX()
+ }
+}
+
+.class public abstract auto ansi sealed ProgramMain
+ extends [runtime]System.Object
+{
+ .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 private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$ProgramMain::init@
+ IL_0006: ldsfld int32 ''.$ProgramMain::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: call int32 MyTypes.X::get_GetX()
+ IL_0005: call void [runtime]System.Console::Write(int32)
+ IL_000a: ret
+ }
+
+}
+
+.class private abstract auto ansi sealed ''.$ProgramMain
+ extends [runtime]System.Object
+{
+ .field static assembly int32 init@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: call void ProgramMain::staticInitialization@()
+ IL_0005: ret
+ }
+
+}
+
+.class private abstract auto ansi sealed ''.$Test
+ extends [runtime]System.Object
+{
+ .field static assembly int32 init@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: call void MyTypes.X::staticInitialization@()
+ IL_0005: ret
+ }
+"""]
+
+
[]
[]
let ``Regression 16009 - module rec does not initialize let bindings`` langVersion =
diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs
index 52bf8601869..9b9beecfdb0 100644
--- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs
+++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs
@@ -49,7 +49,7 @@ module RecursiveSafetyAnalysis =
(Error 1114, Line 8, Col 15, Line 8, Col 25, "The value 'E_RecursiveInline.test' was marked inline but was not bound in the optimization environment")
(Error 1113, Line 7, Col 16, Line 7, Col 20, "The value 'test' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible")
(Warning 1116, Line 8, Col 15, Line 8, Col 25, "A value marked as 'inline' has an unexpected value")
- (Error 1118, Line 8, Col 15, Line 8, Col 25, "Failed to inline the value 'test' marked 'inline', perhaps because a recursive value was marked 'inline'")
+ (Warning 1118, Line 8, Col 15, Line 8, Col 25, "Failed to inline the value 'test' marked 'inline', perhaps because a recursive value was marked 'inline'")
]
// SOURCE=E_TypeDeclaration01.fs SCFLAGS="--langversion:5.0 --test:ErrorRanges" COMPILE_ONLY=1 # E_TypeDeclaration01.fs
diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionStepping.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionStepping.fs
index 9f5b523b944..89c1c62c7c0 100644
--- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionStepping.fs
+++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionStepping.fs
@@ -1,4 +1,4 @@
-namespace EmittedIL
+namespace EmittedIL.RealInternalSignature
open Xunit
open FSharp.Test
@@ -17,28 +17,74 @@ module AsyncExpressionStepping =
|> verifyBaseline
|> verifyILBaseline
- []
- let ``AsyncExpressionSteppingTest1_fs`` compilation =
- verifyCompilation compilation
+ []
+ let ``AsyncExpressionSteppingTest1_RealInternalSignatureOn_fs`` compilation =
+ compilation
+ |> withRealInternalSignatureOn
+ |> verifyCompilation
+
+ []
+ let ``AsyncExpressionSteppingTest1_RealInternalSignatureOff_fs`` compilation =
+ compilation
+ |> withRealInternalSignatureOff
+ |> verifyCompilation
+
+ []
+ let ``AsyncExpressionSteppingTest2_RealInternalSignatureOnfs`` compilation =
+ compilation
+ |> withRealInternalSignatureOn
+ |> verifyCompilation
+
+ []
+ let ``AsyncExpressionSteppingTest2_RealInternalSignatureOff_fs`` compilation =
+ compilation
+ |> withRealInternalSignatureOff
+ |> verifyCompilation
+
+ []
+ let ``AsyncExpressionSteppingTest3_RealInternalSignatureOn_fs`` compilation =
+ compilation
+ |> withRealInternalSignatureOn
+ |> verifyCompilation
- []
- let ``AsyncExpressionSteppingTest2_fs`` compilation =
- verifyCompilation compilation
+ []
+ let ``AsyncExpressionSteppingTest3_RealInternalSignatureOff_fs`` compilation =
+ compilation
+ |> withRealInternalSignatureOff
+ |> verifyCompilation
- []
- let ``AsyncExpressionSteppingTest3_fs`` compilation =
- verifyCompilation compilation
+ []
+ let ``AsyncExpressionSteppingTest4_RealInternalSignatureOn_fs`` compilation =
+ compilation
+ |> withRealInternalSignatureOn
+ |> verifyCompilation
- []
- let ``AsyncExpressionSteppingTest4_fs`` compilation =
- verifyCompilation compilation
+ []
+ let ``AsyncExpressionSteppingTest4_RealInternalSignatureOff_fs`` compilation =
+ compilation
+ |> withRealInternalSignatureOff
+ |> verifyCompilation
- []
- let ``AsyncExpressionSteppingTest5_fs`` compilation =
- verifyCompilation compilation
+ []
+ let ``AsyncExpressionSteppingTest5_RealInternalSignatureOn_fs`` compilation =
+ compilation
+ |> withRealInternalSignatureOn
+ |> verifyCompilation
- []
- let ``AsyncExpressionSteppingTest6_fs`` compilation =
- verifyCompilation compilation
+ []
+ let ``AsyncExpressionSteppingTest5_RealInternalSignatureOff_fs`` compilation =
+ compilation
+ |> withRealInternalSignatureOff
+ |> verifyCompilation
+ []
+ let ``AsyncExpressionSteppingTest6_RealInternalSignatureOn_fs`` compilation =
+ compilation
+ |> withRealInternalSignatureOn
+ |> verifyCompilation
+ []
+ let ``AsyncExpressionSteppingTest6_RealInternalSignatureOff_fs`` compilation =
+ compilation
+ |> withRealInternalSignatureOff
+ |> verifyCompilation
diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.debug.bsl
similarity index 100%
rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.il.debug.bsl
rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.debug.bsl
diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.release.bsl
similarity index 100%
rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.il.release.bsl
rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.release.bsl
diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.debug.bsl
new file mode 100644
index 00000000000..b8ab856f75a
--- /dev/null
+++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.debug.bsl
@@ -0,0 +1,186 @@
+
+
+
+
+
+.assembly extern runtime { }
+.assembly extern FSharp.Core { }
+.assembly assembly
+{
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
+ int32,
+ int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
+
+
+
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.mresource public FSharpSignatureData.assembly
+{
+
+
+}
+.mresource public FSharpOptimizationData.assembly
+{
+
+
+}
+.module assembly.dll
+
+.imagebase {value}
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003
+.corflags 0x00000001
+
+
+
+
+
+.class public abstract auto ansi sealed assembly
+ extends [runtime]System.Object
+{
+ .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 )
+ .class abstract auto ansi sealed nested public assembly
+ extends [runtime]System.Object
+ {
+ .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 )
+ .class auto ansi serializable sealed nested assembly beforefieldinit f1@6
+ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>
+ {
+ .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@) cil managed
+ {
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f1@6::builder@
+ IL_000d: ret
+ }
+
+ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed
+ {
+
+ .maxstack 8
+ 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)
+ IL_000f: pop
+ IL_0010: ldstr "stuck in the middle"
+ IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string)
+ IL_001a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4)
+ IL_001f: pop
+ IL_0020: ldstr "goodbye"
+ IL_0025: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string)
+ IL_002a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4)
+ IL_002f: pop
+ IL_0030: ldarg.0
+ IL_0031: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f1@6::builder@
+ IL_0036: tail.
+ IL_0038: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Zero()
+ IL_003d: ret
+ }
+
+ }
+
+ .method public static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 f1() cil managed
+ {
+
+ .maxstack 4
+ .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0)
+ IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_DefaultAsyncBuilder()
+ IL_0005: stloc.0
+ IL_0006: ldloc.0
+ IL_0007: ldloc.0
+ IL_0008: newobj instance void assembly/assembly/f1@6::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
+ IL_000d: tail.
+ IL_000f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>)
+ IL_0014: ret
+ }
+
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$assembly::init@
+ IL_0006: ldsfld int32 ''.$assembly::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 5
+ .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_0,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1)
+ IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f1()
+ IL_0005: stloc.0
+ IL_0006: ldloc.0
+ IL_0007: stloc.1
+ IL_0008: ldloc.1
+ IL_0009: ldnull
+ IL_000a: ldnull
+ IL_000b: call !!0 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync::RunSynchronously(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1,
+ class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1,
+ class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1)
+ IL_0010: pop
+ IL_0011: ret
+ }
+
+ }
+
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$assembly::init@
+ IL_0006: ldsfld int32 ''.$assembly::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: call void assembly/assembly::staticInitialization@()
+ IL_0005: ret
+ }
+
+}
+
+.class private abstract auto ansi sealed ''.$assembly
+ extends [runtime]System.Object
+{
+ .field static assembly int32 init@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: call void assembly::staticInitialization@()
+ IL_0005: ret
+ }
+
+}
+
+
+
+
+
+
diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.release.bsl
new file mode 100644
index 00000000000..b8ab856f75a
--- /dev/null
+++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.release.bsl
@@ -0,0 +1,186 @@
+
+
+
+
+
+.assembly extern runtime { }
+.assembly extern FSharp.Core { }
+.assembly assembly
+{
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
+ int32,
+ int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
+
+
+
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.mresource public FSharpSignatureData.assembly
+{
+
+
+}
+.mresource public FSharpOptimizationData.assembly
+{
+
+
+}
+.module assembly.dll
+
+.imagebase {value}
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003
+.corflags 0x00000001
+
+
+
+
+
+.class public abstract auto ansi sealed assembly
+ extends [runtime]System.Object
+{
+ .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 )
+ .class abstract auto ansi sealed nested public assembly
+ extends [runtime]System.Object
+ {
+ .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 )
+ .class auto ansi serializable sealed nested assembly beforefieldinit f1@6
+ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>
+ {
+ .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@) cil managed
+ {
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f1@6::builder@
+ IL_000d: ret
+ }
+
+ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed
+ {
+
+ .maxstack 8
+ 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)
+ IL_000f: pop
+ IL_0010: ldstr "stuck in the middle"
+ IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string)
+ IL_001a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4)
+ IL_001f: pop
+ IL_0020: ldstr "goodbye"
+ IL_0025: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string)
+ IL_002a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4)
+ IL_002f: pop
+ IL_0030: ldarg.0
+ IL_0031: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f1@6::builder@
+ IL_0036: tail.
+ IL_0038: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Zero()
+ IL_003d: ret
+ }
+
+ }
+
+ .method public static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 f1() cil managed
+ {
+
+ .maxstack 4
+ .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0)
+ IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_DefaultAsyncBuilder()
+ IL_0005: stloc.0
+ IL_0006: ldloc.0
+ IL_0007: ldloc.0
+ IL_0008: newobj instance void assembly/assembly/f1@6::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
+ IL_000d: tail.
+ IL_000f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>)
+ IL_0014: ret
+ }
+
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$assembly::init@
+ IL_0006: ldsfld int32 ''.$assembly::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 5
+ .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_0,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1)
+ IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f1()
+ IL_0005: stloc.0
+ IL_0006: ldloc.0
+ IL_0007: stloc.1
+ IL_0008: ldloc.1
+ IL_0009: ldnull
+ IL_000a: ldnull
+ IL_000b: call !!0 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync::RunSynchronously(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1,
+ class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1,
+ class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1)
+ IL_0010: pop
+ IL_0011: ret
+ }
+
+ }
+
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$assembly::init@
+ IL_0006: ldsfld int32 ''.$assembly::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: call void assembly/assembly::staticInitialization@()
+ IL_0005: ret
+ }
+
+}
+
+.class private abstract auto ansi sealed ''.$assembly
+ extends [runtime]System.Object
+{
+ .field static assembly int32 init@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: call void assembly::staticInitialization@()
+ IL_0005: ret
+ }
+
+}
+
+
+
+
+
+
diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.debug.bsl
similarity index 100%
rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.il.debug.bsl
rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.debug.bsl
diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.release.bsl
similarity index 100%
rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.il.release.bsl
rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.release.bsl
diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.debug.bsl
new file mode 100644
index 00000000000..39b879bc70a
--- /dev/null
+++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.debug.bsl
@@ -0,0 +1,284 @@
+
+
+
+
+
+.assembly extern runtime { }
+.assembly extern FSharp.Core { }
+.assembly assembly
+{
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
+ int32,
+ int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
+
+
+
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.mresource public FSharpSignatureData.assembly
+{
+
+
+}
+.mresource public FSharpOptimizationData.assembly
+{
+
+
+}
+.module assembly.dll
+
+.imagebase {value}
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003
+.corflags 0x00000001
+
+
+
+
+
+.class public abstract auto ansi sealed assembly
+ extends [runtime]System.Object
+{
+ .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 )
+ .class abstract auto ansi sealed nested public assembly
+ extends [runtime]System.Object
+ {
+ .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 )
+ .class auto ansi serializable sealed nested assembly beforefieldinit 'f2@6-1'
+ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2
+ {
+ .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x
+ .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x) cil managed
+ {
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f2@6-1'::x
+ IL_000d: ret
+ }
+
+ .method public strict virtual instance bool Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f2@6-1'::x
+ IL_0006: callvirt instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_Value()
+ IL_000b: ldc.i4.4
+ IL_000c: clt
+ IL_000e: ret
+ }
+
+ }
+
+ .class auto ansi serializable sealed nested assembly beforefieldinit 'f2@7-2'
+ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>
+ {
+ .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x
+ .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method assembly specialname rtspecialname
+ instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@) cil managed
+ {
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f2@7-2'::x
+ IL_000d: ldarg.0
+ IL_000e: ldarg.2
+ IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f2@7-2'::builder@
+ IL_0014: ret
+ }
+
+ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f2@7-2'::x
+ IL_0006: ldarg.0
+ IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f2@7-2'::x
+ IL_000c: callvirt instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_Value()
+ IL_0011: ldc.i4.1
+ IL_0012: add
+ IL_0013: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_Value(!0)
+ IL_0018: nop
+ IL_0019: ldstr "hello"
+ IL_001e: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string)
+ IL_0023: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4)
+ IL_0028: pop
+ IL_0029: ldarg.0
+ IL_002a: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f2@7-2'::builder@
+ IL_002f: tail.
+ IL_0031: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Zero()
+ IL_0036: ret
+ }
+
+ }
+
+ .class auto ansi serializable sealed nested assembly beforefieldinit f2@6
+ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>
+ {
+ .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x
+ .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method assembly specialname rtspecialname
+ instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@) cil managed
+ {
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/f2@6::x
+ IL_000d: ldarg.0
+ IL_000e: ldarg.2
+ IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@6::builder@
+ IL_0014: ret
+ }
+
+ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed
+ {
+
+ .maxstack 9
+ IL_0000: ldarg.0
+ IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@6::builder@
+ IL_0006: ldarg.0
+ IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/f2@6::x
+ IL_000c: newobj instance void assembly/assembly/'f2@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1)
+ IL_0011: ldarg.0
+ IL_0012: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@6::builder@
+ IL_0017: ldarg.0
+ IL_0018: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/f2@6::x
+ IL_001d: ldarg.0
+ IL_001e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@6::builder@
+ IL_0023: newobj instance void assembly/assembly/'f2@7-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
+ IL_0028: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>)
+ IL_002d: tail.
+ IL_002f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::While(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1)
+ IL_0034: ret
+ }
+
+ }
+
+ .method public static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 f2() cil managed
+ {
+
+ .maxstack 5
+ .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1)
+ IL_0000: ldc.i4.0
+ IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0)
+ IL_0006: stloc.0
+ IL_0007: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_DefaultAsyncBuilder()
+ IL_000c: stloc.1
+ IL_000d: ldloc.1
+ IL_000e: ldloc.0
+ IL_000f: ldloc.1
+ IL_0010: newobj instance void assembly/assembly/f2@6::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
+ IL_0015: tail.
+ IL_0017: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>)
+ IL_001c: ret
+ }
+
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$assembly::init@
+ IL_0006: ldsfld int32 ''.$assembly::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 5
+ .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_0,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1)
+ IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2()
+ IL_0005: stloc.0
+ IL_0006: ldloc.0
+ IL_0007: stloc.1
+ IL_0008: ldloc.1
+ IL_0009: ldnull
+ IL_000a: ldnull
+ IL_000b: call !!0 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync::RunSynchronously(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1,
+ class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1,
+ class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1)
+ IL_0010: pop
+ IL_0011: ret
+ }
+
+ }
+
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$assembly::init@
+ IL_0006: ldsfld int32 ''.$assembly::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: call void assembly/assembly::staticInitialization@()
+ IL_0005: ret
+ }
+
+}
+
+.class private abstract auto ansi sealed ''.$assembly
+ extends [runtime]System.Object
+{
+ .field static assembly int32 init@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: call void assembly::staticInitialization@()
+ IL_0005: ret
+ }
+
+}
+
+
+
+
+
+
diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.release.bsl
new file mode 100644
index 00000000000..39b879bc70a
--- /dev/null
+++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.release.bsl
@@ -0,0 +1,284 @@
+
+
+
+
+
+.assembly extern runtime { }
+.assembly extern FSharp.Core { }
+.assembly assembly
+{
+ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
+ int32,
+ int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
+
+
+
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.mresource public FSharpSignatureData.assembly
+{
+
+
+}
+.mresource public FSharpOptimizationData.assembly
+{
+
+
+}
+.module assembly.dll
+
+.imagebase {value}
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003
+.corflags 0x00000001
+
+
+
+
+
+.class public abstract auto ansi sealed assembly
+ extends [runtime]System.Object
+{
+ .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 )
+ .class abstract auto ansi sealed nested public assembly
+ extends [runtime]System.Object
+ {
+ .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 )
+ .class auto ansi serializable sealed nested assembly beforefieldinit 'f2@6-1'
+ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2
+ {
+ .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x
+ .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x) cil managed
+ {
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f2@6-1'::x
+ IL_000d: ret
+ }
+
+ .method public strict virtual instance bool Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f2@6-1'::x
+ IL_0006: callvirt instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_Value()
+ IL_000b: ldc.i4.4
+ IL_000c: clt
+ IL_000e: ret
+ }
+
+ }
+
+ .class auto ansi serializable sealed nested assembly beforefieldinit 'f2@7-2'
+ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>
+ {
+ .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x
+ .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method assembly specialname rtspecialname
+ instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@) cil managed
+ {
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f2@7-2'::x
+ IL_000d: ldarg.0
+ IL_000e: ldarg.2
+ IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f2@7-2'::builder@
+ IL_0014: ret
+ }
+
+ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f2@7-2'::x
+ IL_0006: ldarg.0
+ IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f2@7-2'::x
+ IL_000c: callvirt instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_Value()
+ IL_0011: ldc.i4.1
+ IL_0012: add
+ IL_0013: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_Value(!0)
+ IL_0018: nop
+ IL_0019: ldstr "hello"
+ IL_001e: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string)
+ IL_0023: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4)
+ IL_0028: pop
+ IL_0029: ldarg.0
+ IL_002a: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f2@7-2'::builder@
+ IL_002f: tail.
+ IL_0031: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Zero()
+ IL_0036: ret
+ }
+
+ }
+
+ .class auto ansi serializable sealed nested assembly beforefieldinit f2@6
+ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>
+ {
+ .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x
+ .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@
+ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+ .method assembly specialname rtspecialname
+ instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@) cil managed
+ {
+ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
+
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/f2@6::x
+ IL_000d: ldarg.0
+ IL_000e: ldarg.2
+ IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@6::builder@
+ IL_0014: ret
+ }
+
+ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed
+ {
+
+ .maxstack 9
+ IL_0000: ldarg.0
+ IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@6::builder@
+ IL_0006: ldarg.0
+ IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/f2@6::x
+ IL_000c: newobj instance void assembly/assembly/'f2@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1)
+ IL_0011: ldarg.0
+ IL_0012: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@6::builder@
+ IL_0017: ldarg.0
+ IL_0018: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/f2@6::x
+ IL_001d: ldarg.0
+ IL_001e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@6::builder@
+ IL_0023: newobj instance void assembly/assembly/'f2@7-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
+ IL_0028: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>)
+ IL_002d: tail.
+ IL_002f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::While(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1)
+ IL_0034: ret
+ }
+
+ }
+
+ .method public static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 f2() cil managed
+ {
+
+ .maxstack 5
+ .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1)
+ IL_0000: ldc.i4.0
+ IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0)
+ IL_0006: stloc.0
+ IL_0007: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_DefaultAsyncBuilder()
+ IL_000c: stloc.1
+ IL_000d: ldloc.1
+ IL_000e: ldloc.0
+ IL_000f: ldloc.1
+ IL_0010: newobj instance void assembly/assembly/f2@6::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
+ IL_0015: tail.
+ IL_0017: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>)
+ IL_001c: ret
+ }
+
+ .method private specialname rtspecialname static void .cctor() cil managed
+ {
+
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: stsfld int32 ''.$assembly::init@
+ IL_0006: ldsfld int32 ''.$assembly::init@
+ IL_000b: pop
+ IL_000c: ret
+ }
+
+ .method assembly specialname static void staticInitialization@() cil managed
+ {
+
+ .maxstack 5
+ .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_0,
+ class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1)
+ IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2()
+ IL_0005: stloc.0
+ IL_0006: ldloc.0
+ IL_0007: stloc.1
+ IL_0008: ldloc.1
+ IL_0009: ldnull
+ IL_000a: ldnull
+ IL_000b: call !!0 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync::RunSynchronously(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1,
+ class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1