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/ghci | |
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/ghci')
46 files changed, 323 insertions, 64 deletions
diff --git a/testsuite/tests/ghci/linking/Makefile b/testsuite/tests/ghci/linking/Makefile index 60cb9cbfda..08c5158acc 100644 --- a/testsuite/tests/ghci/linking/Makefile +++ b/testsuite/tests/ghci/linking/Makefile @@ -60,6 +60,7 @@ ghcilink004 : echo 'name: test' >>$(PKG004) echo 'version: 1.0' >>$(PKG004) echo 'id: test-XXX' >>$(PKG004) + echo 'key: test-1.0' >>$(PKG004) echo 'library-dirs: $${pkgroot}' >>$(PKG004) echo 'extra-libraries: foo' >>$(PKG004) echo '[]' >$(LOCAL_PKGCONF004) @@ -87,6 +88,7 @@ ghcilink005 : echo 'name: test' >>$(PKG005) echo 'version: 1.0' >>$(PKG005) echo 'id: test-XXX' >>$(PKG005) + echo 'key: test-1.0' >>$(PKG005) echo 'library-dirs: $${pkgroot}' >>$(PKG005) echo 'extra-libraries: foo' >>$(PKG005) echo '[]' >$(LOCAL_PKGCONF005) @@ -111,6 +113,7 @@ ghcilink006 : echo "name: test" >>$(PKG006) echo "version: 1.0" >>$(PKG006) echo "id: test-XXX" >>$(PKG006) + echo "key: test-1.0" >>$(PKG006) echo "extra-libraries: stdc++" >>$(PKG006) echo "[]" >$(LOCAL_PKGCONF006) '$(GHC_PKG)' --no-user-package-db -f $(LOCAL_PKGCONF006) register $(PKG006) -v0 diff --git a/testsuite/tests/ghci/prog007/C.hs b/testsuite/tests/ghci/prog007/C.hs index 8273d6bdda..a66d000e8e 100644 --- a/testsuite/tests/ghci/prog007/C.hs +++ b/testsuite/tests/ghci/prog007/C.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE OverlappingInstances #-} - module C where import A diff --git a/testsuite/tests/ghci/prog013/Bad.hs b/testsuite/tests/ghci/prog013/Bad.hs new file mode 100644 index 0000000000..2c26204e77 --- /dev/null +++ b/testsuite/tests/ghci/prog013/Bad.hs @@ -0,0 +1,3 @@ +a = 1 +b = 2 +bad = ' diff --git a/testsuite/tests/ghci/prog013/Good.hs b/testsuite/tests/ghci/prog013/Good.hs new file mode 100644 index 0000000000..a9aeef048b --- /dev/null +++ b/testsuite/tests/ghci/prog013/Good.hs @@ -0,0 +1,3 @@ +a = 1 +b = 2 +c = 3 diff --git a/testsuite/tests/ghci/prog013/prog013.T b/testsuite/tests/ghci/prog013/prog013.T new file mode 100644 index 0000000000..020bdf81c8 --- /dev/null +++ b/testsuite/tests/ghci/prog013/prog013.T @@ -0,0 +1,2 @@ +test('prog013', normal, ghci_script, ['prog013.script']) + diff --git a/testsuite/tests/ghci/prog013/prog013.script b/testsuite/tests/ghci/prog013/prog013.script new file mode 100644 index 0000000000..b9df968933 --- /dev/null +++ b/testsuite/tests/ghci/prog013/prog013.script @@ -0,0 +1,8 @@ +:set editor /bin/echo +:l Good.hs +:e +:l Bad.hs +:e +:e ./Bad.hs +:l Good.hs +:e diff --git a/testsuite/tests/ghci/prog013/prog013.stderr b/testsuite/tests/ghci/prog013/prog013.stderr new file mode 100644 index 0000000000..d8970d4d2e --- /dev/null +++ b/testsuite/tests/ghci/prog013/prog013.stderr @@ -0,0 +1,9 @@ + +Bad.hs:3:8: + lexical error in string/character literal at character '\n' + +Bad.hs:3:8: + lexical error in string/character literal at character '\n' + +Bad.hs:3:8: + lexical error in string/character literal at character '\n' diff --git a/testsuite/tests/ghci/prog013/prog013.stdout b/testsuite/tests/ghci/prog013/prog013.stdout new file mode 100644 index 0000000000..0d621dad77 --- /dev/null +++ b/testsuite/tests/ghci/prog013/prog013.stdout @@ -0,0 +1,4 @@ +Good.hs +Bad.hs +3 +./Bad.hs +3 +Good.hs diff --git a/testsuite/tests/ghci/scripts/Defer02.stderr b/testsuite/tests/ghci/scripts/Defer02.stderr index ed36a3eb3c..7635c8f804 100644 --- a/testsuite/tests/ghci/scripts/Defer02.stderr +++ b/testsuite/tests/ghci/scripts/Defer02.stderr @@ -84,13 +84,13 @@ the type signature for k :: Int ~ Bool => Int -> Bool In the ambiguity check for: Int ~ Bool => Int -> Bool To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature for ‘k’: k :: Int ~ Bool => Int -> Bool + In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool ../../typecheck/should_run/Defer01.hs:45:6: Warning: Couldn't match expected type ‘Bool’ with actual type ‘Int’ In the ambiguity check for: Int ~ Bool => Int -> Bool To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature for ‘k’: k :: Int ~ Bool => Int -> Bool + In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool ../../typecheck/should_run/Defer01.hs:45:6: Warning: Couldn't match type ‘Int’ with ‘Bool’ diff --git a/testsuite/tests/ghci/scripts/T2766.stdout b/testsuite/tests/ghci/scripts/T2766.stdout index f8ee42ff6a..5bcbd9e75e 100644 --- a/testsuite/tests/ghci/scripts/T2766.stdout +++ b/testsuite/tests/ghci/scripts/T2766.stdout @@ -1,3 +1,3 @@ first :: Arrow to => b `to` c -> (b, d) `to` (c, d) :: Arrow to => to b c -> to (b, d) (c, d) -first :: b~>c -> (b, d)~>(c, d) :: (b ~> c) -> (b, d) ~> (c, d) +first :: b~>c -> (b, d)~>(c, d) :: b ~> c -> (b, d) ~> (c, d) diff --git a/testsuite/tests/ghci/scripts/T4087.stdout b/testsuite/tests/ghci/scripts/T4087.stdout index 3f600bd78d..2ca08aa449 100644 --- a/testsuite/tests/ghci/scripts/T4087.stdout +++ b/testsuite/tests/ghci/scripts/T4087.stdout @@ -1,4 +1,4 @@ -type role Equal nominal nominal -data Equal a b where - Equal :: Equal a a - -- Defined at T4087.hs:5:1 +type role Equal nominal nominal
+data Equal a b where
+ Equal :: Equal b b
+ -- Defined at T4087.hs:5:1
diff --git a/testsuite/tests/ghci/scripts/T4175.stdout b/testsuite/tests/ghci/scripts/T4175.stdout index 1f44bd1051..29bca027ce 100644 --- a/testsuite/tests/ghci/scripts/T4175.stdout +++ b/testsuite/tests/ghci/scripts/T4175.stdout @@ -1,18 +1,18 @@ type family A a b :: * -- Defined at T4175.hs:7:1 -type instance A (B a) b -- Defined at T4175.hs:10:1 -type instance A (Maybe a) a -- Defined at T4175.hs:9:1 -type instance A Int Int -- Defined at T4175.hs:8:1 +type instance A (B a) b = () -- Defined at T4175.hs:10:1 +type instance A (Maybe a) a = a -- Defined at T4175.hs:9:1 +type instance A Int Int = () -- Defined at T4175.hs:8:1 type role B nominal data family B a -- Defined at T4175.hs:12:1 instance G B -- Defined at T4175.hs:34:10 -data instance B () -- Defined at T4175.hs:13:15 -type instance A (B a) b -- Defined at T4175.hs:10:1 +data instance B () = MkB -- Defined at T4175.hs:13:15 +type instance A (B a) b = () -- Defined at T4175.hs:10:1 class C a where type family D a b :: * -- Defined at T4175.hs:16:5 -type D () () -- Defined at T4175.hs:22:5 -type D Int () -- Defined at T4175.hs:19:5 +type instance D () () = Bool -- Defined at T4175.hs:22:5 +type instance D Int () = String -- Defined at T4175.hs:19:5 type family E a :: * where E () = Bool E Int = String @@ -25,9 +25,9 @@ instance Eq () -- Defined in ‘GHC.Classes’ instance Ord () -- Defined in ‘GHC.Classes’ instance Read () -- Defined in ‘GHC.Read’ instance Show () -- Defined in ‘GHC.Show’ -type D () () -- Defined at T4175.hs:22:5 -type D Int () -- Defined at T4175.hs:19:5 -data instance B () -- Defined at T4175.hs:13:15 +type instance D () () = Bool -- Defined at T4175.hs:22:5 +type instance D Int () = String -- Defined at T4175.hs:19:5 +data instance B () = MkB -- Defined at T4175.hs:13:15 data Maybe a = Nothing | Just a -- Defined in ‘Data.Maybe’ instance Eq a => Eq (Maybe a) -- Defined in ‘Data.Maybe’ instance Monad Maybe -- Defined in ‘Data.Maybe’ @@ -35,7 +35,7 @@ instance Functor Maybe -- Defined in ‘Data.Maybe’ instance Ord a => Ord (Maybe a) -- Defined in ‘Data.Maybe’ instance Read a => Read (Maybe a) -- Defined in ‘GHC.Read’ instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ -type instance A (Maybe a) a -- Defined at T4175.hs:9:1 +type instance A (Maybe a) a = a -- Defined at T4175.hs:9:1 data Int = I# Int# -- Defined in ‘GHC.Types’ instance C Int -- Defined at T4175.hs:18:10 instance Bounded Int -- Defined in ‘GHC.Enum’ @@ -47,7 +47,7 @@ instance Ord Int -- Defined in ‘GHC.Classes’ instance Read Int -- Defined in ‘GHC.Read’ instance Real Int -- Defined in ‘GHC.Real’ instance Show Int -- Defined in ‘GHC.Show’ -type D Int () -- Defined at T4175.hs:19:5 -type instance A Int Int -- Defined at T4175.hs:8:1 +type instance D Int () = String -- Defined at T4175.hs:19:5 +type instance A Int Int = () -- Defined at T4175.hs:8:1 class Z a -- Defined at T4175.hs:28:1 instance F (Z a) -- Defined at T4175.hs:31:10 diff --git a/testsuite/tests/ghci/scripts/T5417.stdout b/testsuite/tests/ghci/scripts/T5417.stdout index 73d1de932d..1085a1750f 100644 --- a/testsuite/tests/ghci/scripts/T5417.stdout +++ b/testsuite/tests/ghci/scripts/T5417.stdout @@ -6,4 +6,4 @@ class C.C1 a where type role C.F nominal data family C.F a -- Defined at T5417a.hs:5:5 -data C.F (B1 a) -- Defined at T5417.hs:8:10 +data instance C.F (B1 a) = B2 a -- Defined at T5417.hs:8:10 diff --git a/testsuite/tests/ghci/scripts/T5979.stderr b/testsuite/tests/ghci/scripts/T5979.stderr index fe6e012603..bbdba12305 100644 --- a/testsuite/tests/ghci/scripts/T5979.stderr +++ b/testsuite/tests/ghci/scripts/T5979.stderr @@ -1,4 +1,7 @@ <no location info>: Could not find module ‘Control.Monad.Trans.State’ - It is not a module in the current program, or in any known package. + Perhaps you meant + Control.Monad.Trans.State (from transformers-0.4.1.0@trans_ATJ404cg3uBDx7JJZaSn1I) + Control.Monad.Trans.Class (from transformers-0.4.1.0@trans_ATJ404cg3uBDx7JJZaSn1I) + Control.Monad.Trans.Cont (from transformers-0.4.1.0@trans_ATJ404cg3uBDx7JJZaSn1I) diff --git a/testsuite/tests/ghci/scripts/T7730.script b/testsuite/tests/ghci/scripts/T7730.script new file mode 100644 index 0000000000..f1e01ee1ef --- /dev/null +++ b/testsuite/tests/ghci/scripts/T7730.script @@ -0,0 +1,7 @@ +:set -XPolyKinds +data A x y +:i A +:kind A +:set -XExistentialQuantification +data T a = forall a . MkT a +:info T diff --git a/testsuite/tests/ghci/scripts/T7730.stdout b/testsuite/tests/ghci/scripts/T7730.stdout new file mode 100644 index 0000000000..e3a08c19f4 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T7730.stdout @@ -0,0 +1,8 @@ +type role A phantom phantom +data A (x :: k) (y :: k1) + -- Defined at <interactive>:3:1 +A :: k -> k1 -> * +type role T phantom +data T (a :: k) where + MkT :: forall (k :: BOX) (a :: k) a1. a1 -> T a + -- Defined at <interactive>:7:1 diff --git a/testsuite/tests/ghci/scripts/T7873.stdout b/testsuite/tests/ghci/scripts/T7873.stdout index 0167fb2eba..215757bb69 100644 --- a/testsuite/tests/ghci/scripts/T7873.stdout +++ b/testsuite/tests/ghci/scripts/T7873.stdout @@ -1,5 +1,6 @@ data D1 where - MkD1 :: (forall (p :: k -> *) (a :: k). p a -> Int) -> D1 + MkD1 :: (forall (k1 :: BOX) (p :: k1 -> *) (a :: k1). p a -> Int) + -> D1 -- Defined at <interactive>:3:1 data D2 where MkD2 :: (forall (p :: k -> *) (a :: k). p a -> Int) -> D2 diff --git a/testsuite/tests/ghci/scripts/T7939.hs b/testsuite/tests/ghci/scripts/T7939.hs index 93b90164c6..fbdf883b51 100644 --- a/testsuite/tests/ghci/scripts/T7939.hs +++ b/testsuite/tests/ghci/scripts/T7939.hs @@ -22,6 +22,6 @@ type family K a where K '[] = Nothing K (h ': t) = Just h -type family L (a :: k) b :: k where +type family L (a :: k) (b :: *) :: k where L Int Int = Bool - L Maybe Bool = IO
\ No newline at end of file + L Maybe Bool = IO diff --git a/testsuite/tests/ghci/scripts/T7939.stdout b/testsuite/tests/ghci/scripts/T7939.stdout index 9a88b5c294..feb890c578 100644 --- a/testsuite/tests/ghci/scripts/T7939.stdout +++ b/testsuite/tests/ghci/scripts/T7939.stdout @@ -3,21 +3,23 @@ class Foo (a :: k) where -- Defined at T7939.hs:6:4 Bar :: k -> * -> * type family F a :: * -- Defined at T7939.hs:8:1 -type instance F Int -- Defined at T7939.hs:9:1 +type instance F Int = Bool -- Defined at T7939.hs:9:1 F :: * -> * -type family G a :: * where G Int = Bool +type family G a :: * where + G Int = Bool -- Defined at T7939.hs:11:1 G :: * -> * -type family H (a :: Bool) :: Bool where H 'False = 'True +type family H (a :: Bool) :: Bool where + H 'False = 'True -- Defined at T7939.hs:14:1 H :: Bool -> Bool type family J (a :: [k]) :: Bool where - J '[] = 'False - J (h : t) = 'True + J k '[] = 'False + forall (k :: BOX) (h :: k) (t :: [k]). J k (h : t) = 'True -- Defined at T7939.hs:17:1 J :: [k] -> Bool type family K (a :: [k]) :: Maybe k where - K '[] = 'Nothing - K (h : t) = 'Just h + K k '[] = 'Nothing + forall (k :: BOX) (h :: k) (t :: [k]). K k (h : t) = 'Just h -- Defined at T7939.hs:21:1 K :: [k] -> Maybe k diff --git a/testsuite/tests/ghci/scripts/T8674.stdout b/testsuite/tests/ghci/scripts/T8674.stdout index a4f5bbff6e..6c13176e66 100644 --- a/testsuite/tests/ghci/scripts/T8674.stdout +++ b/testsuite/tests/ghci/scripts/T8674.stdout @@ -1,5 +1,5 @@ type role Sing nominal data family Sing (a :: k) -- Defined at T8674.hs:4:1 -data instance Sing Bool -- Defined at T8674.hs:6:15 -data instance Sing a -- Defined at T8674.hs:5:15 +data instance Sing Bool = SBool -- Defined at T8674.hs:6:15 +data instance Sing a = SNil -- Defined at T8674.hs:5:15 diff --git a/testsuite/tests/ghci/scripts/T8931.script b/testsuite/tests/ghci/scripts/T8931.script new file mode 100644 index 0000000000..152747681c --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8931.script @@ -0,0 +1,3 @@ +:m +Data.Typeable +let {f :: Typeable a => (a->Bool) -> Bool; f _ = True} +f (\x -> (x == 3)) diff --git a/testsuite/tests/ghci/scripts/T8931.stdout b/testsuite/tests/ghci/scripts/T8931.stdout new file mode 100644 index 0000000000..0ca95142bb --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8931.stdout @@ -0,0 +1 @@ +True diff --git a/testsuite/tests/ghci/scripts/T8959.script b/testsuite/tests/ghci/scripts/T8959.script new file mode 100644 index 0000000000..124b2ab2f5 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8959.script @@ -0,0 +1,20 @@ +:set -XPatternGuards -XArrows -XRankNTypes + +:t lookup +:t undefined :: (forall a. a -> a) -> a +:t () >- () -< () >>- () -<< () +let fun foo | True <- () = () + +:set -XUnicodeSyntax + +:t lookup +:t undefined :: (forall a. a -> a) -> a +:t () >- () -< () >>- () -<< () +let fun foo | True <- () = () + +:set -XNoUnicodeSyntax + +:t lookup +:t undefined :: (forall a. a -> a) -> a +:t () >- () -< () >>- () -<< () +let fun foo | True <- () = () diff --git a/testsuite/tests/ghci/scripts/T8959.stderr b/testsuite/tests/ghci/scripts/T8959.stderr new file mode 100644 index 0000000000..b3995c3365 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8959.stderr @@ -0,0 +1,36 @@ + +<interactive>:1:1: + Arrow command found where an expression was expected: + () >- () -< () >>- () -<< () + +<interactive>:7:15: + Couldn't match expected type ‘()’ with actual type ‘Bool’ + In the pattern: True + In a stmt of a pattern guard for + an equation for ‘fun’: + True <- () + In an equation for ‘fun’: fun foo | True <- () = () + +<interactive>:1:1: + Arrow command found where an expression was expected: + () ↣ () ↢ () ⤜ () ⤛ () + +<interactive>:14:15: + Couldn't match expected type ‘()’ with actual type ‘Bool’ + In the pattern: True + In a stmt of a pattern guard for + an equation for ‘fun’: + True ← () + In an equation for ‘fun’: fun foo | True ← () = () + +<interactive>:1:1: + Arrow command found where an expression was expected: + () >- () -< () >>- () -<< () + +<interactive>:21:15: + Couldn't match expected type ‘()’ with actual type ‘Bool’ + In the pattern: True + In a stmt of a pattern guard for + an equation for ‘fun’: + True <- () + In an equation for ‘fun’: fun foo | True <- () = () diff --git a/testsuite/tests/ghci/scripts/T8959.stdout b/testsuite/tests/ghci/scripts/T8959.stdout new file mode 100644 index 0000000000..4631732c55 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8959.stdout @@ -0,0 +1,6 @@ +lookup :: Eq a => a -> [(a, b)] -> Maybe b +undefined :: (forall a. a -> a) -> a :: (forall a1. a1 -> a1) -> a +lookup ∷ Eq a ⇒ a → [(a, b)] → Maybe b +undefined :: (forall a. a -> a) -> a ∷ (∀ a1. a1 → a1) → a +lookup :: Eq a => a -> [(a, b)] -> Maybe b +undefined :: (forall a. a -> a) -> a :: (forall a1. a1 -> a1) -> a diff --git a/testsuite/tests/ghci/scripts/T8959b.hs b/testsuite/tests/ghci/scripts/T8959b.hs new file mode 100644 index 0000000000..064b2670a8 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8959b.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE UnicodeSyntax, Arrows, RankNTypes #-} +module T8959b where + +foo :: Int -> Int +foo = () + +bar :: () +bar = proc x -> do return -< x + +baz = () :: (forall a. a -> a) -> a + diff --git a/testsuite/tests/ghci/scripts/T8959b.script b/testsuite/tests/ghci/scripts/T8959b.script new file mode 100644 index 0000000000..f3c23c97a3 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8959b.script @@ -0,0 +1 @@ +:l T8959b.hs diff --git a/testsuite/tests/ghci/scripts/T8959b.stderr b/testsuite/tests/ghci/scripts/T8959b.stderr new file mode 100644 index 0000000000..4f1ac7a97b --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8959b.stderr @@ -0,0 +1,16 @@ + +T8959b.hs:5:7: + Couldn't match expected type ‘Int → Int’ with actual type ‘()’ + In the expression: () + In an equation for ‘foo’: foo = () + +T8959b.hs:8:7: + Couldn't match expected type ‘()’ with actual type ‘t0 → m0 t0’ + In the expression: proc x -> do { return ↢ x } + In an equation for ‘bar’: bar = proc x -> do { return ↢ x } + +T8959b.hs:10:7: + Couldn't match expected type ‘(∀ a2. a2 → a2) → a1’ + with actual type ‘()’ + In the expression: () ∷ (∀ a. a -> a) -> a + In an equation for ‘baz’: baz = () ∷ (∀ a. a -> a) -> a diff --git a/testsuite/tests/ghci/scripts/T9086b.script b/testsuite/tests/ghci/scripts/T9086b.script new file mode 100644 index 0000000000..d60156ad02 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T9086b.script @@ -0,0 +1,2 @@ +let main = do { putStrLn "hello"; return "discarded" } +:main diff --git a/testsuite/tests/ghci/scripts/T9086b.stdout b/testsuite/tests/ghci/scripts/T9086b.stdout new file mode 100644 index 0000000000..ce01362503 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T9086b.stdout @@ -0,0 +1 @@ +hello diff --git a/testsuite/tests/ghci/scripts/T9140.script b/testsuite/tests/ghci/scripts/T9140.script new file mode 100644 index 0000000000..833ea87413 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T9140.script @@ -0,0 +1,5 @@ +:set -XUnboxedTuples -XBangPatterns +let a = (# 1 #) +let a = (# 1, 3 #) +:set -XBangPatterns +let !a = (# 1, 3 #) diff --git a/testsuite/tests/ghci/scripts/T9140.stdout b/testsuite/tests/ghci/scripts/T9140.stdout new file mode 100644 index 0000000000..a5cb42f58a --- /dev/null +++ b/testsuite/tests/ghci/scripts/T9140.stdout @@ -0,0 +1,14 @@ + +<interactive>:3:5: + You can't mix polymorphic and unlifted bindings + a = (# 1 #) + Probable fix: use a bang pattern + +<interactive>:4:5: + You can't mix polymorphic and unlifted bindings + a = (# 1, 3 #) + Probable fix: use a bang pattern + +Top level: + GHCi can't bind a variable of unlifted type: + a :: (# Integer, Integer #) diff --git a/testsuite/tests/ghci/scripts/T9181.script b/testsuite/tests/ghci/scripts/T9181.script new file mode 100644 index 0000000000..b2239b9556 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T9181.script @@ -0,0 +1 @@ +:browse GHC.TypeLits diff --git a/testsuite/tests/ghci/scripts/T9181.stdout b/testsuite/tests/ghci/scripts/T9181.stdout new file mode 100644 index 0000000000..e1ac00cc83 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T9181.stdout @@ -0,0 +1,54 @@ +type family (GHC.TypeLits.*) (a :: GHC.TypeLits.Nat) + (b :: GHC.TypeLits.Nat) :: + GHC.TypeLits.Nat +type family (GHC.TypeLits.+) (a :: GHC.TypeLits.Nat) + (b :: GHC.TypeLits.Nat) :: + GHC.TypeLits.Nat +type family (GHC.TypeLits.-) (a :: GHC.TypeLits.Nat) + (b :: GHC.TypeLits.Nat) :: + GHC.TypeLits.Nat +type (GHC.TypeLits.<=) (x :: GHC.TypeLits.Nat) + (y :: GHC.TypeLits.Nat) = + (x GHC.TypeLits.<=? y) ~ 'True +type family (GHC.TypeLits.<=?) (a :: GHC.TypeLits.Nat) + (b :: GHC.TypeLits.Nat) :: + Bool +type family GHC.TypeLits.CmpNat (a :: GHC.TypeLits.Nat) + (b :: GHC.TypeLits.Nat) :: + Ordering +type family GHC.TypeLits.CmpSymbol (a :: GHC.TypeLits.Symbol) + (b :: GHC.TypeLits.Symbol) :: + Ordering +class GHC.TypeLits.KnownNat (n :: GHC.TypeLits.Nat) where + GHC.TypeLits.natSing :: GHC.TypeLits.SNat n +class GHC.TypeLits.KnownSymbol (n :: GHC.TypeLits.Symbol) where + GHC.TypeLits.symbolSing :: GHC.TypeLits.SSymbol n +data GHC.TypeLits.Nat +data GHC.TypeLits.SomeNat where + GHC.TypeLits.SomeNat :: GHC.TypeLits.KnownNat n => + (Data.Proxy.Proxy n) -> GHC.TypeLits.SomeNat +data GHC.TypeLits.SomeSymbol where + GHC.TypeLits.SomeSymbol :: GHC.TypeLits.KnownSymbol n => + (Data.Proxy.Proxy n) -> GHC.TypeLits.SomeSymbol +data GHC.TypeLits.Symbol +type family (GHC.TypeLits.^) (a :: GHC.TypeLits.Nat) + (b :: GHC.TypeLits.Nat) :: + GHC.TypeLits.Nat +GHC.TypeLits.natVal :: + GHC.TypeLits.KnownNat n => proxy n -> Integer +GHC.TypeLits.natVal' :: + GHC.TypeLits.KnownNat n => GHC.Prim.Proxy# n -> Integer +GHC.TypeLits.sameNat :: + (GHC.TypeLits.KnownNat a, GHC.TypeLits.KnownNat b) => + Data.Proxy.Proxy a + -> Data.Proxy.Proxy b -> Maybe (a Data.Type.Equality.:~: b) +GHC.TypeLits.sameSymbol :: + (GHC.TypeLits.KnownSymbol a, GHC.TypeLits.KnownSymbol b) => + Data.Proxy.Proxy a + -> Data.Proxy.Proxy b -> Maybe (a Data.Type.Equality.:~: b) +GHC.TypeLits.someNatVal :: Integer -> Maybe GHC.TypeLits.SomeNat +GHC.TypeLits.someSymbolVal :: String -> GHC.TypeLits.SomeSymbol +GHC.TypeLits.symbolVal :: + GHC.TypeLits.KnownSymbol n => proxy n -> String +GHC.TypeLits.symbolVal' :: + GHC.TypeLits.KnownSymbol n => GHC.Prim.Proxy# n -> String diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 6c6923d42d..f02a3c0447 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -61,6 +61,7 @@ test('ghci041', normal, ghci_script, ['ghci041.script']) test('ghci042', normal, ghci_script, ['ghci042.script']) test('ghci043', normal, ghci_script, ['ghci043.script']) test('ghci044', normal, ghci_script, ['ghci044.script']) +test('ghci044a', normal, ghci_script, ['ghci044a.script']) test('ghci045', normal, ghci_script, ['ghci045.script']) test('ghci046', normal, ghci_script, ['ghci046.script']) test('ghci047', normal, ghci_script, ['ghci047.script']) @@ -113,7 +114,7 @@ test('T5564', normal, ghci_script, ['T5564.script']) test('Defer02', normal, ghci_script, ['Defer02.script']) test('T5820', normal, ghci_script, ['T5820.script']) test('T5836', normal, ghci_script, ['T5836.script']) -test('T5979', normalise_slashes, ghci_script, ['T5979.script']) +test('T5979', [reqlib('transformers'), normalise_slashes], ghci_script, ['T5979.script']) test('T5975a', [pre_cmd('touch föøbàr1.hs'), clean_cmd('rm föøbàr1.hs')], @@ -147,6 +148,7 @@ test('T7627', normal, ghci_script, ['T7627.script']) test('T7627b', normal, ghci_script, ['T7627b.script']) test('T7586', normal, ghci_script, ['T7586.script']) test('T4175', normal, ghci_script, ['T4175.script']) +test('T7730', combined_output, ghci_script, ['T7730.script']) test('T7872', normal, ghci_script, ['T7872.script']) test('T7873', normal, ghci_script, ['T7873.script']) test('T7939', normal, ghci_script, ['T7939.script']) @@ -170,3 +172,9 @@ test('T8776', normal, ghci_script, ['T8776.script']) test('ghci059', normal, ghci_script, ['ghci059.script']) test('T8831', normal, ghci_script, ['T8831.script']) test('T8917', normal, ghci_script, ['T8917.script']) +test('T8931', normal, ghci_script, ['T8931.script']) +test('T8959', normal, ghci_script, ['T8959.script']) +test('T8959b', expect_broken(8959), ghci_script, ['T8959b.script']) +test('T9181', normal, ghci_script, ['T9181.script']) +test('T9086b', normal, ghci_script, ['T9086b.script']) +test('T9140', combined_output, ghci_script, ['T9140.script']) diff --git a/testsuite/tests/ghci/scripts/ghci016.hs b/testsuite/tests/ghci/scripts/ghci016.hs index 2740a66517..0c86f02d0f 100644 --- a/testsuite/tests/ghci/scripts/ghci016.hs +++ b/testsuite/tests/ghci/scripts/ghci016.hs @@ -13,6 +13,7 @@ instance Num T where (*) = error "urk" abs = error "urk" signum = error "urk" + negate = error "urk" -- Typing 3 at the ghci prompt should print T diff --git a/testsuite/tests/ghci/scripts/ghci025.stdout b/testsuite/tests/ghci/scripts/ghci025.stdout index 9308dd3f39..9cc88b8a07 100644 --- a/testsuite/tests/ghci/scripts/ghci025.stdout +++ b/testsuite/tests/ghci/scripts/ghci025.stdout @@ -11,7 +11,7 @@ class C a b where c4 :: a1 -> b c1 :: (C a b, N b) => a -> b c2 :: (C a b, N b, S b) => a -> b -c3 :: C a b => forall a1. a1 -> b +c3 :: C a b => forall a. a -> b c4 :: C a b => forall a1. a1 -> b -- imported via Control.Monad class Monad m => MonadPlus (m :: * -> *) where @@ -69,7 +69,7 @@ class C a b where c4 :: a1 -> b c1 :: (C a b, N b) => a -> b c2 :: (C a b, N b, S b) => a -> b -c3 :: C a b => forall a1. a1 -> b +c3 :: C a b => forall a. a -> b c4 :: C a b => forall a1. a1 -> b :browse! T -- with -fprint-explicit-foralls -- defined locally @@ -83,7 +83,7 @@ class C a b where c4 :: forall a1. a1 -> b c1 :: forall a b. (C a b, N b) => a -> b c2 :: forall a b. (C a b, N b, S b) => a -> b -c3 :: forall a b. C a b => forall a1. a1 -> b +c3 :: forall a b. C a b => forall a. a -> b c4 :: forall a b. C a b => forall a1. a1 -> b -- test :browse! <target> relative to different contexts :browse! Ghci025C -- from *Ghci025C> 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/ghci/scripts/ghci044.script b/testsuite/tests/ghci/scripts/ghci044.script index 7af66bb935..d6f12ada6e 100644 --- a/testsuite/tests/ghci/scripts/ghci044.script +++ b/testsuite/tests/ghci/scripts/ghci044.script @@ -1,10 +1,15 @@ --Testing flexible and Overlapping instances -class C a where { f :: a -> Int; f _ = 3 } -instance C Int where { f = id } -instance C [Int] +class C a where { f :: a -> String; f _ = "Default" } +instance C Int where { f _ = "Zeroth" } :set -XFlexibleInstances -instance C [Int] -instance C a => C [a] where f xs = length xs --- ***This should be an overlapping instances error!*** -:set -XOverlappingInstances -instance C a => C [a] where f xs = length xs +instance C [Int] where f _ = "First" +f [3::Int] +instance C a => C [a] where f xs = "Second" +f [4::Int] -- ***This should be an overlapping instances error!*** +instance {-# OVERLAPPABLE #-} C a => C [a] where f xs = "Third" +f [5::Int] -- Should be fine +instance {-# OVERLAPPABLE #-} C a => C [a] where f xs = "Fourth" +f [6::Int] -- Should be fine too, overrides +instance C Bool where { f _ = "Bool" } +f [True] -- Should be fine too, overrides + diff --git a/testsuite/tests/ghci/scripts/ghci044.stderr b/testsuite/tests/ghci/scripts/ghci044.stderr index c319dd1f1c..9bc8df9994 100644 --- a/testsuite/tests/ghci/scripts/ghci044.stderr +++ b/testsuite/tests/ghci/scripts/ghci044.stderr @@ -1,13 +1,8 @@ -<interactive>:5:10: - Illegal instance declaration for ‘C [Int]’ - (All instance types must be of the form (T a1 ... an) - where a1 ... an are *distinct type variables*, - and each type variable appears at most once in the instance head. - Use FlexibleInstances if you want to disable this.) - In the instance declaration for ‘C [Int]’ - -<interactive>:7:10: - Overlapping instance declarations: - instance C [Int] -- Defined at <interactive>:7:10 +<interactive>:9:1: + Overlapping instances for C [Int] arising from a use of ‘f’ + Matching instances: + instance C [Int] -- Defined at <interactive>:6:10 instance C a => C [a] -- Defined at <interactive>:8:10 + In the expression: f [4 :: Int] + In an equation for ‘it’: it = f [4 :: Int] diff --git a/testsuite/tests/ghci/scripts/ghci044.stdout b/testsuite/tests/ghci/scripts/ghci044.stdout new file mode 100644 index 0000000000..eadd22f710 --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci044.stdout @@ -0,0 +1,4 @@ +"First"
+"First"
+"First"
+"Fourth"
diff --git a/testsuite/tests/ghci/scripts/ghci044a.hs b/testsuite/tests/ghci/scripts/ghci044a.hs new file mode 100644 index 0000000000..ac400d3ef9 --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci044a.hs @@ -0,0 +1,9 @@ +--Testing flexible and Overlapping instances +class C a where { f :: a -> String; f _ = 3 } +instance C Int where { f = id } +:set -XFlexibleInstances +instance C [Int] where f _ = "First" +f [3::Int] +-- Should override the identical one preceding +instance C [Int] where f _ = "Second" +f [3::Int] diff --git a/testsuite/tests/ghci/scripts/ghci044a.script b/testsuite/tests/ghci/scripts/ghci044a.script new file mode 100644 index 0000000000..d78c5c25bc --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci044a.script @@ -0,0 +1,9 @@ +--Testing flexible and Overlapping instances +class C a where { f :: a -> String; f _ = "Default" } +instance C Int where { f _ = "Zeroth" } +:set -XFlexibleInstances +instance C [Int] where f _ = "First" +f [3::Int] +-- Should override the identical one preceding +instance C [Int] where f _ = "Second" +f [3::Int] diff --git a/testsuite/tests/ghci/scripts/ghci044a.stdout b/testsuite/tests/ghci/scripts/ghci044a.stdout new file mode 100644 index 0000000000..fe475f4745 --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci044a.stdout @@ -0,0 +1,2 @@ +"First" +"Second" diff --git a/testsuite/tests/ghci/scripts/ghci047.script b/testsuite/tests/ghci/scripts/ghci047.script index 49d93047f6..70cc5181d8 100644 --- a/testsuite/tests/ghci/scripts/ghci047.script +++ b/testsuite/tests/ghci/scripts/ghci047.script @@ -1,7 +1,6 @@ --Testing GADTs, type families as well as a ton of crazy type stuff :set -XGADTs :set -XTypeFamilies -:set -XOverlappingInstances :set -XFunctionalDependencies :set -XFlexibleContexts :set -XFlexibleInstances @@ -22,8 +21,9 @@ data HTrue data HFalse class TypeEq x y b | x y -> b -instance (HTrue ~ b) => TypeEq x x b -instance (HFalse ~ b) => TypeEq x y b +instance {-# OVERLAPS #-} (HTrue ~ b) => TypeEq x x b +instance {-# OVERLAPS #-} (HTrue ~ b) => TypeEq x x b +instance {-# OVERLAPS #-} (HFalse ~ b) => TypeEq x y b type family Or a b type instance Or HTrue HTrue = HTrue diff --git a/testsuite/tests/ghci/scripts/ghci059.stdout b/testsuite/tests/ghci/scripts/ghci059.stdout index 6b2c8f886e..ffc893f363 100644 --- a/testsuite/tests/ghci/scripts/ghci059.stdout +++ b/testsuite/tests/ghci/scripts/ghci059.stdout @@ -1,4 +1,6 @@ type role Coercible representational representational class Coercible (a :: k) (b :: k) -- Defined in ‘GHC.Types’ -coerce :: Coercible a b => a -> b -- Defined in ‘GHC.Prim’ +coerce :: + forall (k :: BOX) (a :: k) (b :: k). Coercible a b => a -> b + -- Defined in ‘GHC.Prim’ |