@@ -221,6 +221,8 @@ type IlxGenOptions =
221
221
222
222
ilxBackend: IlxGenBackend
223
223
224
+ fsiMultiAssemblyEmit: bool
225
+
224
226
/// Indicates the code is being generated in FSI.EXE and is executed immediately after code generation
225
227
/// This includes all interactively compiled code, including #load, definitions, and expressions
226
228
isInteractive: bool
@@ -1722,8 +1724,10 @@ type AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbu
1722
1724
let ilFieldDefs =
1723
1725
mkILFields
1724
1726
[ for _, fldName, fldTy in flds ->
1725
- // The F# Interactive backend may split to multiple assemblies.
1726
- let access = ( if cenv.opts.isInteractive then ILMemberAccess.Public else ILMemberAccess.Private)
1727
+ // Don't hide fields when splitting to multiple assemblies.
1728
+ let access =
1729
+ if cenv.opts.isInteractive && cenv.opts.fsiMultiAssemblyEmit then ILMemberAccess.Public
1730
+ else ILMemberAccess.Private
1727
1731
let fdef = mkILInstanceField ( fldName, fldTy, None, access)
1728
1732
fdef.With( customAttrs = mkILCustomAttrs [ g.DebuggerBrowsableNeverAttribute ]) ]
1729
1733
@@ -8060,14 +8064,21 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
8060
8064
// The IL field is hidden if the property/field is hidden OR we're using a property
8061
8065
// AND the field is not mutable (because we can take the address of a mutable field).
8062
8066
// Otherwise fields are always accessed via their property getters/setters
8063
- let isFieldHidden = isPropHidden || ( not useGenuineField && not isFSharpMutable)
8067
+ //
8068
+ // Additionally, don't hide fields for multiemit in F# Interactive
8069
+ let isFieldHidden =
8070
+ isPropHidden ||
8071
+ ( not useGenuineField &&
8072
+ not isFSharpMutable &&
8073
+ not ( cenv.opts.isInteractive && cenv.opts.fsiMultiAssemblyEmit))
8064
8074
8065
8075
let extraAttribs =
8066
8076
match tyconRepr with
8067
8077
| TFSharpRecdRepr _ when not useGenuineField -> [ g.DebuggerBrowsableNeverAttribute ] // hide fields in records in debug display
8068
8078
| _ -> [] // don't hide fields in classes in debug display
8069
8079
8070
8080
let access = ComputeMemberAccess isFieldHidden
8081
+
8071
8082
let literalValue = Option.map ( GenFieldInit m) fspec.LiteralValue
8072
8083
8073
8084
let fdef =
0 commit comments