Skip to content

Commit 36b626c

Browse files
committed
Prettier kotlin deprecations
1 parent fa9d21b commit 36b626c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
data class Data(
22
val field0: Int,
3-
// Deprecated since build 500
4-
// val field1: Int? = null,
3+
// Deprecated since build 500
4+
// val field1: Int? = null,
55
)

src/Moat/Pretty/Kotlin.hs

+6-5
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ prettyStructFields indents fields deprecatedFields = go fields
7171
where
7272
deprecatedFieldsMap = Map.fromList deprecatedFields
7373
prettyField (Field fieldName ty _) =
74-
indents
75-
++ "val "
74+
"val "
7675
++ fieldName
7776
++ ": "
7877
++ prettyMoatType ty
@@ -84,11 +83,13 @@ prettyStructFields indents fields deprecatedFields = go fields
8483
go (field@(Field fieldName _ _) : fs) =
8584
case Map.lookup fieldName deprecatedFieldsMap of
8685
Just mComment ->
87-
maybe "" (\comment -> "// " ++ comment ++ "\n") mComment
88-
++ "//"
86+
indents
87+
++ maybe "" (\comment -> "// " ++ comment ++ "\n") mComment
88+
++ indents
89+
++ "// "
8990
++ prettyField field
9091
++ go fs
91-
Nothing -> prettyField field ++ go fs
92+
Nothing -> indents ++ prettyField field ++ go fs
9293

9394
prettyEnumCases :: String -> [EnumCase] -> String
9495
prettyEnumCases indents = go

0 commit comments

Comments
 (0)