Commit 2277172a authored by Ryan Scott's avatar Ryan Scott Committed by Ben Gamari

Parenthesize pretty-printed equalities when necessary

Fixes #13677 by parenthesizing equalities in a sufficiently high
pretty-printing context.

Test Plan: make test TEST=T13677

Reviewers: goldfire, austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13677

Differential Revision: https://phabricator.haskell.org/D3570
parent 1f770a52
......@@ -979,7 +979,7 @@ pprTyTcApp' ctxt_prec tc tys dflags style
-> text "(TypeError ...)"
| Just doc <- ppr_equality tc (tcArgsIfaceTypes tys)
-> doc
-> maybeParen ctxt_prec TyConPrec doc
| otherwise
-> ppr_iface_tc_app ppr_ty ctxt_prec tc tys_wo_kinds
......
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GADTs #-}
module T13677 where
import GHC.Exts (Constraint)
data Dict a where
Dict :: a => Dict a
foo :: Dict (Int ~ Int) => Int
foo = undefined
T13677.hs:10:8: error:
• Expected a constraint, but ‘Dict (Int ~ Int)’ has kind ‘*’
• In the type signature: foo :: Dict (Int ~ Int) => Int
......@@ -438,3 +438,4 @@ test('T13506', normal, compile_fail, [''])
test('T13611', expect_broken(13611), compile_fail, [''])
test('T13320', normal, compile_fail, [''])
test('T13640', normal, compile_fail, [''])
test('T13677', normal, compile_fail, [''])
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