[commit: ghc] master: Fix #15214 by listing (~) in isBuiltInOcc_maybe (21e9d4f)

git at git.haskell.org git at git.haskell.org
Sun Jun 3 03:22:05 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/21e9d4f5f67dca22fbe3495f637347c5a8f7b52c/ghc

>---------------------------------------------------------------

commit 21e9d4f5f67dca22fbe3495f637347c5a8f7b52c
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Sat Jun 2 21:18:43 2018 -0400

    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


>---------------------------------------------------------------

21e9d4f5f67dca22fbe3495f637347c5a8f7b52c
 compiler/prelude/TysWiredIn.hs                   | 3 +++
 testsuite/tests/rename/should_fail/T15214.hs     | 4 ++++
 testsuite/tests/rename/should_fail/T15214.stderr | 2 ++
 testsuite/tests/rename/should_fail/all.T         | 1 +
 4 files changed, 10 insertions(+)

diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs
index 0817a75..9ba2f1f 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 0000000..55f1559
--- /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 0000000..399438a
--- /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 fb53d33..413b24f 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, [''])



More information about the ghc-commits mailing list