diff options
Diffstat (limited to 'testsuite/tests/roles')
7 files changed, 328 insertions, 0 deletions
diff --git a/testsuite/tests/roles/should_compile/Roles1.stderr-ws-32 b/testsuite/tests/roles/should_compile/Roles1.stderr-ws-32 new file mode 100644 index 0000000000..cb832c918a --- /dev/null +++ b/testsuite/tests/roles/should_compile/Roles1.stderr-ws-32 @@ -0,0 +1,85 @@ +TYPE SIGNATURES +TYPE CONSTRUCTORS + type role T1 nominal + data T1 a = K1 a + Promotable + data T2 a = K2 a + Promotable + type role T3 phantom + data T3 (a :: k) = K3 + type role T4 nominal nominal + data T4 (a :: * -> *) b = K4 (a b) + data T5 a = K5 a + Promotable + type role T6 phantom + data T6 (a :: k) = K6 + type role T7 phantom representational + data T7 (a :: k) b = K7 b +COERCION AXIOMS +Dependent modules: [] +Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0, + integer-gmp-1.0.0.0] + +==================== Typechecker ==================== +Roles1.$tcT7 + = TyCon + 12795488517584970699L## + 6852268802866176810L## + Roles1.$trModule + (TrNameS "T7"#) +Roles1.$tcT6 + = TyCon + 1052116432298682626L## + 4782516991847719023L## + Roles1.$trModule + (TrNameS "T6"#) +Roles1.$tcT5 + = TyCon + 10855726709479635304L## + 5574528370049939204L## + Roles1.$trModule + (TrNameS "T5"#) +Roles1.$tc'K5 + = TyCon + 17986294396600628264L## + 15784122741796850983L## + Roles1.$trModule + (TrNameS "'K5"#) +Roles1.$tcT4 + = TyCon + 5809060867006837344L## + 8795972313583150301L## + Roles1.$trModule + (TrNameS "T4"#) +Roles1.$tcT3 + = TyCon + 17827258502042208248L## + 10404219359416482652L## + Roles1.$trModule + (TrNameS "T3"#) +Roles1.$tcT2 + = TyCon + 14324923875690440398L## + 17626224477681351106L## + Roles1.$trModule + (TrNameS "T2"#) +Roles1.$tc'K2 + = TyCon + 17795591238510508397L## + 10155757471958311507L## + Roles1.$trModule + (TrNameS "'K2"#) +Roles1.$tcT1 + = TyCon + 12633763300352597178L## + 11103726621424210926L## + Roles1.$trModule + (TrNameS "T1"#) +Roles1.$tc'K1 + = TyCon + 1949157551035372857L## + 3576433963139282451L## + Roles1.$trModule + (TrNameS "'K1"#) +Roles1.$trModule = Module (TrNameS "main"#) (TrNameS "Roles1"#) + diff --git a/testsuite/tests/roles/should_compile/Roles13.stderr-ws-32 b/testsuite/tests/roles/should_compile/Roles13.stderr-ws-32 new file mode 100644 index 0000000000..bbd47bdeba --- /dev/null +++ b/testsuite/tests/roles/should_compile/Roles13.stderr-ws-32 @@ -0,0 +1,64 @@ + +==================== Tidy Core ==================== +Result size of Tidy Core = {terms: 42, types: 18, coercions: 5} + +-- RHS size: {terms: 2, types: 0, coercions: 0} +a :: TrName +[GblId, Caf=NoCafRefs, Str=DmdType] +a = TrNameS "main"# + +-- RHS size: {terms: 2, types: 0, coercions: 0} +a1 :: TrName +[GblId, Caf=NoCafRefs, Str=DmdType] +a1 = TrNameS "Roles13"# + +-- RHS size: {terms: 3, types: 0, coercions: 0} +Roles13.$trModule :: Module +[GblId[ReflectionId], Caf=NoCafRefs, Str=DmdType] +Roles13.$trModule = Module a a1 + +-- RHS size: {terms: 2, types: 0, coercions: 0} +a2 :: TrName +[GblId, Caf=NoCafRefs, Str=DmdType] +a2 = TrNameS "Age"# + +-- RHS size: {terms: 5, types: 0, coercions: 0} +Roles13.$tcAge :: TyCon +[GblId[ReflectionId], Caf=NoCafRefs, Str=DmdType] +Roles13.$tcAge = TyCon 0L## 0L## Roles13.$trModule a2 + +-- RHS size: {terms: 2, types: 0, coercions: 0} +a3 :: TrName +[GblId, Caf=NoCafRefs, Str=DmdType] +a3 = TrNameS "'MkWrap"# + +-- RHS size: {terms: 5, types: 0, coercions: 0} +Roles13.$tc'MkWrap :: TyCon +[GblId[ReflectionId], Caf=NoCafRefs, Str=DmdType] +Roles13.$tc'MkWrap = TyCon 0L## 0L## Roles13.$trModule a3 + +-- RHS size: {terms: 2, types: 0, coercions: 0} +a4 :: TrName +[GblId, Caf=NoCafRefs, Str=DmdType] +a4 = TrNameS "Wrap"# + +-- RHS size: {terms: 5, types: 0, coercions: 0} +Roles13.$tcWrap :: TyCon +[GblId[ReflectionId], Caf=NoCafRefs, Str=DmdType] +Roles13.$tcWrap = TyCon 0L## 0L## Roles13.$trModule a4 + +-- RHS size: {terms: 2, types: 2, coercions: 0} +a5 :: Wrap Age -> Wrap Age +[GblId, Arity=1, Caf=NoCafRefs, Str=DmdType] +a5 = \ (ds :: Wrap Age) -> ds + +-- RHS size: {terms: 1, types: 0, coercions: 5} +convert :: Wrap Age -> Int +[GblId, Arity=1, Caf=NoCafRefs, Str=DmdType] +convert = + a5 + `cast` (<Wrap Age>_R -> Roles13.NTCo:Wrap[0] Roles13.NTCo:Age[0] + :: (Wrap Age -> Wrap Age) ~R# (Wrap Age -> Int)) + + + diff --git a/testsuite/tests/roles/should_compile/Roles14.stderr-ws-32 b/testsuite/tests/roles/should_compile/Roles14.stderr-ws-32 new file mode 100644 index 0000000000..4830560fe9 --- /dev/null +++ b/testsuite/tests/roles/should_compile/Roles14.stderr-ws-32 @@ -0,0 +1,21 @@ +TYPE SIGNATURES +TYPE CONSTRUCTORS + type role C2 representational + class C2 a where + meth2 :: a -> a + {-# MINIMAL meth2 #-} +COERCION AXIOMS + axiom Roles12.NTCo:C2 :: C2 a = a -> a -- Defined at Roles14.hs:6:1 +Dependent modules: [] +Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0, + integer-gmp-1.0.0.0] + +==================== Typechecker ==================== +Roles12.$tcC2 + = TyCon + 4006088231579841122L## + 4783761708993822739L## + Roles12.$trModule + (TrNameS "C2"#) +Roles12.$trModule = Module (TrNameS "main"#) (TrNameS "Roles12"#) + diff --git a/testsuite/tests/roles/should_compile/Roles2.stderr-ws-32 b/testsuite/tests/roles/should_compile/Roles2.stderr-ws-32 new file mode 100644 index 0000000000..86899e9d09 --- /dev/null +++ b/testsuite/tests/roles/should_compile/Roles2.stderr-ws-32 @@ -0,0 +1,25 @@ +TYPE SIGNATURES +TYPE CONSTRUCTORS + data T1 a = K1 (IO a) + type role T2 phantom + data T2 a = K2 (FunPtr a) +COERCION AXIOMS +Dependent modules: [] +Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0, + integer-gmp-1.0.0.0] + +==================== Typechecker ==================== +Roles2.$tcT2 + = TyCon + 5934726586329293381L## + 1923031187495159753L## + Roles2.$trModule + (TrNameS "T2"#) +Roles2.$tcT1 + = TyCon + 13879106829711353992L## + 15151456821588362072L## + Roles2.$trModule + (TrNameS "T1"#) +Roles2.$trModule = Module (TrNameS "main"#) (TrNameS "Roles2"#) + diff --git a/testsuite/tests/roles/should_compile/Roles3.stderr-ws-32 b/testsuite/tests/roles/should_compile/Roles3.stderr-ws-32 new file mode 100644 index 0000000000..82ba404d40 --- /dev/null +++ b/testsuite/tests/roles/should_compile/Roles3.stderr-ws-32 @@ -0,0 +1,57 @@ +TYPE SIGNATURES +TYPE CONSTRUCTORS + class C1 a where + meth1 :: a -> a + {-# MINIMAL meth1 #-} + class C2 a b where + meth2 :: a ~ b => a -> b + {-# MINIMAL meth2 #-} + class C3 a b where + type family F3 b :: * open + meth3 :: a -> F3 b -> F3 b + {-# MINIMAL meth3 #-} + class C4 a b where + meth4 :: a -> F4 b -> F4 b + {-# MINIMAL meth4 #-} + type family F4 a :: * open + type Syn1 a = F4 a + type Syn2 a = [a] +COERCION AXIOMS + axiom Roles3.NTCo:C1 :: C1 a = a -> a -- Defined at Roles3.hs:6:1 + axiom Roles3.NTCo:C2 :: + C2 a b = (a ~ b) => a -> b -- Defined at Roles3.hs:9:1 + axiom Roles3.NTCo:C3 :: + C3 a b = a -> F3 b -> F3 b -- Defined at Roles3.hs:12:1 + axiom Roles3.NTCo:C4 :: + C4 a b = a -> F4 b -> F4 b -- Defined at Roles3.hs:18:1 +Dependent modules: [] +Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0, + integer-gmp-1.0.0.0] + +==================== Typechecker ==================== +Roles3.$tcC4 + = TyCon + 12861862461396457184L## + 6389612623460961504L## + Roles3.$trModule + (TrNameS "C4"#) +Roles3.$tcC3 + = TyCon + 5998139369941479154L## + 6816352641934636458L## + Roles3.$trModule + (TrNameS "C3"#) +Roles3.$tcC2 + = TyCon + 8833962732139387711L## + 7891126688522429937L## + Roles3.$trModule + (TrNameS "C2"#) +Roles3.$tcC1 + = TyCon + 16242970448469140073L## + 10229725431456576413L## + Roles3.$trModule + (TrNameS "C1"#) +Roles3.$trModule = Module (TrNameS "main"#) (TrNameS "Roles3"#) + diff --git a/testsuite/tests/roles/should_compile/Roles4.stderr-ws-32 b/testsuite/tests/roles/should_compile/Roles4.stderr-ws-32 new file mode 100644 index 0000000000..7eb8141391 --- /dev/null +++ b/testsuite/tests/roles/should_compile/Roles4.stderr-ws-32 @@ -0,0 +1,32 @@ +TYPE SIGNATURES +TYPE CONSTRUCTORS + class C1 a where + meth1 :: a -> a + {-# MINIMAL meth1 #-} + class C3 a where + meth3 :: a -> Syn1 a + {-# MINIMAL meth3 #-} + type Syn1 a = [a] +COERCION AXIOMS + axiom Roles4.NTCo:C1 :: C1 a = a -> a -- Defined at Roles4.hs:6:1 + axiom Roles4.NTCo:C3 :: + C3 a = a -> Syn1 a -- Defined at Roles4.hs:11:1 +Dependent modules: [] +Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0, + integer-gmp-1.0.0.0] + +==================== Typechecker ==================== +Roles4.$tcC3 + = TyCon + 16502190608089501863L## + 13971441568961069854L## + Roles4.$trModule + (TrNameS "C3"#) +Roles4.$tcC1 + = TyCon + 11951908835899020229L## + 6518430686554778113L## + Roles4.$trModule + (TrNameS "C1"#) +Roles4.$trModule = Module (TrNameS "main"#) (TrNameS "Roles4"#) + diff --git a/testsuite/tests/roles/should_compile/T8958.stderr-ws-32 b/testsuite/tests/roles/should_compile/T8958.stderr-ws-32 new file mode 100644 index 0000000000..bd229236c5 --- /dev/null +++ b/testsuite/tests/roles/should_compile/T8958.stderr-ws-32 @@ -0,0 +1,44 @@ + +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 + type role Map nominal representational + newtype (Nominal k, Representational v) => Map k v = MkMap [(k, v)] + Promotable + class Nominal a + type role Representational representational + class Representational a +COERCION AXIOMS + axiom T8958.NTCo:Map :: + Map k v = [(k, v)] -- Defined at T8958.hs:13:1 +INSTANCES + instance [incoherent] Nominal a -- Defined at T8958.hs:7:10 + instance [incoherent] Representational a + -- Defined at T8958.hs:10:10 +Dependent modules: [] +Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0, + integer-gmp-1.0.0.0] + +==================== Typechecker ==================== +T8958.$tcMap = TyCon 0L## 0L## T8958.$trModule (TrNameS "Map"#) +T8958.$tc'MkMap = TyCon 0L## 0L## T8958.$trModule (TrNameS "'MkMap"#) +T8958.$tcRepresentational + = TyCon 0L## 0L## T8958.$trModule (TrNameS "Representational"#) +T8958.$tcNominal + = TyCon 0L## 0L## T8958.$trModule (TrNameS "Nominal"#) +T8958.$trModule = Module (TrNameS "main"#) (TrNameS "T8958"#) +AbsBinds [a] [] + {Exports: [T8958.$fRepresentationala <= $dRepresentational + <>] + Exported types: T8958.$fRepresentationala + :: forall a. Representational a + [LclIdX[DFunId], Str=DmdType] + Binds: $dRepresentational = T8958.D:Representational} +AbsBinds [a] [] + {Exports: [T8958.$fNominala <= $dNominal + <>] + Exported types: T8958.$fNominala :: forall a. Nominal a + [LclIdX[DFunId], Str=DmdType] + Binds: $dNominal = T8958.D:Nominal} + |