mirror of
https://github.com/google/ghc-source-gen.git
synced 2024-10-26 22:37:41 +03:00
Fix parentheses for tyApp. (#40)
This commit is contained in:
parent
0b726749a2
commit
3af6da1152
@ -126,14 +126,15 @@ e @::@ t = ExprWithTySig (builtLoc e) (sigWcType t)
|
||||
-- > var "f" @@ var "Int"
|
||||
tyApp :: HsExpr' -> HsType' -> HsExpr'
|
||||
#if MIN_VERSION_ghc(8,8,0)
|
||||
tyApp e t = noExt HsAppType (builtLoc e) t'
|
||||
tyApp e t = noExt HsAppType e' t'
|
||||
#elif MIN_VERSION_ghc(8,6,0)
|
||||
tyApp e t = HsAppType t' (builtLoc e)
|
||||
tyApp e t = HsAppType t' e'
|
||||
#else
|
||||
tyApp e t = HsAppType (builtLoc e) t'
|
||||
tyApp e t = HsAppType e' t'
|
||||
#endif
|
||||
where
|
||||
t' = wcType $ unLoc $ parenthesizeTypeForApp $ builtLoc t
|
||||
e' = parenthesizeExprForApp $ builtLoc e
|
||||
|
||||
-- | Constructs a record with explicit field names.
|
||||
--
|
||||
|
@ -195,6 +195,11 @@ exprsTest dflags = testGroup "Expr"
|
||||
-- TODO: add more tests.
|
||||
[ "do (let x = 1 in x)" :~ do' [stmt $ let' [valBind "x" (int 1)] (var "x")]
|
||||
]
|
||||
, test "tyApp"
|
||||
[ "x @t" :~ var "x" `tyApp` var "t"
|
||||
, "(f x) @t" :~ (var "f" @@ var "x") `tyApp` var "t"
|
||||
, "f x @t" :~ var "f" @@ (var "x" `tyApp` var "t")
|
||||
]
|
||||
]
|
||||
where
|
||||
test = testExprs dflags
|
||||
|
Loading…
Reference in New Issue
Block a user