summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2018-06-02 21:18:43 -0400
committerBen Gamari <ben@smart-cactus.org>2018-06-02 23:21:01 -0400
commit21e9d4f5f67dca22fbe3495f637347c5a8f7b52c (patch)
treeb63284bb279783780fdf5810d559945fd0568165
parent18cb4f5e1b88aef7770446a354bfcc1e0a075e89 (diff)
downloadhaskell-21e9d4f5f67dca22fbe3495f637347c5a8f7b52c.tar.gz
Fix #15214 by listing (~) in isBuiltInOcc_maybe
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
-rw-r--r--compiler/prelude/TysWiredIn.hs3
-rw-r--r--testsuite/tests/rename/should_fail/T15214.hs4
-rw-r--r--testsuite/tests/rename/should_fail/T15214.stderr2
-rw-r--r--testsuite/tests/rename/should_fail/all.T1
4 files changed, 10 insertions, 0 deletions
diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs
index 0817a75898..9ba2f1f45a 100644
--- a/compiler/prelude/TysWiredIn.hs
+++ b/compiler/prelude/TysWiredIn.hs
@@ -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
index 0000000000..55f15593be
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T15214.hs
@@ -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
index 0000000000..399438adb5
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T15214.stderr
@@ -0,0 +1,2 @@
+
+T15214.hs:4:1: error: Illegal binding of built-in syntax: ~
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index fb53d3306a..413b24f7d2 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -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, [''])