diff options
author | Richard Eisenberg <eir@cis.upenn.edu> | 2014-04-05 13:56:00 -0400 |
---|---|---|
committer | Richard Eisenberg <eir@cis.upenn.edu> | 2014-04-05 17:25:45 -0400 |
commit | d468cd376ffc02cf9f4755275a316be914c482be (patch) | |
tree | 3ae0b3da074be5aab808d13658bb3b0d52bde3ae /testsuite | |
parent | e81d110e7ddd381e53c3af4fbd261d29edd16725 (diff) | |
download | haskell-d468cd376ffc02cf9f4755275a316be914c482be.tar.gz |
Fix #8958.
We now do role inference on stupid datatype contexts, allowing a
lightweight role annotation syntax.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/ghci/scripts/ghci031.stdout | 4 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/rnfail055.stderr | 5 | ||||
-rw-r--r-- | testsuite/tests/roles/should_compile/T8958.hs | 13 | ||||
-rw-r--r-- | testsuite/tests/roles/should_compile/T8958.stderr | 49 | ||||
-rw-r--r-- | testsuite/tests/roles/should_compile/all.T | 1 |
5 files changed, 69 insertions, 3 deletions
diff --git a/testsuite/tests/ghci/scripts/ghci031.stdout b/testsuite/tests/ghci/scripts/ghci031.stdout index d90cc7aa00..796433e1b7 100644 --- a/testsuite/tests/ghci/scripts/ghci031.stdout +++ b/testsuite/tests/ghci/scripts/ghci031.stdout @@ -1 +1,3 @@ -data Eq a => D a = C a -- Defined at ghci031.hs:7:1 +type role D nominal +data Eq a => D a = C a + -- Defined at ghci031.hs:7:1 diff --git a/testsuite/tests/rename/should_fail/rnfail055.stderr b/testsuite/tests/rename/should_fail/rnfail055.stderr index ed17c5c5e6..99ed2d6f12 100644 --- a/testsuite/tests/rename/should_fail/rnfail055.stderr +++ b/testsuite/tests/rename/should_fail/rnfail055.stderr @@ -32,9 +32,10 @@ RnFail055.hs-boot:12:1: RnFail055.hs-boot:14:1: Type constructor ‘T2’ has conflicting definitions in the module and its hs-boot file - Main module: type role T2 representational phantom + Main module: type role T2 representational nominal data Eq b => T2 a b = T2 a - Boot file: data Eq a => T2 a b = T2 a + Boot file: type role T2 nominal representational + data Eq a => T2 a b = T2 a RnFail055.hs-boot:16:11: T3 is exported by the hs-boot file, but not exported by the module diff --git a/testsuite/tests/roles/should_compile/T8958.hs b/testsuite/tests/roles/should_compile/T8958.hs new file mode 100644 index 0000000000..b3c2910e2e --- /dev/null +++ b/testsuite/tests/roles/should_compile/T8958.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE RoleAnnotations, DatatypeContexts, IncoherentInstances, + FlexibleInstances #-} + +module T8958 where + +class Nominal a +instance Nominal a + +class Representational a +instance Representational a +type role Representational representational + +newtype (Nominal k, Representational v) => Map k v = MkMap [(k,v)] diff --git a/testsuite/tests/roles/should_compile/T8958.stderr b/testsuite/tests/roles/should_compile/T8958.stderr new file mode 100644 index 0000000000..e40865fc64 --- /dev/null +++ b/testsuite/tests/roles/should_compile/T8958.stderr @@ -0,0 +1,49 @@ + +T8958.hs:1:31: Warning: + -XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language. +TYPE SIGNATURES +TYPE CONSTRUCTORS + Map :: * -> * -> * + newtype (Nominal k, Representational v) => Map k v + No C type associated + Roles: [nominal, representational] + RecFlag NonRecursive, Promotable + = MkMap :: [(k, v)] -> Map k v Stricts: _ + FamilyInstance: none + Nominal :: * -> Constraint + class Nominal a + Roles: [nominal] + RecFlag NonRecursive + Representational :: * -> Constraint + class Representational a + Roles: [representational] + RecFlag NonRecursive +COERCION AXIOMS + axiom T8958.NTCo:Map :: Map k v = [(k, v)] +INSTANCES + instance [incoherent] Representational a + -- Defined at T8958.hs:10:10 + instance [incoherent] Nominal a -- Defined at T8958.hs:7:10 +Dependent modules: [] +Dependent packages: [base, ghc-prim, integer-gmp] + +==================== Typechecker ==================== +AbsBinds [a] [] + {Exports: [T8958.$fRepresentationala <= $dRepresentational_aJ6 + <>] + Exported types: T8958.$fRepresentationala [InlPrag=[ALWAYS] CONLIKE] + :: forall a. Representational a + [LclIdX[DFunId], + Str=DmdType, + Unf=DFun: \ (@ a) -> T8958.D:Representational TYPE a] + Binds: $dRepresentational_aJ6 = T8958.D:Representational} +AbsBinds [a] [] + {Exports: [T8958.$fNominala <= $dNominal_aJ7 + <>] + Exported types: T8958.$fNominala [InlPrag=[ALWAYS] CONLIKE] + :: forall a. Nominal a + [LclIdX[DFunId], + Str=DmdType, + Unf=DFun: \ (@ a) -> T8958.D:Nominal TYPE a] + Binds: $dNominal_aJ7 = T8958.D:Nominal} + diff --git a/testsuite/tests/roles/should_compile/all.T b/testsuite/tests/roles/should_compile/all.T index f77e61f55d..4555b0f84e 100644 --- a/testsuite/tests/roles/should_compile/all.T +++ b/testsuite/tests/roles/should_compile/all.T @@ -5,3 +5,4 @@ test('Roles4', only_ways('normal'), compile, ['-ddump-tc']) test('Roles13', only_ways('normal'), compile, ['-ddump-simpl -dsuppress-uniques']) test('Roles14', only_ways('normal'), compile, ['-ddump-tc']) test('RolesIArray', only_ways('normal'), compile, ['']) +test('T8958', only_ways('normal'), compile, ['-ddump-tc']) |