diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2017-02-27 15:52:27 -0800 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2017-03-02 15:58:18 -0800 |
commit | 984c6097c63096d10789f6eb6da6f6656195cdaf (patch) | |
tree | 514104e1e1426db8d4f421187c5b8c2e650b938f /testsuite/tests/backpack | |
parent | 4aada7a6c13752652cfce5e04f015a8909553917 (diff) | |
download | haskell-984c6097c63096d10789f6eb6da6f6656195cdaf.tar.gz |
Disallow non-nullary constraint synonyms on class.
Test Plan: validate
Reviewers: simonpj, bgamari, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3230
Diffstat (limited to 'testsuite/tests/backpack')
-rw-r--r-- | testsuite/tests/backpack/should_compile/bkp39.bkp | 6 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_fail/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_fail/bkpfail46.bkp | 17 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_fail/bkpfail46.stderr | 20 |
4 files changed, 40 insertions, 4 deletions
diff --git a/testsuite/tests/backpack/should_compile/bkp39.bkp b/testsuite/tests/backpack/should_compile/bkp39.bkp index bf98b10c96..a6216edc24 100644 --- a/testsuite/tests/backpack/should_compile/bkp39.bkp +++ b/testsuite/tests/backpack/should_compile/bkp39.bkp @@ -3,7 +3,6 @@ unit p where signature A where import Prelude hiding ((==)) class K a - class K2 a infix 4 == (==) :: K a => a -> a -> Bool module M where @@ -11,8 +10,7 @@ unit p where import A f a b c = a == b && b == c unit q where - module A(K, K2, (==)) where - type K a = Eq a - type K2 = Eq + module A(K, (==)) where + type K = Eq unit r where dependency p[A=q:A] diff --git a/testsuite/tests/backpack/should_fail/all.T b/testsuite/tests/backpack/should_fail/all.T index 77b7aa23d8..82b4e6803b 100644 --- a/testsuite/tests/backpack/should_fail/all.T +++ b/testsuite/tests/backpack/should_fail/all.T @@ -41,3 +41,4 @@ test('bkpfail42', normal, backpack_compile_fail, ['']) test('bkpfail43', normal, backpack_compile_fail, ['']) test('bkpfail44', normal, backpack_compile_fail, ['']) test('bkpfail45', normal, backpack_compile_fail, ['']) +test('bkpfail46', normal, backpack_compile_fail, ['']) diff --git a/testsuite/tests/backpack/should_fail/bkpfail46.bkp b/testsuite/tests/backpack/should_fail/bkpfail46.bkp new file mode 100644 index 0000000000..0fc8b676a8 --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail46.bkp @@ -0,0 +1,17 @@ +{-# LANGUAGE ConstraintKinds #-} +unit p where + signature A where + import Prelude hiding ((==)) + class K a + infix 4 == + (==) :: K a => a -> a -> Bool + module M where + import Prelude hiding ((==)) + import A + f a b c = a == b && b == c +unit q where + module A(K, (==)) where + -- This won't match because it's not nullary + type K a = Eq a +unit r where + dependency p[A=q:A] diff --git a/testsuite/tests/backpack/should_fail/bkpfail46.stderr b/testsuite/tests/backpack/should_fail/bkpfail46.stderr new file mode 100644 index 0000000000..9aeaccbb7e --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail46.stderr @@ -0,0 +1,20 @@ +[1 of 3] Processing p + [1 of 2] Compiling A[sig] ( p/A.hsig, nothing ) + [2 of 2] Compiling M ( p/M.hs, nothing ) +[2 of 3] Processing q + Instantiating q + [1 of 1] Compiling A ( q/A.hs, bkpfail46.out/q/A.o ) +[3 of 3] Processing r + Instantiating r + [1 of 1] Including p[A=q:A] + Instantiating p[A=q:A] + [1 of 2] Compiling A[sig] ( p/A.hsig, bkpfail46.out/p/p-HVmFlcYSefiK5n1aDP1v7x/A.o ) + +bkpfail46.bkp:15:9: error: + ⢠Type constructor âKâ has conflicting definitions in the module + and its hsig file + Main module: type K a = GHC.Classes.Eq a :: Constraint + Hsig file: class K a + Illegal parameterized type synonym in implementation of abstract data. + (Try eta reducing your type synonym so that it is nullary.) + ⢠while checking that q:A implements signature A in p[A=q:A] |