summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDaniel Winograd-Cort <dwc@cs.yale.edu>2011-08-25 17:30:41 +0100
committerSimon Marlow <marlowsd@gmail.com>2011-09-21 01:14:32 +0100
commit0ce6b6c11c3df08edcc5a89190f56e5a4f2922e6 (patch)
tree918afcadddc6fba31a377cafa3af9f018e9126d0 /testsuite
parentb4d342606fd0a1fc2300291036c52ca20de7c1ab (diff)
downloadhaskell-0ce6b6c11c3df08edcc5a89190f56e5a4f2922e6.tar.gz
Test cases for GHCi data, class, etc.
Test cases for GHCi data, type, newtype, class, instance, deriving, etc declarations.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ghci054.script4
-rw-r--r--testsuite/tests/ghci/prog009/ghci.prog009.stderr2
-rw-r--r--testsuite/tests/ghci/scripts/2816.stderr2
-rw-r--r--testsuite/tests/ghci/scripts/T4127a.stderr14
-rw-r--r--testsuite/tests/ghci/scripts/T5130.stderr2
-rw-r--r--testsuite/tests/ghci/scripts/all.T17
-rw-r--r--testsuite/tests/ghci/scripts/ghci012.stdout2
-rw-r--r--testsuite/tests/ghci/scripts/ghci039.script3
-rw-r--r--testsuite/tests/ghci/scripts/ghci039.stdout1
-rw-r--r--testsuite/tests/ghci/scripts/ghci040.script4
-rw-r--r--testsuite/tests/ghci/scripts/ghci040.stdout2
-rw-r--r--testsuite/tests/ghci/scripts/ghci041.script4
-rw-r--r--testsuite/tests/ghci/scripts/ghci041.stdout1
-rw-r--r--testsuite/tests/ghci/scripts/ghci042.script10
-rw-r--r--testsuite/tests/ghci/scripts/ghci042.stdout7
-rw-r--r--testsuite/tests/ghci/scripts/ghci043.script11
-rw-r--r--testsuite/tests/ghci/scripts/ghci043.stdout2
-rw-r--r--testsuite/tests/ghci/scripts/ghci044.script10
-rw-r--r--testsuite/tests/ghci/scripts/ghci044.stderr13
-rw-r--r--testsuite/tests/ghci/scripts/ghci045.script6
-rw-r--r--testsuite/tests/ghci/scripts/ghci045.stdout2
-rw-r--r--testsuite/tests/ghci/scripts/ghci046.script22
-rw-r--r--testsuite/tests/ghci/scripts/ghci046.stdout4
-rw-r--r--testsuite/tests/ghci/scripts/ghci047.script40
-rw-r--r--testsuite/tests/ghci/scripts/ghci047.stderr12
-rw-r--r--testsuite/tests/ghci/scripts/ghci047.stdout4
-rw-r--r--testsuite/tests/ghci/scripts/ghci048.script5
-rw-r--r--testsuite/tests/ghci/scripts/ghci048.stderr10
-rw-r--r--testsuite/tests/ghci/scripts/ghci049.script9
-rw-r--r--testsuite/tests/ghci/scripts/ghci049.stdout2
-rw-r--r--testsuite/tests/ghci/scripts/ghci050.script7
-rw-r--r--testsuite/tests/ghci/scripts/ghci050.stderr8
-rw-r--r--testsuite/tests/ghci/scripts/ghci050.stdout1
-rw-r--r--testsuite/tests/ghci/scripts/ghci051.script18
-rw-r--r--testsuite/tests/ghci/scripts/ghci051.stderr5
-rw-r--r--testsuite/tests/ghci/scripts/ghci051.stdout9
-rw-r--r--testsuite/tests/ghci/scripts/ghci052.script10
-rw-r--r--testsuite/tests/ghci/scripts/ghci052.stderr27
-rw-r--r--testsuite/tests/ghci/scripts/ghci052.stdout2
-rw-r--r--testsuite/tests/ghci/scripts/ghci053.script10
-rw-r--r--testsuite/tests/ghci/scripts/ghci053.stderr14
-rw-r--r--testsuite/tests/ghci/scripts/ghci053.stdout4
-rw-r--r--testsuite/tests/ghci/scripts/ghci054.script4
-rw-r--r--testsuite/tests/ghci/scripts/ghci054.stdout1
44 files changed, 336 insertions, 11 deletions
diff --git a/testsuite/ghci054.script b/testsuite/ghci054.script
new file mode 100644
index 0000000000..7c17087ece
--- /dev/null
+++ b/testsuite/ghci054.script
@@ -0,0 +1,4 @@
+--Testing type synonyms
+type Foo = String
+let foo = "foo" :: Foo
+:t foo
diff --git a/testsuite/tests/ghci/prog009/ghci.prog009.stderr b/testsuite/tests/ghci/prog009/ghci.prog009.stderr
index 484a1b9f27..e63a322c2d 100644
--- a/testsuite/tests/ghci/prog009/ghci.prog009.stderr
+++ b/testsuite/tests/ghci/prog009/ghci.prog009.stderr
@@ -1,7 +1,7 @@
A.hs:1:16: parse error on input `where'
-<interactive>:1:1:
+<interactive>:26:1:
Not in scope: `yan'
Perhaps you meant `tan' (imported from Prelude)
diff --git a/testsuite/tests/ghci/scripts/2816.stderr b/testsuite/tests/ghci/scripts/2816.stderr
index b9c60eea43..3a9e972205 100644
--- a/testsuite/tests/ghci/scripts/2816.stderr
+++ b/testsuite/tests/ghci/scripts/2816.stderr
@@ -1,2 +1,2 @@
-<interactive>:1:1: Not in scope: `α'
+<interactive>:2:1: Not in scope: `α'
diff --git a/testsuite/tests/ghci/scripts/T4127a.stderr b/testsuite/tests/ghci/scripts/T4127a.stderr
index bd96443381..57fbf129ed 100644
--- a/testsuite/tests/ghci/scripts/T4127a.stderr
+++ b/testsuite/tests/ghci/scripts/T4127a.stderr
@@ -1,7 +1,7 @@
-
-<interactive>:1:68:
- Multiple declarations of `f'
- Declared at: <interactive>:1:32
- <interactive>:1:68
-
-<interactive>:1:108: `f' is not a (visible) method of class `Foo'
+
+<interactive>:3:68:
+ Multiple declarations of `f'
+ Declared at: <interactive>:3:32
+ <interactive>:3:68
+
+<interactive>:3:108: `f' is not a (visible) method of class `Foo'
diff --git a/testsuite/tests/ghci/scripts/T5130.stderr b/testsuite/tests/ghci/scripts/T5130.stderr
index cf9e6b40ce..b68777e594 100644
--- a/testsuite/tests/ghci/scripts/T5130.stderr
+++ b/testsuite/tests/ghci/scripts/T5130.stderr
@@ -1,5 +1,5 @@
-<interactive>:1:27:
+<interactive>:3:27:
Couldn't match type `a' with `[Char]'
In the expression: "hi"
In the expression: [x, "hi"]
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 980cb81268..5c96d2aeb4 100644
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -55,6 +55,23 @@ test('ghci035', normal, ghci_script, ['ghci035.script'])
test('ghci036', normal, ghci_script, ['ghci036.script'])
test('ghci037', req_interp, run_command, ['$MAKE -s --no-print-directory ghci037'])
test('ghci038', normal, ghci_script, ['ghci038.script'])
+test('ghci039', normal, ghci_script, ['ghci039.script'])
+test('ghci040', normal, ghci_script, ['ghci040.script'])
+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('ghci045', normal, ghci_script, ['ghci045.script'])
+test('ghci046', normal, ghci_script, ['ghci046.script'])
+test('ghci047', normal, ghci_script, ['ghci047.script'])
+test('ghci048', normal, ghci_script, ['ghci048.script'])
+test('ghci049', normal, ghci_script, ['ghci049.script'])
+test('ghci050', normal, ghci_script, ['ghci050.script'])
+test('ghci051', normal, ghci_script, ['ghci051.script'])
+test('ghci052', normal, ghci_script, ['ghci052.script'])
+test('ghci053', normal, ghci_script, ['ghci053.script'])
+test('ghci054', normal, ghci_script, ['ghci054.script'])
+test('ghci055', normal, ghci_script, ['ghci055.script'])
test('2452', normal, ghci_script, ['2452.script'])
test('T2766', normal, ghci_script, ['T2766.script'])
diff --git a/testsuite/tests/ghci/scripts/ghci012.stdout b/testsuite/tests/ghci/scripts/ghci012.stdout
index 32ceac8b06..407ef45dc3 100644
--- a/testsuite/tests/ghci/scripts/ghci012.stdout
+++ b/testsuite/tests/ghci/scripts/ghci012.stdout
@@ -1 +1 @@
-($$$) :: [b -> c] -> [b] -> [c] -- Defined at <interactive>:1:8
+($$$) :: [b -> c] -> [b] -> [c] -- Defined at <interactive>:2:8
diff --git a/testsuite/tests/ghci/scripts/ghci039.script b/testsuite/tests/ghci/scripts/ghci039.script
new file mode 100644
index 0000000000..4699a80f21
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci039.script
@@ -0,0 +1,3 @@
+--Basic deriving test
+data T = A | B deriving Show
+show A
diff --git a/testsuite/tests/ghci/scripts/ghci039.stdout b/testsuite/tests/ghci/scripts/ghci039.stdout
new file mode 100644
index 0000000000..d478a3df05
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci039.stdout
@@ -0,0 +1 @@
+"A"
diff --git a/testsuite/tests/ghci/scripts/ghci040.script b/testsuite/tests/ghci/scripts/ghci040.script
new file mode 100644
index 0000000000..cecb6842d6
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci040.script
@@ -0,0 +1,4 @@
+--Testing type and constructor shadowing
+data T = A | B
+data T = B | C
+:i A
diff --git a/testsuite/tests/ghci/scripts/ghci040.stdout b/testsuite/tests/ghci/scripts/ghci040.stdout
new file mode 100644
index 0000000000..6ea78799b1
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci040.stdout
@@ -0,0 +1,2 @@
+data main::Interactive.T = A | ...
+ -- Defined at <interactive>:3:10
diff --git a/testsuite/tests/ghci/scripts/ghci041.script b/testsuite/tests/ghci/scripts/ghci041.script
new file mode 100644
index 0000000000..9e8a05aa62
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci041.script
@@ -0,0 +1,4 @@
+--Testing more shadowing
+data T = A | B
+data R = A | C
+:i A
diff --git a/testsuite/tests/ghci/scripts/ghci041.stdout b/testsuite/tests/ghci/scripts/ghci041.stdout
new file mode 100644
index 0000000000..daf48fc25d
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci041.stdout
@@ -0,0 +1 @@
+data R = A | ... -- Defined at <interactive>:4:10
diff --git a/testsuite/tests/ghci/scripts/ghci042.script b/testsuite/tests/ghci/scripts/ghci042.script
new file mode 100644
index 0000000000..f33d7423a1
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci042.script
@@ -0,0 +1,10 @@
+--Testing record fields
+data T = A {a :: Int}
+:i A
+:i a
+let a = 3
+:i a
+a
+data R = B {a :: Int}
+:i a
+:i T
diff --git a/testsuite/tests/ghci/scripts/ghci042.stdout b/testsuite/tests/ghci/scripts/ghci042.stdout
new file mode 100644
index 0000000000..c6717daf0f
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci042.stdout
@@ -0,0 +1,7 @@
+data T = A {...} -- Defined at <interactive>:3:10
+data T = A {a :: Int} -- Defined at <interactive>:3:13
+a :: Integer -- Defined at <interactive>:6:5
+3
+data R = B {a :: Int} -- Defined at <interactive>:9:13
+data T = A {main::Interactive.a :: Int}
+ -- Defined at <interactive>:3:6
diff --git a/testsuite/tests/ghci/scripts/ghci043.script b/testsuite/tests/ghci/scripts/ghci043.script
new file mode 100644
index 0000000000..87f9877b9a
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci043.script
@@ -0,0 +1,11 @@
+--Testing custom classes and instances as well as data type shadowing
+class C a
+instance C Int
+
+data Foo = Bar | Baz
+class MyEq a where ; myeq :: a -> a -> Bool ; a `myeq` b = True
+instance MyEq Foo
+Bar `myeq` Baz
+data Foo = Bar | Baz
+instance MyEq Foo where ; a `myeq` b = False
+Baz `myeq` Bar
diff --git a/testsuite/tests/ghci/scripts/ghci043.stdout b/testsuite/tests/ghci/scripts/ghci043.stdout
new file mode 100644
index 0000000000..1cc8b5e10d
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci043.stdout
@@ -0,0 +1,2 @@
+True
+False
diff --git a/testsuite/tests/ghci/scripts/ghci044.script b/testsuite/tests/ghci/scripts/ghci044.script
new file mode 100644
index 0000000000..7af66bb935
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci044.script
@@ -0,0 +1,10 @@
+--Testing flexible and Overlapping instances
+class C a where { f :: a -> Int; f _ = 3 }
+instance C Int where { f = id }
+instance C [Int]
+: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
diff --git a/testsuite/tests/ghci/scripts/ghci044.stderr b/testsuite/tests/ghci/scripts/ghci044.stderr
new file mode 100644
index 0000000000..dfcbd10860
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci044.stderr
@@ -0,0 +1,13 @@
+
+<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 -XFlexibleInstances if you want to disable this.)
+ In the instance declaration for `C [Int]'
+
+<interactive>:8:10:
+ Overlapping instance declarations:
+ instance C a => C [a] -- Defined at <interactive>:8:10
+ instance C [Int] -- Defined at <interactive>:7:10
diff --git a/testsuite/tests/ghci/scripts/ghci045.script b/testsuite/tests/ghci/scripts/ghci045.script
new file mode 100644
index 0000000000..042d16c0be
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci045.script
@@ -0,0 +1,6 @@
+--Testing standalone deriving
+:set -XStandaloneDeriving
+data Foo = A | B | C
+deriving instance Show Foo
+A
+C
diff --git a/testsuite/tests/ghci/scripts/ghci045.stdout b/testsuite/tests/ghci/scripts/ghci045.stdout
new file mode 100644
index 0000000000..8ec30d8fdd
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci045.stdout
@@ -0,0 +1,2 @@
+A
+C
diff --git a/testsuite/tests/ghci/scripts/ghci046.script b/testsuite/tests/ghci/scripts/ghci046.script
new file mode 100644
index 0000000000..f07e06f330
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci046.script
@@ -0,0 +1,22 @@
+--Testing type families and their shadowing
+:set -XTypeFamilies
+data HTrue
+data HFalse
+type family AND a b
+type instance AND HTrue HTrue = HTrue
+type instance AND HTrue HFalse = HFalse
+type instance AND HFalse HTrue = HFalse
+type instance AND HFalse HFalse = HFalse
+type family OR a b
+type instance OR HTrue HTrue = HTrue
+type instance OR HTrue HFalse = HTrue
+type instance OR HFalse HTrue = HTrue
+type instance OR HFalse HFalse = HFalse
+:t undefined :: AND HTrue HTrue
+:t undefined :: AND (OR HFalse HTrue) (OR HTrue HFalse)
+let t = undefined :: AND HTrue HTrue
+let f = undefined :: AND HTrue HFalse
+type instance AND HTrue HTrue = HFalse
+:t t
+let t = undefined :: AND HTrue HTrue
+:t t
diff --git a/testsuite/tests/ghci/scripts/ghci046.stdout b/testsuite/tests/ghci/scripts/ghci046.stdout
new file mode 100644
index 0000000000..d600596b71
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci046.stdout
@@ -0,0 +1,4 @@
+undefined :: AND HTrue HTrue :: HTrue
+undefined :: AND (OR HFalse HTrue) (OR HTrue HFalse) :: HTrue
+t :: HTrue
+t :: HFalse
diff --git a/testsuite/tests/ghci/scripts/ghci047.script b/testsuite/tests/ghci/scripts/ghci047.script
new file mode 100644
index 0000000000..49d93047f6
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci047.script
@@ -0,0 +1,40 @@
+--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
+:set -XUndecidableInstances
+data A
+data B
+data C
+:{
+data ABorC t where
+ Foo :: Int -> ABorC A
+ Bar :: Bool -> ABorC A
+ Baz :: Char -> ABorC B
+ Quz :: ABorC B
+ Yud :: String -> ABorC C
+ Myp :: Double -> ABorC C
+:}
+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
+
+type family Or a b
+type instance Or HTrue HTrue = HTrue
+type instance Or HTrue HFalse = HTrue
+type instance Or HFalse HTrue = HTrue
+type instance Or HFalse HFalse = HFalse
+
+let f :: (Or a c ~ HTrue, TypeEq t A a, TypeEq t C c) => ABorC t -> Int ; f x = 1
+f $ Foo 1
+f $ Bar True
+f $ Baz 'a'
+f $ Quz
+f $ Yud "a"
+f $ Myp 4.3
diff --git a/testsuite/tests/ghci/scripts/ghci047.stderr b/testsuite/tests/ghci/scripts/ghci047.stderr
new file mode 100644
index 0000000000..1807dcb866
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci047.stderr
@@ -0,0 +1,12 @@
+
+<interactive>:38:1:
+ Couldn't match type `HFalse' with `HTrue'
+ In the expression: f
+ In the expression: f $ Baz 'a'
+ In an equation for `it': it = f $ Baz 'a'
+
+<interactive>:39:1:
+ Couldn't match type `HFalse' with `HTrue'
+ In the expression: f
+ In the expression: f $ Quz
+ In an equation for `it': it = f $ Quz
diff --git a/testsuite/tests/ghci/scripts/ghci047.stdout b/testsuite/tests/ghci/scripts/ghci047.stdout
new file mode 100644
index 0000000000..98fb6a6865
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci047.stdout
@@ -0,0 +1,4 @@
+1
+1
+1
+1
diff --git a/testsuite/tests/ghci/scripts/ghci048.script b/testsuite/tests/ghci/scripts/ghci048.script
new file mode 100644
index 0000000000..0a1cfc5e83
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci048.script
@@ -0,0 +1,5 @@
+--Testing proper error message for multiple declarations (a previous bug)
+data Foo = A | B
+data Foo = A | A
+data Foo = A | B
+data Foo = A | A
diff --git a/testsuite/tests/ghci/scripts/ghci048.stderr b/testsuite/tests/ghci/scripts/ghci048.stderr
new file mode 100644
index 0000000000..408c1e9ee1
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci048.stderr
@@ -0,0 +1,10 @@
+
+<interactive>:4:16:
+ Multiple declarations of `A'
+ Declared at: <interactive>:4:12
+ <interactive>:4:16
+
+<interactive>:6:16:
+ Multiple declarations of `A'
+ Declared at: <interactive>:6:12
+ <interactive>:6:16
diff --git a/testsuite/tests/ghci/scripts/ghci049.script b/testsuite/tests/ghci/scripts/ghci049.script
new file mode 100644
index 0000000000..5a3029ad11
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci049.script
@@ -0,0 +1,9 @@
+--Testing RecordWildCards (a previous bug)
+data C = C {a :: Integer, b :: Integer, c :: Integer, d :: Integer} deriving Show
+let myc = C 1 2 3 4
+:set -XFlexibleInstances
+instance Show (C -> Integer) where ; show a = "C -> field " ++ (show $ a myc)
+(a,b,c,d)
+:set -XRecordWildCards
+let C{..} = myc
+(a,b,c,d)
diff --git a/testsuite/tests/ghci/scripts/ghci049.stdout b/testsuite/tests/ghci/scripts/ghci049.stdout
new file mode 100644
index 0000000000..edd14ccb06
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci049.stdout
@@ -0,0 +1,2 @@
+(C -> field 1,C -> field 2,C -> field 3,C -> field 4)
+(1,2,3,4)
diff --git a/testsuite/tests/ghci/scripts/ghci050.script b/testsuite/tests/ghci/scripts/ghci050.script
new file mode 100644
index 0000000000..277e803294
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci050.script
@@ -0,0 +1,7 @@
+--Testing for proper name printing in complex error messages (a previous bug)
+:set -XTypeFamilies
+:set -XFlexibleInstances
+class Listable t where ; type ListableElem t :: * ; asList :: t -> [ListableElem t]
+instance Listable (a,a) where ; asList (a,b) = [a,b]
+instance Listable (a,a) where ; type ListableElem (a,a) = a ; asList (a,b) = [a,b]
+asList ("as","df")
diff --git a/testsuite/tests/ghci/scripts/ghci050.stderr b/testsuite/tests/ghci/scripts/ghci050.stderr
new file mode 100644
index 0000000000..7825133285
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci050.stderr
@@ -0,0 +1,8 @@
+
+<interactive>:6:51:
+ Couldn't match type `a' with `ListableElem (a, a)'
+ `a' is a rigid type variable bound by
+ the instance declaration at <interactive>:6:20
+ In the expression: b
+ In the expression: [a, b]
+ In an equation for `asList': asList (a, b) = [a, b]
diff --git a/testsuite/tests/ghci/scripts/ghci050.stdout b/testsuite/tests/ghci/scripts/ghci050.stdout
new file mode 100644
index 0000000000..c71a50a976
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci050.stdout
@@ -0,0 +1 @@
+["as","df"]
diff --git a/testsuite/tests/ghci/scripts/ghci051.script b/testsuite/tests/ghci/scripts/ghci051.script
new file mode 100644
index 0000000000..6833879a4a
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci051.script
@@ -0,0 +1,18 @@
+--Testing complex type and constructor shadowing
+data T = A | B
+type T' = T
+let b = B :: T'
+data T = B | C
+let c = C :: T'
+let c = C
+data T = C | D
+let d = D
+:i T
+:i T'
+:i A
+:i B
+:i C
+:i D
+:i b
+:i c
+:i d
diff --git a/testsuite/tests/ghci/scripts/ghci051.stderr b/testsuite/tests/ghci/scripts/ghci051.stderr
new file mode 100644
index 0000000000..e52b3edc24
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci051.stderr
@@ -0,0 +1,5 @@
+
+<interactive>:7:9:
+ Couldn't match expected type `T'' with actual type `T'
+ In the expression: C :: T'
+ In an equation for `c': c = C :: T'
diff --git a/testsuite/tests/ghci/scripts/ghci051.stdout b/testsuite/tests/ghci/scripts/ghci051.stdout
new file mode 100644
index 0000000000..1098275ab8
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci051.stdout
@@ -0,0 +1,9 @@
+data T = C | D -- Defined at <interactive>:0:10
+type T' = :Interactive.T -- Defined at <interactive>:0:6-7
+data :Interactive.T = A | ... -- Defined at <interactive>:0:10
+data :Interactive.T = B | ... -- Defined at <interactive>:0:12
+data T = C | ... -- Defined at <interactive>:0:14
+data T = ... | D -- Defined at <interactive>:0:18
+b :: T' -- Defined at <interactive>:0:5
+c :: :Interactive.T -- Defined at <interactive>:0:5
+d :: T -- Defined at <interactive>:0:5
diff --git a/testsuite/tests/ghci/scripts/ghci052.script b/testsuite/tests/ghci/scripts/ghci052.script
new file mode 100644
index 0000000000..53e0093f13
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci052.script
@@ -0,0 +1,10 @@
+--Testing data type and constructor shadowing with functions
+data Planet = Mercury | Venus | Earth
+let pn Mercury = "M" ; pn Venus = "V" ; pn Earth = "E"
+pn Mercury
+data Planet = Mercury | Venus | Mars
+pn Mercury
+pn Venus
+pn Mars
+pn Earth
+let pn Mercury = "M" ; pn Venus = "V" ; pn Earth = "E" ; pn Mars = "M"
diff --git a/testsuite/tests/ghci/scripts/ghci052.stderr b/testsuite/tests/ghci/scripts/ghci052.stderr
new file mode 100644
index 0000000000..c685a2aaaf
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci052.stderr
@@ -0,0 +1,27 @@
+
+<interactive>:7:4:
+ Couldn't match expected type `main::Interactive.Planet'
+ with actual type `Planet'
+ In the first argument of `pn', namely `Mercury'
+ In the expression: pn Mercury
+ In an equation for `it': it = pn Mercury
+
+<interactive>:8:4:
+ Couldn't match expected type `main::Interactive.Planet'
+ with actual type `Planet'
+ In the first argument of `pn', namely `Venus'
+ In the expression: pn Venus
+ In an equation for `it': it = pn Venus
+
+<interactive>:9:4:
+ Couldn't match expected type `main::Interactive.Planet'
+ with actual type `Planet'
+ In the first argument of `pn', namely `Mars'
+ In the expression: pn Mars
+ In an equation for `it': it = pn Mars
+
+<interactive>:11:44:
+ Couldn't match expected type `Planet'
+ with actual type `main::Interactive.Planet'
+ In the pattern: Earth
+ In an equation for `pn': pn Earth = "E"
diff --git a/testsuite/tests/ghci/scripts/ghci052.stdout b/testsuite/tests/ghci/scripts/ghci052.stdout
new file mode 100644
index 0000000000..b16e7f2b7e
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci052.stdout
@@ -0,0 +1,2 @@
+"M"
+"E"
diff --git a/testsuite/tests/ghci/scripts/ghci053.script b/testsuite/tests/ghci/scripts/ghci053.script
new file mode 100644
index 0000000000..cf104b51e9
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci053.script
@@ -0,0 +1,10 @@
+--Testing deriving in the presence of shadowing
+data Planet = Mercury | Venus | Earth deriving Eq
+let mercury = Mercury
+Venus == Earth
+data Planet = Mercury | Venus deriving Eq
+Mercury == Mercury
+mercury == Mercury
+Mercury == Venus
+Venus == Earth
+Earth == Earth
diff --git a/testsuite/tests/ghci/scripts/ghci053.stderr b/testsuite/tests/ghci/scripts/ghci053.stderr
new file mode 100644
index 0000000000..e08ad91e21
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci053.stderr
@@ -0,0 +1,14 @@
+
+<interactive>:8:12:
+ Couldn't match expected type `main::Interactive.Planet'
+ with actual type `Planet'
+ In the second argument of `(==)', namely `Mercury'
+ In the expression: mercury == Mercury
+ In an equation for `it': it = mercury == Mercury
+
+<interactive>:10:10:
+ Couldn't match expected type `Planet'
+ with actual type `main::Interactive.Planet'
+ In the second argument of `(==)', namely `Earth'
+ In the expression: Venus == Earth
+ In an equation for `it': it = Venus == Earth
diff --git a/testsuite/tests/ghci/scripts/ghci053.stdout b/testsuite/tests/ghci/scripts/ghci053.stdout
new file mode 100644
index 0000000000..0244e7b587
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci053.stdout
@@ -0,0 +1,4 @@
+False
+True
+False
+True \ No newline at end of file
diff --git a/testsuite/tests/ghci/scripts/ghci054.script b/testsuite/tests/ghci/scripts/ghci054.script
new file mode 100644
index 0000000000..7c17087ece
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci054.script
@@ -0,0 +1,4 @@
+--Testing type synonyms
+type Foo = String
+let foo = "foo" :: Foo
+:t foo
diff --git a/testsuite/tests/ghci/scripts/ghci054.stdout b/testsuite/tests/ghci/scripts/ghci054.stdout
new file mode 100644
index 0000000000..9ffc47d55d
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/ghci054.stdout
@@ -0,0 +1 @@
+foo :: Foo