Commit 85aa1f42 authored by Ryan Scott's avatar Ryan Scott Committed by Ben Gamari

Fix #14390 by making toIfaceTyCon aware of equality

GHC was panicking when pretty-printing a heterogeneous
equality type constructor (#14390) because the function which
produced the type constructor, `toIfaceTyCon`, wasn't attaching the
appropriate `IfaceTyConSort` for equality type constructors, which
is `IfaceEqualityTyCon`. This is fixed easily enough.

Test Plan: make test TEST=T14390

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14390

Differential Revision:
parent 76735615
......@@ -195,6 +195,12 @@ toIfaceTyCon tc
| isUnboxedSumTyCon tc
, Just cons <- isDataSumTyCon_maybe tc = IfaceSumTyCon (length cons)
| tyConName tc == eqTyConName || tc == eqPrimTyCon
= IfaceEqualityTyCon True
| tc `elem` [heqTyCon, eqReprPrimTyCon]
= IfaceEqualityTyCon False
| otherwise = IfaceNormalTyCon
module T14390 where
import Data.Type.Equality
instance (~~) Int Int
T14390.hs:4:10: error:
• Illegal instance declaration for ‘(Int :: *) ~~ (Int :: *)’
Manual instances of this class are not permitted.
• In the instance declaration for ‘(~~) Int Int’
......@@ -460,3 +460,4 @@ test('T13929', normal, compile_fail, [''])
test('T14232', normal, compile_fail, [''])
test('T14325', normal, compile_fail, [''])
test('T14350', normal, compile_fail, [''])
test('T14390', 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