Skip to content

Commit b1619b6

Browse files
authored
Make trimmed printf "%A" for F# records work when trimmed (#14941)
* Add tests * Embed types * baselines + fsx
1 parent 24f0c34 commit b1619b6

27 files changed

+8907
-3063
lines changed

src/Compiler/AbstractIL/il.fs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3292,6 +3292,12 @@ let destILArrTy ty =
32923292
[<Literal>]
32933293
let tname_Attribute = "System.Attribute"
32943294

3295+
[<Literal>]
3296+
let tname_Enum = "System.Enum"
3297+
3298+
[<Literal>]
3299+
let tname_SealedAttribute = "System.SealedAttribute"
3300+
32953301
[<Literal>]
32963302
let tname_Object = "System.Object"
32973303

@@ -3367,6 +3373,10 @@ type ILGlobals(primaryScopeRef: ILScopeRef, equivPrimaryAssemblyRefs: ILAssembly
33673373

33683374
member val typ_Attribute = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_Attribute))
33693375

3376+
member val typ_Enum = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_Enum))
3377+
3378+
member val typ_SealedAttribute = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_SealedAttribute))
3379+
33703380
member val typ_Object = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_Object))
33713381

33723382
member val typ_String = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_String))
@@ -3985,6 +3995,9 @@ let mkILInstanceField (nm, ty, init, access) =
39853995
let mkILStaticField (nm, ty, init, at, access) =
39863996
mkILField (true, nm, ty, init, at, access, false)
39873997

3998+
let mkILStaticLiteralField (nm, ty, init, at, access) =
3999+
mkILField (true, nm, ty, Some init, at, access, true)
4000+
39884001
let mkILLiteralField (nm, ty, init, at, access) =
39894002
mkILField (true, nm, ty, Some init, at, access, true)
39904003

src/Compiler/AbstractIL/il.fsi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,10 @@ type internal ILGlobals =
18151815
member primaryAssemblyScopeRef: ILScopeRef
18161816
member primaryAssemblyRef: ILAssemblyRef
18171817
member primaryAssemblyName: string
1818+
member fsharpCoreAssemblyScopeRef: ILScopeRef
1819+
18181820
member typ_Attribute: ILType
1821+
member typ_Enum: ILType
18191822
member typ_Object: ILType
18201823
member typ_String: ILType
18211824
member typ_Type: ILType
@@ -1834,10 +1837,9 @@ type internal ILGlobals =
18341837
member typ_Double: ILType
18351838
member typ_Bool: ILType
18361839
member typ_Char: ILType
1840+
member typ_SealedAttribute: ILType
18371841
member typ_TypedReference: ILType
18381842

1839-
member fsharpCoreAssemblyScopeRef: ILScopeRef
1840-
18411843
/// Is the given assembly possibly a primary assembly?
18421844
/// In practice, a primary assembly is an assembly that contains the System.Object type definition
18431845
/// and has no referenced assemblies.
@@ -2051,6 +2053,7 @@ val internal mkILNonGenericInstanceMethod:
20512053
/// Make field definitions.
20522054
val internal mkILInstanceField: string * ILType * ILFieldInit option * ILMemberAccess -> ILFieldDef
20532055
val internal mkILStaticField: string * ILType * ILFieldInit option * byte[] option * ILMemberAccess -> ILFieldDef
2056+
val internal mkILStaticLiteralField: string * ILType * ILFieldInit * byte[] option * ILMemberAccess -> ILFieldDef
20542057
val internal mkILLiteralField: string * ILType * ILFieldInit * byte[] option * ILMemberAccess -> ILFieldDef
20552058

20562059
/// Make a type definition.

0 commit comments

Comments
 (0)