Skip to content

Commit d852232

Browse files
committed
fix record field emit
1 parent 3bfd9e6 commit d852232

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

tests/GenerateTests.fs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ module GenerateTests =
458458

459459
let value = getType m.Value
460460

461-
AppPrefix(LongIdent("System.Collections.Generic.Dictionary"), [ key; value ])
461+
createDictionary [ key; value ]
462462

463463
| MetaModel.Type.StringLiteralType t ->
464464
LongIdent("string")
@@ -573,10 +573,10 @@ module GenerateTests =
573573
]
574574

575575
try
576-
577576
Record(structure.Name) {
578-
// expandFields structure
579-
Field("TODO", LongIdent "TODO")
577+
yield!
578+
expandFields structure
579+
|> List.map (fun (name, t) -> Field(name, t))
580580
}
581581
with e ->
582582
raise
@@ -625,7 +625,7 @@ module GenerateTests =
625625
|> LongIdent
626626

627627
let value = getType m.Value
628-
AppPrefix(LongIdent("System.Collections.Generic.Dictionary"), [ key; value ])
628+
createDictionary [ key; value ]
629629

630630
| MetaModel.Type.StringLiteralType t -> String()
631631
| MetaModel.Type.TupleType t ->
@@ -679,14 +679,18 @@ module GenerateTests =
679679
Abbrev("DocumentUri", "string")
680680
Abbrev("RegExp", "string")
681681

682+
Class("ErasedUnionAttribute") {
683+
Inherit("System.Attribute()")
684+
}
685+
682686
// Assuming the max is 5, can be increased if needed
683687
for i in [ 2..5 ] do
684688
Union($"U%d{i}") {
685689
for j = 1 to i do
686690
UnionCase($"C{j}", Field $"'T{j}")
687691
}
688692
|> _.attribute(Attribute "ErasedUnion")
689-
|> _.typeParams([ for j = 1 to i do $"T{j}" ])
693+
|> _.typeParams([ for j = 1 to i do $"'T{j}" ])
690694

691695
for s in parsedMetaModel.Structures do
692696
if isUnitStructure s then
@@ -704,7 +708,11 @@ module GenerateTests =
704708
|> _.toRecursive()
705709
}
706710

707-
let writeToFile path contents = File.WriteAllText(path, contents)
711+
712+
713+
let writeToFile path contents =
714+
printfn "%A" contents
715+
File.WriteAllText(path, contents)
708716

709717
source
710718
|> Gen.mkOak

0 commit comments

Comments
 (0)