summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2016-10-14 00:13:44 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2016-10-20 12:45:42 -0700
commit01490b4c1222b66029d18e1661ebd7c6cf216948 (patch)
tree06a18b1d85698588a5ecfe61eab4546b9237491d
parent9df4ce4f89b6d999822ae30ff777bdaf26665c06 (diff)
downloadhaskell-01490b4c1222b66029d18e1661ebd7c6cf216948.tar.gz
Mark previously failing backpack tests as passing, with correct output.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
-rw-r--r--testsuite/tests/backpack/should_compile/all.T3
-rw-r--r--testsuite/tests/backpack/should_compile/bkp35.bkp15
-rw-r--r--testsuite/tests/backpack/should_compile/bkp35.stderr7
-rw-r--r--testsuite/tests/backpack/should_fail/all.T8
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail07.bkp7
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail07.stderr28
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail15.stderr17
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail22.bkp1
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail22.stderr21
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail28.bkp20
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail28.stderr27
11 files changed, 119 insertions, 35 deletions
diff --git a/testsuite/tests/backpack/should_compile/all.T b/testsuite/tests/backpack/should_compile/all.T
index 7238b636ef..81bcb9aa4b 100644
--- a/testsuite/tests/backpack/should_compile/all.T
+++ b/testsuite/tests/backpack/should_compile/all.T
@@ -26,8 +26,7 @@ test('bkp31', normal, backpack_compile, [''])
test('bkp32', normal, backpack_compile, [''])
test('bkp33', normal, backpack_compile, [''])
test('bkp34', normal, backpack_compile, [''])
-# instance merging when heads overlap prefers an arbitrary instance
-test('bkp35', expect_broken(0), backpack_compile, [''])
+test('bkp35', normal, backpack_compile, [''])
test('bkp36', normal, backpack_compile, [''])
test('bkp37', normal, backpack_compile, [''])
test('bkp38', normal, backpack_compile, [''])
diff --git a/testsuite/tests/backpack/should_compile/bkp35.bkp b/testsuite/tests/backpack/should_compile/bkp35.bkp
index 76e9ace811..5e530f089a 100644
--- a/testsuite/tests/backpack/should_compile/bkp35.bkp
+++ b/testsuite/tests/backpack/should_compile/bkp35.bkp
@@ -1,8 +1,9 @@
{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE IncoherentInstances #-}
unit p where
signature A where
data K a
- instance Read a => Show (K a)
+ instance Show (K (a -> b))
unit q where
signature A where
data K a
@@ -10,19 +11,9 @@ unit q where
unit r where
dependency p[A=<A>]
dependency q[A=<A>]
- -- At the moment, the merge arbitrarily picks one of the
- -- instances to make available, so only one of these statements
- -- will typecheck. Somehow need an OR constraint (but type
- -- class solver doesn't backtrack, so that ain't gonna work).
- --
- -- It's actually a bit interesting to decide what this should
- -- be: "instance Show a" would satisfy both of these, but
- -- nothing else seems to work (incoherent instance is not
- -- enough because GHC could pick the wrong instance and then
- -- fail to solve the constraint.)
module R where
import A
f :: Show a => K a -> String
f = show
- g :: Read a => K a -> String
+ g :: K (a -> b) -> String
g = show
diff --git a/testsuite/tests/backpack/should_compile/bkp35.stderr b/testsuite/tests/backpack/should_compile/bkp35.stderr
new file mode 100644
index 0000000000..14aa7a843b
--- /dev/null
+++ b/testsuite/tests/backpack/should_compile/bkp35.stderr
@@ -0,0 +1,7 @@
+[1 of 3] Processing p
+ [1 of 1] Compiling A[sig] ( p/A.hsig, nothing )
+[2 of 3] Processing q
+ [1 of 1] Compiling A[sig] ( q/A.hsig, nothing )
+[3 of 3] Processing r
+ [1 of 2] Compiling A[sig] ( r/A.hsig, nothing )
+ [2 of 2] Compiling R ( r/R.hs, nothing )
diff --git a/testsuite/tests/backpack/should_fail/all.T b/testsuite/tests/backpack/should_fail/all.T
index 22e87d5abd..d9fab3c520 100644
--- a/testsuite/tests/backpack/should_fail/all.T
+++ b/testsuite/tests/backpack/should_fail/all.T
@@ -3,24 +3,24 @@ test('bkpfail03', normal, backpack_typecheck_fail, [''])
test('bkpfail04', normal, backpack_typecheck_fail, [''])
test('bkpfail05', normal, backpack_compile_fail, [''])
test('bkpfail06', normal, backpack_compile_fail, [''])
-test('bkpfail07', expect_broken(0), backpack_typecheck_fail, ['']) # could fix this but not priority
+test('bkpfail07', normal, backpack_compile_fail, [''])
test('bkpfail09', normal, backpack_compile_fail, [''])
test('bkpfail10', normal, backpack_compile_fail, [''])
test('bkpfail11', normal, backpack_compile_fail, [''])
test('bkpfail12', normal, backpack_compile_fail, [''])
test('bkpfail13', normal, backpack_compile_fail, [''])
test('bkpfail14', normal, backpack_compile_fail, [''])
-test('bkpfail15', expect_broken(0), backpack_compile_fail, ['']) # we don't error here...
+test('bkpfail15', normal, backpack_compile_fail, [''])
test('bkpfail16', normal, backpack_compile_fail, [''])
test('bkpfail17', normal, backpack_compile_fail, [''])
test('bkpfail18', normal, backpack_compile_fail, [''])
test('bkpfail19', normal, backpack_compile_fail, [''])
test('bkpfail20', normal, backpack_compile_fail, [''])
test('bkpfail21', normal, backpack_compile_fail, [''])
-# it does fail, but not quite in the right way yet...
-test('bkpfail22', expect_broken(0), backpack_compile_fail, [''])
+test('bkpfail22', normal, backpack_compile_fail, [''])
test('bkpfail23', normal, backpack_compile_fail, [''])
test('bkpfail24', normal, backpack_compile_fail, [''])
test('bkpfail25', normal, backpack_compile_fail, [''])
test('bkpfail26', normal, backpack_compile_fail, [''])
test('bkpfail27', normal, backpack_compile_fail, [''])
+test('bkpfail28', normal, backpack_compile_fail, [''])
diff --git a/testsuite/tests/backpack/should_fail/bkpfail07.bkp b/testsuite/tests/backpack/should_fail/bkpfail07.bkp
index cbbd95b272..e386818976 100644
--- a/testsuite/tests/backpack/should_fail/bkpfail07.bkp
+++ b/testsuite/tests/backpack/should_fail/bkpfail07.bkp
@@ -1,10 +1,11 @@
unit p where
signature H where
data T = T Int
-unit q where
- signature A where -- indefinite version
+unit h where
module T where
data T = T Bool
module H(T(..)) where
import T
- dependency p[H=<H>]
+ signature A where -- indefinite version
+unit q where
+ dependency p[H=h[A=<A>]:H]
diff --git a/testsuite/tests/backpack/should_fail/bkpfail07.stderr b/testsuite/tests/backpack/should_fail/bkpfail07.stderr
index d6269b4cc2..8a2c3876bb 100644
--- a/testsuite/tests/backpack/should_fail/bkpfail07.stderr
+++ b/testsuite/tests/backpack/should_fail/bkpfail07.stderr
@@ -1,14 +1,16 @@
-[1 of 2] Processing p
- [1 of 1] Compiling H[abstract sig] ( p/H.hsig, nothing )
-[2 of 2] Processing q
- [1 of 4] Compiling A[abstract sig] ( q/A.hsig, nothing )
- [2 of 4] Compiling T ( q/T.hs, nothing )
- [3 of 4] Compiling H ( q/H.hs, nothing )
- [4 of 4] Including p
+[1 of 3] Processing p
+ [1 of 1] Compiling H[sig] ( p/H.hsig, nothing )
+[2 of 3] Processing h
+ [1 of 3] Compiling T ( h/T.hs, nothing )
+ [2 of 3] Compiling H ( h/H.hs, nothing )
+ [3 of 3] Compiling A[sig] ( h/A.hsig, nothing )
+[3 of 3] Processing q
+ [1 of 1] Compiling A[sig] ( q/A.hsig, nothing )
-bkpfail07.bkp:7:9: error:
- Type constructor ‘T.T’ has conflicting definitions in the module
- and its hsig file
- Main module: data T.T = T.T Bool
- Hsig file: data T.T = T.T Int
- The constructors do not match: The types for ‘T.T’ differ
+bkpfail07.bkp:6:9: error:
+ • Type constructor ‘h[A=<A>]:T.T’ has conflicting definitions in the module
+ and its hsig file
+ Main module: data h[A=<A>]:T.T = h[A=<A>]:T.T GHC.Types.Bool
+ Hsig file: data h[A=<A>]:T.T = h[A=<A>]:T.T GHC.Types.Int
+ The constructors do not match: The types for ‘h[A=<A>]:T.T’ differ
+ • while checking that h[A=<A>]:H implements signature H in p[H=h[A=<A>]:H]
diff --git a/testsuite/tests/backpack/should_fail/bkpfail15.stderr b/testsuite/tests/backpack/should_fail/bkpfail15.stderr
new file mode 100644
index 0000000000..37d0f5d3a4
--- /dev/null
+++ b/testsuite/tests/backpack/should_fail/bkpfail15.stderr
@@ -0,0 +1,17 @@
+[1 of 3] Processing p
+ [1 of 3] Compiling A[sig] ( p/A.hsig, nothing )
+ [2 of 3] Compiling Q[sig] ( p/Q.hsig, nothing )
+ [3 of 3] Compiling P ( p/P.hs, nothing )
+[2 of 3] Processing q
+ Instantiating q
+ [1 of 1] Compiling Q ( q/Q.hs, bkpfail15.out/q/Q.o )
+[3 of 3] Processing r
+ [1 of 1] Compiling A[sig] ( r/A.hsig, nothing )
+
+bkpfail15.bkp:8:9: error:
+ • Identifier ‘q:Q.f’ has conflicting definitions in the module
+ and its hsig file
+ Main module: q:Q.f :: GHC.Types.Bool
+ Hsig file: q:Q.f :: GHC.Types.Int
+ The two types are different
+ • while checking that q:Q implements signature Q in p[A=<A>, Q=q:Q]
diff --git a/testsuite/tests/backpack/should_fail/bkpfail22.bkp b/testsuite/tests/backpack/should_fail/bkpfail22.bkp
index 1217aa0456..bc6b020943 100644
--- a/testsuite/tests/backpack/should_fail/bkpfail22.bkp
+++ b/testsuite/tests/backpack/should_fail/bkpfail22.bkp
@@ -15,6 +15,7 @@ unit badimpl where
module H2 where
type S = ()
unit check where
+ dependency q[H2=badimpl:H2]
dependency p[H=q[H2=badimpl:H2]:N]
-- signature H3 where
module C where
diff --git a/testsuite/tests/backpack/should_fail/bkpfail22.stderr b/testsuite/tests/backpack/should_fail/bkpfail22.stderr
index bfbf8a10a8..522985db39 100644
--- a/testsuite/tests/backpack/should_fail/bkpfail22.stderr
+++ b/testsuite/tests/backpack/should_fail/bkpfail22.stderr
@@ -1 +1,20 @@
-Not working test
+[1 of 4] Processing p
+ [1 of 2] Compiling H[sig] ( p/H.hsig, nothing )
+ [2 of 2] Compiling M ( p/M.hs, nothing )
+[2 of 4] Processing q
+ [1 of 2] Compiling H2[sig] ( q/H2.hsig, nothing )
+ [2 of 2] Compiling N ( q/N.hs, nothing )
+[3 of 4] Processing badimpl
+ Instantiating badimpl
+ [1 of 1] Compiling H2 ( badimpl/H2.hs, bkpfail22.out/badimpl/H2.o )
+[4 of 4] Processing check
+ Instantiating check
+ [1 of 2] Including q[H2=badimpl:H2]
+ Instantiating q[H2=badimpl:H2]
+ [1 of 2] Compiling H2[sig] ( q/H2.hsig, bkpfail22.out/q/q-FjwGsuDQ5qiKUCvnEATUA9/H2.o )
+
+bkpfail22.bkp:16:9: error:
+ Type constructor ‘badimpl:H2.S’ has conflicting definitions in the module
+ and its hsig file
+ Main module: type badimpl:H2.S = ()
+ Hsig file: type badimpl:H2.S = GHC.Types.Bool
diff --git a/testsuite/tests/backpack/should_fail/bkpfail28.bkp b/testsuite/tests/backpack/should_fail/bkpfail28.bkp
new file mode 100644
index 0000000000..aa3f1a489b
--- /dev/null
+++ b/testsuite/tests/backpack/should_fail/bkpfail28.bkp
@@ -0,0 +1,20 @@
+{-# LANGUAGE FlexibleInstances #-}
+-- This doesn't work: GHC MUST pick the wrong one!
+-- {-# LANGUAGE IncoherentInstances #-}
+unit p where
+ signature A where
+ data K a
+ instance Show a => Show (K a)
+unit q where
+ signature A where
+ data K a
+ instance Read a => Show (K a)
+unit r where
+ dependency p[A=<A>]
+ dependency q[A=<A>]
+ module R where
+ import A
+ f :: Show a => K a -> String
+ f = show
+ g :: Read a => K a -> String
+ g = show
diff --git a/testsuite/tests/backpack/should_fail/bkpfail28.stderr b/testsuite/tests/backpack/should_fail/bkpfail28.stderr
new file mode 100644
index 0000000000..4428da9a41
--- /dev/null
+++ b/testsuite/tests/backpack/should_fail/bkpfail28.stderr
@@ -0,0 +1,27 @@
+[1 of 3] Processing p
+ [1 of 1] Compiling A[sig] ( p/A.hsig, nothing )
+[2 of 3] Processing q
+ [1 of 1] Compiling A[sig] ( q/A.hsig, nothing )
+[3 of 3] Processing r
+ [1 of 2] Compiling A[sig] ( r/A.hsig, nothing )
+ [2 of 2] Compiling R ( r/R.hs, nothing )
+
+bkpfail28.bkp:18:13: error:
+ • Overlapping instances for Show (K a) arising from a use of ‘show’
+ Matching instances:
+ instance [safe] Show a => Show (K a)
+ -- Defined at bkpfail28.bkp:11:18
+ instance [safe] Read a => Show (K a)
+ -- Defined at bkpfail28.bkp:11:18
+ • In the expression: show
+ In an equation for ‘f’: f = show
+
+bkpfail28.bkp:20:13: error:
+ • Overlapping instances for Show (K a) arising from a use of ‘show’
+ Matching instances:
+ instance [safe] Show a => Show (K a)
+ -- Defined at bkpfail28.bkp:11:18
+ instance [safe] Read a => Show (K a)
+ -- Defined at bkpfail28.bkp:11:18
+ • In the expression: show
+ In an equation for ‘g’: g = show