File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
.golden/swiftBasicNewtypeJoinOptionalsSpec Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 1
1
struct Newtype {
2
2
typealias NewtypeTag = Tagged<Newtype, Int?>
3
- let value: NewtypeTag
3
+ let value: NewtypeTag?
4
4
}
Original file line number Diff line number Diff line change @@ -78,7 +78,9 @@ prettySwiftDataWith indent = \case
78
78
++ " = Tagged<"
79
79
++ newtypeName
80
80
++ " , "
81
- ++ prettyMoatType (fieldType newtypeField)
81
+ ++ case (fieldType newtypeField) of
82
+ Optional t -> prettyMoatType t
83
+ t -> prettyMoatType t
82
84
++ " >\n "
83
85
++ prettyNewtypeField indents newtypeField newtypeName
84
86
++ " }"
@@ -255,7 +257,17 @@ prettyStructFields indents = go
255
257
++ go fs
256
258
257
259
prettyNewtypeField :: String -> Field -> String -> String
258
- prettyNewtypeField indents (Field alias _ _) fieldName = indents ++ " let " ++ alias ++ " : " ++ fieldName ++ " Tag" ++ " \n "
260
+ prettyNewtypeField indents (Field alias fieldType _) fieldName =
261
+ indents
262
+ ++ " let "
263
+ ++ alias
264
+ ++ " : "
265
+ ++ fieldName
266
+ ++ " Tag"
267
+ ++ case fieldType of
268
+ Optional _ -> " ?"
269
+ _ -> " "
270
+ ++ " \n "
259
271
260
272
prettyPrivateTypes :: String -> [MoatData ] -> String
261
273
prettyPrivateTypes indents = go
You can’t perform that action at this time.
0 commit comments