From 0fe1f41ed7f351e6a8b6e8f7e4f6b5b859e7d06c Mon Sep 17 00:00:00 2001
From: Simon Peyton Jones <simonpj@microsoft.com>
Date: Tue, 13 May 2014 13:15:45 +0100
Subject: [PATCH] Lint should check that TyConAppCo doesn't have a synonym in
 the tycon position

That is why Lint didn't nail Trac #9102

(cherry picked from commit 4cfc1fae11ec9a5c4b34ac747f0ce50f52423eba)
---
 compiler/coreSyn/CoreLint.lhs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/compiler/coreSyn/CoreLint.lhs b/compiler/coreSyn/CoreLint.lhs
index b5c79855f29c..3d3deab83938 100644
--- a/compiler/coreSyn/CoreLint.lhs
+++ b/compiler/coreSyn/CoreLint.lhs
@@ -856,6 +856,9 @@ lintCoercion co@(TyConAppCo r tc cos)
        ; checkRole co2 r r2
        ; return (rk, mkFunTy s1 s2, mkFunTy t1 t2, r) }
 
+  | isSynTyCon tc
+  = failWithL (ptext (sLit "Synonym in TyConAppCo:") <+> ppr co)
+
   | otherwise
   = do { (ks,ss,ts,rs) <- mapAndUnzip4M lintCoercion cos
        ; rk <- lint_co_app co (tyConKind tc) (ss `zip` ks)
-- 
GitLab