Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typeop flexgroup #21

Merged
merged 2 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Language/PS/CST/Printers/TypeLevel.purs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ printType = \type_ -> case type_ of
(TypeForall _ _) -> flexGroup $ printTypeImplementation type_
(TypeConstrained _ _) -> flexGroup $ printTypeImplementation type_
(TypeArr _ _) -> flexGroup $ printTypeImplementation type_
(TypeOp _ _ _) -> flexGroup $ printTypeImplementation type_
_ -> printTypeImplementation type_
where
printTypeImplementation (TypeVar ident) = (text <<< appendUnderscoreIfReserved <<< unwrap) ident
Expand Down
3 changes: 1 addition & 2 deletions test/Golden/DeclDataComplex/Expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ data Foo
( rowField :: Number, rowField2 :: Number | MyExtension + MyOtherExtension )
( rowField :: Number
, rowField2 :: Number
| MyExtension + MyOtherExtension
{ someField :: Number }
| MyExtension + MyOtherExtension { someField :: Number }
)
( rowField :: { foo :: Number
, bar :: Data.Map.Map
Expand Down
3 changes: 1 addition & 2 deletions test/Golden/DeclNewtype/Expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ newtype Foo = Foo ( rowField :: Number

newtype Foo = Foo ( rowField :: Number
, rowField2 :: Number
| MyExtension + MyOtherExtension
{ someField :: Number }
| MyExtension + MyOtherExtension { someField :: Number }
)

newtype Foo = Foo ( rowField :: { foo :: Number
Expand Down
12 changes: 12 additions & 0 deletions test/Golden/DeclType/Actual.purs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ actualModule = Module
(arrayType $ TypeVar $ Ident "a")
, declFooType $ (arrayType $ TypeVar $ Ident "a") ====>> (maybeType $ TypeVar $ Ident "a")
, declFooType $ TypeOp (TypeConstructor $ nonQualifiedName $ ProperName "Array") (nonQualifiedName $ OpName "~>") (TypeConstructor $ nonQualifiedName $ ProperName "Maybe")
, declFooType $
(TypeOp
((TypeConstructor $ nonQualifiedName (ProperName "Foo"))
`TypeApp`
(TypeConstructor $ nonQualifiedName (ProperName "A"))
)
(nonQualifiedName (OpName "<+>"))
((TypeConstructor $ nonQualifiedName (ProperName "Foo"))
`TypeApp`
(TypeConstructor $ nonQualifiedName (ProperName "B"))
)
)
, declFooType $ TypeForall
(NonEmpty.cons' (TypeVarName $ Ident "f") [])
( TypeConstrained
Expand Down
5 changes: 3 additions & 2 deletions test/Golden/DeclType/Expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ type Foo = ( rowField :: Number

type Foo = ( rowField :: Number
, rowField2 :: Number
| MyExtension + MyOtherExtension
{ someField :: Number }
| MyExtension + MyOtherExtension { someField :: Number }
)

type Foo = ( "RowField" :: Number )
Expand All @@ -87,6 +86,8 @@ type Foo = (Array a -> Maybe a)

type Foo = (Array ~> Maybe)

type Foo = (Foo A <+> Foo B)

type Foo = (forall f . Functor f => f ~> Maybe)

type Foo = (MyClass f g k => MyClass2 { foo :: Number } => f)
Expand Down