Skip to content

Commit

Permalink
fix nesting of constructor defs
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Jun 7, 2023
1 parent 8f86037 commit 2a5fc33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Juvix/Compiler/Concrete/Print/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ instance SingI s => PrettyPrint (InductiveConstructorDef s) where
constructorType' = ppExpressionType _constructorType
doc' = ppCode <$> _constructorDoc
pragmas' = ppCode <$> _constructorPragmas
nest (pipeHelper <+> doc' ?<> pragmas' ?<> constructorName' <+> ppCode _constructorColonKw <+> constructorType')
pipeHelper <+> nest (doc' ?<> pragmas' ?<> constructorName' <+> ppCode _constructorColonKw <+> constructorType')
where
-- we use this helper so that comments appear before the first optional pipe if the pipe was omitted
pipeHelper :: Sem r ()
Expand Down Expand Up @@ -821,7 +821,7 @@ instance SingI s => PrettyPrint (InductiveDef s) where
?<> sig'
<+> ppCode _inductiveAssignKw
<> line
<> (indent . align) constrs'
<> indent constrs'
where
ppConstructorBlock :: NonEmpty (InductiveConstructorDef s) -> Sem r ()
ppConstructorBlock cs = vsep (ppCode <$> cs)
Expand Down
4 changes: 2 additions & 2 deletions tests/positive/Format.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ module Comments;

type color : Type :=
-- comment before pipe
| black : color
| black : color
| white : color
| red : color
-- comment before pipe
| blue : color;
| blue : color;

axiom a5 : Type;

Expand Down

0 comments on commit 2a5fc33

Please sign in to comment.