Fix #15214 by listing (~) in isBuiltInOcc_maybe
authorRyan Scott <ryan.gl.scott@gmail.com>
Sun, 3 Jun 2018 01:18:43 +0000 (21:18 -0400)
committerBen Gamari <ben@smart-cactus.org>
Sun, 3 Jun 2018 03:21:01 +0000 (23:21 -0400)
This changes an obscure error (which mistakenly mentions
Template Haskell) to one that makes more sense.

Test Plan: make test TEST=T15214

Reviewers: bgamari, mpickering

Reviewed By: bgamari, mpickering

Subscribers: mpickering, rwbarton, thomie, carter

GHC Trac Issues: #15214

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

compiler/prelude/TysWiredIn.hs
testsuite/tests/rename/should_fail/T15214.hs [new file with mode: 0644]
testsuite/tests/rename/should_fail/T15214.stderr [new file with mode: 0644]
testsuite/tests/rename/should_fail/all.T

index 0817a75..9ba2f1f 100644 (file)
@@ -679,6 +679,9 @@ isBuiltInOcc_maybe occ =
       "[]" -> Just $ choose_ns listTyConName nilDataConName
       ":"    -> Just consDataConName
 
+      -- equality tycon
+      "~"    -> Just eqTyConName
+
       -- boxed tuple data/tycon
       "()"    -> Just $ tup_name Boxed 0
       _ | Just rest <- "(" `BS.stripPrefix` name
diff --git a/testsuite/tests/rename/should_fail/T15214.hs b/testsuite/tests/rename/should_fail/T15214.hs
new file mode 100644 (file)
index 0000000..55f1559
--- /dev/null
@@ -0,0 +1,4 @@
+{-# LANGUAGE TypeOperators #-}
+module T15214 where
+
+type (~) = Either
diff --git a/testsuite/tests/rename/should_fail/T15214.stderr b/testsuite/tests/rename/should_fail/T15214.stderr
new file mode 100644 (file)
index 0000000..399438a
--- /dev/null
@@ -0,0 +1,2 @@
+
+T15214.hs:4:1: error: Illegal binding of built-in syntax: ~
index fb53d33..413b24f 100644 (file)
@@ -130,3 +130,4 @@ test('T13947', normal, compile_fail, [''])
 test('T13847', normal, multimod_compile_fail, ['T13847','-v0'])
 test('T14307', normal, compile_fail, [''])
 test('T14591', normal, compile_fail, [''])
+test('T15214', normal, compile_fail, [''])