summaryrefslogtreecommitdiff
path: root/testsuite/tests/module
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-05-11 23:19:14 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2015-05-13 09:02:13 +0100
commit130e93aab220bdf14d08028771f83df210da340b (patch)
tree4bd4ca6cbccea45d6c977122bc375fa101ff199a /testsuite/tests/module
parent8da785d59f5989b9a9df06386d5bd13f65435bc0 (diff)
downloadhaskell-130e93aab220bdf14d08028771f83df210da340b.tar.gz
Refactor tuple constraints
Make tuple constraints be handled by a perfectly ordinary type class, with the component constraints being the superclasses: class (c1, c2) => (c2, c2) This change was provoked by #10359 inability to re-use a given tuple constraint as a whole #9858 confusion between term tuples and constraint tuples but it's generally a very nice simplification. We get rid of - In Type, the TuplePred constructor of PredTree, and all the code that dealt with TuplePreds - In TcEvidence, the constructors EvTupleMk, EvTupleSel See Note [How tuples work] in TysWiredIn. Of course, nothing is ever entirely simple. This one proved quite fiddly. - I did quite a bit of renaming, which makes this patch touch a lot of modules. In partiuclar tupleCon -> tupleDataCon. - I made constraint tuples known-key rather than wired-in. This is different to boxed/unboxed tuples, but it proved awkward to have all the superclass selectors wired-in. Easier just to use the standard mechanims. - While I was fiddling with known-key names, I split the TH Name definitions out of DsMeta into a new module THNames. That meant that the known-key names can all be gathered in PrelInfo, without causing module loops. - I found that the parser was parsing an import item like T( .. ) as a *data constructor* T, and then using setRdrNameSpace to fix it. Stupid! So I changed the parser to parse a *type constructor* T, which means less use of setRdrNameSpace. I also improved setRdrNameSpace to behave better on Exact Names. Largely on priciple; I don't think it matters a lot. - When compiling a data type declaration for a wired-in thing like tuples (,), or lists, we don't really need to look at the declaration. We have the wired-in thing! And not doing so avoids having to line up the uniques for data constructor workers etc. See Note [Declarations for wired-in things] - I found that FunDeps.oclose wasn't taking superclasses into account; easily fixed. - Some error message refactoring for invalid constraints in TcValidity
Diffstat (limited to 'testsuite/tests/module')
-rw-r--r--testsuite/tests/module/all.T2
-rw-r--r--testsuite/tests/module/mod89.hs2
-rw-r--r--testsuite/tests/module/mod89.stderr12
3 files changed, 13 insertions, 3 deletions
diff --git a/testsuite/tests/module/all.T b/testsuite/tests/module/all.T
index c4c2fffe57..d0b37aaa33 100644
--- a/testsuite/tests/module/all.T
+++ b/testsuite/tests/module/all.T
@@ -116,7 +116,7 @@ test('mod85', normal, compile, [''])
test('mod86', normal, compile, [''])
test('mod87', normal, compile_fail, [''])
test('mod88', normal, compile_fail, [''])
-test('mod89', normal, compile_fail, [''])
+test('mod89', normal, compile, [''])
test('mod90', normal, compile_fail, [''])
test('mod91', normal, compile_fail, [''])
test('mod92', normal, compile, [''])
diff --git a/testsuite/tests/module/mod89.hs b/testsuite/tests/module/mod89.hs
index 2c48d65a16..1e903a0125 100644
--- a/testsuite/tests/module/mod89.hs
+++ b/testsuite/tests/module/mod89.hs
@@ -1,3 +1,5 @@
+{-# OPTIONS_GHC -Wall #-}
+
-- !!! Sublist for non-class/tycon
module M where
import Prelude(map(..))
diff --git a/testsuite/tests/module/mod89.stderr b/testsuite/tests/module/mod89.stderr
index 0f956536cb..b355f3050b 100644
--- a/testsuite/tests/module/mod89.stderr
+++ b/testsuite/tests/module/mod89.stderr
@@ -1,2 +1,10 @@
-
-mod89.hs:3:16: Module ‘Prelude’ does not export ‘map(..)’
+
+mod89.hs:5:1: warning:
+ The import item ‘map(..)’ suggests that
+ ‘map’ has (in-scope) constructors or class methods,
+ but it has none
+
+mod89.hs:5:1: warning:
+ The import of ‘Prelude’ is redundant
+ except perhaps to import instances from ‘Prelude’
+ To import instances alone, use: import Prelude()