diff options
author | Nicolas Frisby <nicolas.frisby@gmail.com> | 2014-08-19 20:03:23 -0500 |
---|---|---|
committer | Nicolas Frisby <nicolas.frisby@gmail.com> | 2014-08-19 20:04:15 -0500 |
commit | f17ceee98221de21f896ac412b7a7ddcfc35a0c6 (patch) | |
tree | 3b3237251bee546221b9023b9c7cf0a94bc7d37a /testsuite/tests/typecheck/should_compile | |
parent | 4d3f37e0c07f35be51b8bb24374ca3163b8b9a46 (diff) | |
parent | 15faa0ec3a5a783f3949dcff6adf412d5f21bdf8 (diff) | |
download | haskell-f17ceee98221de21f896ac412b7a7ddcfc35a0c6.tar.gz |
Merge branch 'master' into late-lam-lift
Silly conflicts because of new flags -- not sure how best to resolve/avoid this.
git is requiring my commit to mention 'submodule' for some reason?
Conflicts:
compiler/main/DynFlags.hs
Diffstat (limited to 'testsuite/tests/typecheck/should_compile')
22 files changed, 111 insertions, 151 deletions
diff --git a/testsuite/tests/typecheck/should_compile/FD4.hs b/testsuite/tests/typecheck/should_compile/FD4.hs index 5d5869ca01..dcf25f7293 100644 --- a/testsuite/tests/typecheck/should_compile/FD4.hs +++ b/testsuite/tests/typecheck/should_compile/FD4.hs @@ -2,7 +2,6 @@ MultiParamTypeClasses,
FunctionalDependencies,
UndecidableInstances,
- OverlappingInstances,
FlexibleInstances,
EmptyDataDecls #-}
diff --git a/testsuite/tests/typecheck/should_compile/LoopOfTheDay3.hs b/testsuite/tests/typecheck/should_compile/LoopOfTheDay3.hs index dce1601a70..f1c1b49839 100644 --- a/testsuite/tests/typecheck/should_compile/LoopOfTheDay3.hs +++ b/testsuite/tests/typecheck/should_compile/LoopOfTheDay3.hs @@ -1,5 +1,5 @@ {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, - OverlappingInstances, UndecidableInstances #-} + UndecidableInstances #-} -- Instances compile fine but instance selection loops in GHC 6.2. -- try: :t foo (T1a 1) diff --git a/testsuite/tests/typecheck/should_compile/Makefile b/testsuite/tests/typecheck/should_compile/Makefile index 518f923689..e361556f8f 100644 --- a/testsuite/tests/typecheck/should_compile/Makefile +++ b/testsuite/tests/typecheck/should_compile/Makefile @@ -9,8 +9,8 @@ tc170: tc173: $(RM) Tc173a.o Tc173a.hi Tc173b.o Tc173b.hi - '$(TEST_HC)' $(TEST_HC_OPTS) -c -XFlexibleInstances -XTypeSynonymInstances -XUndecidableInstances -XOverlappingInstances Tc173a.hs - '$(TEST_HC)' $(TEST_HC_OPTS) -c -XUndecidableInstances -XOverlappingInstances Tc173b.hs + '$(TEST_HC)' $(TEST_HC_OPTS) -c Tc173a.hs + '$(TEST_HC)' $(TEST_HC_OPTS) -c Tc173b.hs T2412: $(RM) -f T2412.hi-boot T2412.o-boot T2412A.hi T2412A.o T2412.hi T2412.o diff --git a/testsuite/tests/typecheck/should_compile/T1470.hs b/testsuite/tests/typecheck/should_compile/T1470.hs index d466e487e9..2482696452 100644 --- a/testsuite/tests/typecheck/should_compile/T1470.hs +++ b/testsuite/tests/typecheck/should_compile/T1470.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, OverlappingInstances, UndecidableInstances, KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, UndecidableInstances, KindSignatures #-} -- Trac #1470 @@ -15,10 +15,9 @@ data FooD a = FooD instance Foo t => Sat (FooD t) -instance Data FooD a => Foo a - - -instance Foo a => Foo [a] +instance {-# OVERLAPPABLE #-} Data FooD a => Foo a +instance {-# OVERLAPS #-} Foo a => Foo [a] +instance {-# OVERLAPPING #-} Foo [Char] {- Given: Foo a, and its superclasses: Data FooD a @@ -35,4 +34,3 @@ instance Foo a => Foo [a] BUT THIS INSTANCE OVERLAPS -} -instance Foo [Char] diff --git a/testsuite/tests/typecheck/should_compile/T3018.hs b/testsuite/tests/typecheck/should_compile/T3018.hs index a0868afa24..443d73a17a 100644 --- a/testsuite/tests/typecheck/should_compile/T3018.hs +++ b/testsuite/tests/typecheck/should_compile/T3018.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE OverlappingInstances , UndecidableInstances, EmptyDataDecls #-} +{-# LANGUAGE UndecidableInstances, EmptyDataDecls #-} {-# LANGUAGE RankNTypes, KindSignatures, MultiParamTypeClasses, FlexibleInstances #-} -- Works with new constraint solver diff --git a/testsuite/tests/typecheck/should_compile/T3108.hs b/testsuite/tests/typecheck/should_compile/T3108.hs index 774d5f3801..2adaa1aef7 100644 --- a/testsuite/tests/typecheck/should_compile/T3108.hs +++ b/testsuite/tests/typecheck/should_compile/T3108.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE OverlappingInstances, UndecidableInstances, MultiParamTypeClasses, +{-# LANGUAGE UndecidableInstances, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-} module T3108 where @@ -10,9 +10,9 @@ class C0 x m0 :: x -> () m0 = const undefined -instance (C0 x, C0 y) => C0 (x,y) -instance C0 Bool -instance C0 (x,Bool) => C0 x +instance {-# OVERLAPPING #-} (C0 x, C0 y) => C0 (x,y) +instance {-# OVERLAPPING #-} C0 Bool +instance {-# OVERLAPPABLE #-} C0 (x,Bool) => C0 x foo :: () foo = m0 (1::Int) @@ -25,9 +25,9 @@ class C1 x m1 :: x -> () m1 = const undefined -instance (C1 x, C1 y) => C1 (x,y) -instance C1 Bool -instance (C2 x y, C1 (y,Bool)) => C1 x +instance {-# OVERLAPPING #-} (C1 x, C1 y) => C1 (x,y) +instance {-# OVERLAPPING #-} C1 Bool +instance {-# OVERLAPPABLE #-} (C2 x y, C1 (y,Bool)) => C1 x class C2 x y | x -> y instance C2 Int Int diff --git a/testsuite/tests/typecheck/should_compile/T4912.stderr b/testsuite/tests/typecheck/should_compile/T4912.stderr index 50d2deb3cd..0e0920f034 100644 --- a/testsuite/tests/typecheck/should_compile/T4912.stderr +++ b/testsuite/tests/typecheck/should_compile/T4912.stderr @@ -1,4 +1,12 @@ -T4912.hs:10:10: Warning: Orphan instance: instance Foo TheirData +T4912.hs:10:10: Warning: + Orphan instance: instance Foo TheirData + To avoid this + move the instance declaration to the module of the class or of the type, or + wrap the type with a newtype and declare the instance on the new type. -T4912.hs:13:10: Warning: Orphan instance: instance Bar OurData +T4912.hs:13:10: Warning: + Orphan instance: instance Bar OurData + To avoid this + move the instance declaration to the module of the class or of the type, or + wrap the type with a newtype and declare the instance on the new type. diff --git a/testsuite/tests/typecheck/should_compile/T5481.stderr b/testsuite/tests/typecheck/should_compile/T5481.stderr index df5d23b360..719c4ce5c7 100644 --- a/testsuite/tests/typecheck/should_compile/T5481.stderr +++ b/testsuite/tests/typecheck/should_compile/T5481.stderr @@ -1,8 +1,4 @@ -T5481.hs:6:5: - The RHS of an associated type declaration mentions type variable ‘b’ - All such variables must be bound on the LHS +T5481.hs:6:16: Not in scope: type variable ‘b’ -T5481.hs:8:5: - The RHS of an associated type declaration mentions type variable ‘a’ - All such variables must be bound on the LHS +T5481.hs:8:16: Not in scope: type variable ‘a’ diff --git a/testsuite/tests/typecheck/should_compile/T9117.hs b/testsuite/tests/typecheck/should_compile/T9117.hs new file mode 100644 index 0000000000..cb05bf2c23 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T9117.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE RoleAnnotations #-} + +-- Also see Note [Order of Coercible Instances] + +module T9117 where + +import Data.Coerce + +newtype Phant a = MkPhant Char +type role Phant representational + +ex1 :: Phant Bool +ex1 = coerce (MkPhant 'x' :: Phant Int) diff --git a/testsuite/tests/typecheck/should_compile/T9117_2.hs b/testsuite/tests/typecheck/should_compile/T9117_2.hs new file mode 100644 index 0000000000..e7b08d8b6c --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T9117_2.hs @@ -0,0 +1,10 @@ +module T9117_2 where + + +import Data.Coerce + +newtype Foo a = Foo (Foo a) +newtype Age = MkAge Int + +ex1 :: (Foo Age) -> (Foo Int) +ex1 = coerce diff --git a/testsuite/tests/typecheck/should_compile/Tc173a.hs b/testsuite/tests/typecheck/should_compile/Tc173a.hs index c8a589d2b3..f3704ccd9a 100644 --- a/testsuite/tests/typecheck/should_compile/Tc173a.hs +++ b/testsuite/tests/typecheck/should_compile/Tc173a.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE FlexibleInstances, TypeSynonymInstances, UndecidableInstances #-} module Tc173a where class FormValue value where @@ -8,10 +9,10 @@ class FormTextField value instance FormTextField String -instance FormTextField value => FormTextFieldIO value +instance {-# OVERLAPPABLE #-} FormTextField value => FormTextFieldIO value class FormTextFieldIO value instance FormTextFieldIO value => FormValue value -instance FormTextFieldIO value => FormTextFieldIO (Maybe value) +instance {-# OVERLAPPING #-} FormTextFieldIO value => FormTextFieldIO (Maybe value) diff --git a/testsuite/tests/typecheck/should_compile/Tc173b.hs b/testsuite/tests/typecheck/should_compile/Tc173b.hs index c98c57acd8..d14663d866 100644 --- a/testsuite/tests/typecheck/should_compile/Tc173b.hs +++ b/testsuite/tests/typecheck/should_compile/Tc173b.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE UndecidableInstances #-} module Tc173b where import Tc173a diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 373e739a3f..07d05b8a0e 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -418,3 +418,5 @@ test('T8644', normal, compile, ['']) test('T8762', normal, compile, ['']) test('MutRec', normal, compile, ['']) test('T8856', normal, compile, ['']) +test('T9117', normal, compile, ['']) +test('T9117_2', expect_broken('9117'), compile, ['']) diff --git a/testsuite/tests/typecheck/should_compile/holes2.stderr b/testsuite/tests/typecheck/should_compile/holes2.stderr index e953827e4a..0c7e5666b4 100644 --- a/testsuite/tests/typecheck/should_compile/holes2.stderr +++ b/testsuite/tests/typecheck/should_compile/holes2.stderr @@ -7,7 +7,7 @@ holes2.hs:3:5: Warning: instance Show Float -- Defined in ‘GHC.Float’ instance (Integral a, Show a) => Show (GHC.Real.Ratio a) -- Defined in ‘GHC.Real’ - ...plus 24 others + ...plus 23 others In the expression: show _ In an equation for ‘f’: f = show _ diff --git a/testsuite/tests/typecheck/should_compile/tc168.hs b/testsuite/tests/typecheck/should_compile/tc168.hs index 0aa56d169a..bd515331c4 100644 --- a/testsuite/tests/typecheck/should_compile/tc168.hs +++ b/testsuite/tests/typecheck/should_compile/tc168.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts #-} -- We want to get the type -- g :: forall a b c. C a (b,c) => a -> b diff --git a/testsuite/tests/typecheck/should_compile/tc168.stderr b/testsuite/tests/typecheck/should_compile/tc168.stderr index de1467b2b4..b46cdd04b3 100644 --- a/testsuite/tests/typecheck/should_compile/tc168.stderr +++ b/testsuite/tests/typecheck/should_compile/tc168.stderr @@ -1,11 +1,11 @@ - -tc168.hs:17:1: - Could not deduce (C a1 (a, b0)) - arising from the ambiguity check for ‘g’ - from the context (C a1 (a, b)) - bound by the inferred type for ‘g’: C a1 (a, b) => a1 -> a - at tc168.hs:17:1-16 - The type variable ‘b0’ is ambiguous - When checking that ‘g’ - has the inferred type ‘forall a b a1. C a1 (a, b) => a1 -> a’ - Probable cause: the inferred type is ambiguous +
+tc168.hs:17:1:
+ Could not deduce (C a1 (a, b0))
+ arising from the ambiguity check for ‘g’
+ from the context (C a1 (a, b))
+ bound by the inferred type for ‘g’: C a1 (a, b) => a1 -> a
+ at tc168.hs:17:1-16
+ The type variable ‘b0’ is ambiguous
+ When checking that ‘g’ has the inferred type
+ g :: forall a b a1. C a1 (a, b) => a1 -> a
+ Probable cause: the inferred type is ambiguous
diff --git a/testsuite/tests/typecheck/should_compile/tc176.hs b/testsuite/tests/typecheck/should_compile/tc176.hs index d05ccdbe29..94fdcb2227 100644 --- a/testsuite/tests/typecheck/should_compile/tc176.hs +++ b/testsuite/tests/typecheck/should_compile/tc176.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE FlexibleInstances, OverlappingInstances #-} +{-# LANGUAGE FlexibleInstances #-} {- With "hugs -98 +o test.hs" gives me: ERROR "test.hs":8 - Cannot justify constraints in instance member binding @@ -29,8 +29,8 @@ class FromStr a where typeError :: FromStr a => a -> a typeError t = error "type error" -instance FromStr [a] where +instance {-# OVERLAPPABLE #-} FromStr [a] where fromStr _ = typeError undefined -- line 8 -instance FromStr [(String,a)] where -- line 10 +instance {-# OVERLAPPING #-} FromStr [(String,a)] where -- line 10 fromStr _ = typeError undefined -- line 11 diff --git a/testsuite/tests/typecheck/should_compile/tc179.hs b/testsuite/tests/typecheck/should_compile/tc179.hs index 110950587d..62db4726a0 100644 --- a/testsuite/tests/typecheck/should_compile/tc179.hs +++ b/testsuite/tests/typecheck/should_compile/tc179.hs @@ -1,5 +1,4 @@ -{-# LANGUAGE ExistentialQuantification, FlexibleInstances, - OverlappingInstances, UndecidableInstances #-} +{-# LANGUAGE ExistentialQuantification, FlexibleInstances, UndecidableInstances #-} -- Tests context reduction for existentials @@ -7,9 +6,9 @@ module TestWrappedNode where class Foo a where { op :: a -> Int } -instance Foo a => Foo [a] where -- NB overlap +instance {-# OVERLAPPABLE #-} Foo a => Foo [a] where -- NB overlap op (x:xs) = op x -instance Foo [Int] where -- NB overlap +instance {-# OVERLAPPING #-} Foo [Int] where -- NB overlap op x = 1 data T = forall a. Foo a => MkT a diff --git a/testsuite/tests/typecheck/should_compile/tc211.stderr b/testsuite/tests/typecheck/should_compile/tc211.stderr index bdc5bd1879..533155a657 100644 --- a/testsuite/tests/typecheck/should_compile/tc211.stderr +++ b/testsuite/tests/typecheck/should_compile/tc211.stderr @@ -1,82 +1,25 @@ - -tc211.hs:15:22: - Couldn't match type ‘forall a6. a6 -> a6’ with ‘a -> a’ - Expected type: [a -> a] - Actual type: [forall a. a -> a] - In the first argument of ‘head’, namely ‘foo’ - In the first argument of ‘(:) :: - (forall a. a -> a) - -> [forall a. a -> a] -> [forall a. a -> a]’, namely - ‘(head foo)’ - -tc211.hs:48:19: - Could not deduce (Num a2) arising from the literal ‘3’ - from the context (Num a) - bound by the inferred type of - h1 :: Num a => (forall a1. a1 -> a1) -> a - at tc211.hs:(47,1)-(49,9) - The type variable ‘a2’ is ambiguous - Relevant bindings include - y :: Pair a2 (Pair a3 b1) (bound at tc211.hs:48:10) - Note: there are several potential instances: - instance Num Double -- Defined in ‘GHC.Float’ - instance Num Float -- Defined in ‘GHC.Float’ - instance Integral a => Num (GHC.Real.Ratio a) - -- Defined in ‘GHC.Real’ - ...plus three others - In the first argument of ‘g’, namely ‘3’ - In the first argument of ‘P’, namely ‘(g 3)’ - In the expression: P (g 3) (g (P 3 4)) - -tc211.hs:48:28: - Could not deduce (Num a3) arising from the literal ‘3’ - from the context (Num a) - bound by the inferred type of - h1 :: Num a => (forall a1. a1 -> a1) -> a - at tc211.hs:(47,1)-(49,9) - The type variable ‘a3’ is ambiguous - Relevant bindings include - y :: Pair a2 (Pair a3 b1) (bound at tc211.hs:48:10) - Note: there are several potential instances: - instance Num Double -- Defined in ‘GHC.Float’ - instance Num Float -- Defined in ‘GHC.Float’ - instance Integral a => Num (GHC.Real.Ratio a) - -- Defined in ‘GHC.Real’ - ...plus three others - In the first argument of ‘P’, namely ‘3’ - In the first argument of ‘g’, namely ‘(P 3 4)’ - In the second argument of ‘P’, namely ‘(g (P 3 4))’ - -tc211.hs:48:30: - Could not deduce (Num b1) arising from the literal ‘4’ - from the context (Num a) - bound by the inferred type of - h1 :: Num a => (forall a1. a1 -> a1) -> a - at tc211.hs:(47,1)-(49,9) - The type variable ‘b1’ is ambiguous - Relevant bindings include - y :: Pair a2 (Pair a3 b1) (bound at tc211.hs:48:10) - Note: there are several potential instances: - instance Num Double -- Defined in ‘GHC.Float’ - instance Num Float -- Defined in ‘GHC.Float’ - instance Integral a => Num (GHC.Real.Ratio a) - -- Defined in ‘GHC.Real’ - ...plus three others - In the second argument of ‘P’, namely ‘4’ - In the first argument of ‘g’, namely ‘(P 3 4)’ - In the second argument of ‘P’, namely ‘(g (P 3 4))’ - -tc211.hs:70:9: - Couldn't match type ‘forall a7. a7 -> a7’ with ‘a6 -> a6’ - Expected type: List (forall a. a -> a) - -> (forall a. a -> a) -> a6 -> a6 - Actual type: List (forall a. a -> a) - -> (forall a. a -> a) -> forall a. a -> a - In the expression: - foo2 :: - List (forall a. a -> a) -> (forall a. a -> a) -> (forall a. a -> a) - In the expression: - (foo2 :: - List (forall a. a -> a) - -> (forall a. a -> a) -> (forall a. a -> a)) - xs1 (\ x -> x) +
+tc211.hs:15:22:
+ Couldn't match type ‘forall a1. a1 -> a1’ with ‘a -> a’
+ Expected type: [a -> a]
+ Actual type: [forall a. a -> a]
+ In the first argument of ‘head’, namely ‘foo’
+ In the first argument of ‘(:) ::
+ (forall a. a -> a)
+ -> [forall a. a -> a] -> [forall a. a -> a]’, namely
+ ‘(head foo)’
+
+tc211.hs:70:9:
+ Couldn't match type ‘forall a2. a2 -> a2’ with ‘a1 -> a1’
+ Expected type: List (forall a. a -> a)
+ -> (forall a. a -> a) -> a1 -> a1
+ Actual type: List (forall a. a -> a)
+ -> (forall a. a -> a) -> forall a. a -> a
+ In the expression:
+ foo2 ::
+ List (forall a. a -> a) -> (forall a. a -> a) -> (forall a. a -> a)
+ In the expression:
+ (foo2 ::
+ List (forall a. a -> a)
+ -> (forall a. a -> a) -> (forall a. a -> a))
+ xs1 (\ x -> x)
diff --git a/testsuite/tests/typecheck/should_compile/tc231.hs b/testsuite/tests/typecheck/should_compile/tc231.hs index 304748994b..a7270ef769 100644 --- a/testsuite/tests/typecheck/should_compile/tc231.hs +++ b/testsuite/tests/typecheck/should_compile/tc231.hs @@ -1,5 +1,5 @@ {-# OPTIONS_GHC -ddump-types #-} -{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-} +{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts #-} -- See Trac #1456 diff --git a/testsuite/tests/typecheck/should_compile/tc231.stderr b/testsuite/tests/typecheck/should_compile/tc231.stderr index 16ddddac09..4421e8aba3 100644 --- a/testsuite/tests/typecheck/should_compile/tc231.stderr +++ b/testsuite/tests/typecheck/should_compile/tc231.stderr @@ -5,24 +5,11 @@ TYPE SIGNATURES Q s (Z [Char]) chain -> ST s () s :: forall t t1. Q t (Z [Char]) t1 -> Q t (Z [Char]) t1 TYPE CONSTRUCTORS - Q :: * -> * -> * -> * - data Q s a chain - No C type associated - Roles: [representational, representational, representational] - RecFlag NonRecursive, Promotable - = Node :: s -> a -> chain -> Q s a chain Stricts: _ _ _ - FamilyInstance: none - Z :: * -> * - data Z a - No C type associated - Roles: [representational] - RecFlag NonRecursive, Promotable - = Z :: a -> Z a Stricts: _ - FamilyInstance: none - Zork :: * -> * -> * -> Constraint - class Zork s a b | a -> b - Roles: [nominal, nominal, nominal] - RecFlag NonRecursive + data Q s a chain = Node s a chain + Promotable + data Z a = Z a + Promotable + class Zork s a b | a -> b where huh :: Q s a chain -> ST s () COERCION AXIOMS axiom ShouldCompile.NTCo:Zork :: diff --git a/testsuite/tests/typecheck/should_compile/tc253.hs b/testsuite/tests/typecheck/should_compile/tc253.hs index 4771b82435..3ce439e4f2 100644 --- a/testsuite/tests/typecheck/should_compile/tc253.hs +++ b/testsuite/tests/typecheck/should_compile/tc253.hs @@ -4,8 +4,11 @@ module ShouldCompile where class Cls a where type Fam a b :: * -- Multiple defaults! - type Fam a Bool = Maybe a - type Fam a Int = (String, a) + type Fam a x = FamHelper a x + +type family FamHelper a x +type instance FamHelper a Bool = Maybe a +type instance FamHelper a Int = (String, a) instance Cls Int where -- Gets type family from default |