Commit b92fb515 authored by Ryan Scott's avatar Ryan Scott Committed by Ben Gamari

Parenthesize forall-type args in cvtTypeKind

Trac #14646 happened because we forgot to parenthesize `forall` types to
the left of an arrow. This simple patch fixes that.

Test Plan: make test TEST=T14646

Reviewers: alanz, goldfire, bgamari

Reviewed By: alanz

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14646

Differential Revision: https://phabricator.haskell.org/D4298

(cherry picked from commit f380115c)
parent 20afdaa7
......@@ -1221,10 +1221,11 @@ cvtTypeKind ty_str ty
tys'
ArrowT
| [x',y'] <- tys' -> do
case x' of
(L _ HsFunTy{}) -> do { x'' <- returnL (HsParTy x')
; returnL (HsFunTy x'' y') }
_ -> returnL (HsFunTy x' y')
x'' <- case x' of
L _ HsFunTy{} -> returnL (HsParTy x')
L _ HsForAllTy{} -> returnL (HsParTy x') -- #14646
_ -> return x'
returnL (HsFunTy x'' y')
| otherwise ->
mk_apps (HsTyVar NotPromoted (noLoc (getRdrName funTyCon)))
tys'
......
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
module T14646 where
$([d| f :: (forall a. a) -> Int
f _ = undefined |])
T14646.hs:(5,3)-(6,24): Splicing declarations
[d| f :: (forall a. a) -> Int
f _ = undefined |]
======>
f :: (forall a. a) -> Int
f _ = undefined
......@@ -397,3 +397,4 @@ test('T13887', normal, compile_and_run, ['-v0'])
test('T13968', normal, compile_fail, ['-v0'])
test('T14204', normal, compile_fail, ['-v0'])
test('T14060', normal, compile_and_run, ['-v0'])
test('T14646', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment