summaryrefslogtreecommitdiff
path: root/testsuite/tests/rename
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-09-12 12:22:10 +0100
committerIan Lynagh <igloo@earth.li>2011-09-12 12:22:10 +0100
commitc46faf31c3a58e009c076f5d136207436dbe9f53 (patch)
tree6107d5fbbf3535205d8bb847ad394b6e99c905f9 /testsuite/tests/rename
parentd7114e75c6b47e00dd7904861ff5fbf99cbf9696 (diff)
downloadhaskell-c46faf31c3a58e009c076f5d136207436dbe9f53.tar.gz
Add a test for #3103
Diffstat (limited to 'testsuite/tests/rename')
-rw-r--r--testsuite/tests/rename/should_compile/T3103/Foreign/Ptr.hs14
-rw-r--r--testsuite/tests/rename/should_compile/T3103/GHC/Base.lhs24
-rw-r--r--testsuite/tests/rename/should_compile/T3103/GHC/Num.lhs29
-rw-r--r--testsuite/tests/rename/should_compile/T3103/GHC/Show.lhs18
-rw-r--r--testsuite/tests/rename/should_compile/T3103/GHC/Unicode.hs12
-rw-r--r--testsuite/tests/rename/should_compile/T3103/GHC/Unicode.hs-boot8
-rw-r--r--testsuite/tests/rename/should_compile/T3103/GHC/Word.hs26
-rw-r--r--testsuite/tests/rename/should_compile/T3103/Makefile4
-rw-r--r--testsuite/tests/rename/should_compile/T3103/T3103.stderr3
-rw-r--r--testsuite/tests/rename/should_compile/T3103/test.T15
10 files changed, 153 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_compile/T3103/Foreign/Ptr.hs b/testsuite/tests/rename/should_compile/T3103/Foreign/Ptr.hs
new file mode 100644
index 0000000000..c0f1d6201c
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T3103/Foreign/Ptr.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE NoImplicitPrelude, GeneralizedNewtypeDeriving #-}
+
+module Foreign.Ptr () where
+
+import GHC.Classes (Eq)
+import GHC.Show (Show(..))
+import GHC.Num (Num)
+import GHC.Word (Word)
+
+newtype WordPtr = WordPtr Word
+ deriving (Eq,Num)
+
+instance Show WordPtr where
+
diff --git a/testsuite/tests/rename/should_compile/T3103/GHC/Base.lhs b/testsuite/tests/rename/should_compile/T3103/GHC/Base.lhs
new file mode 100644
index 0000000000..d3949afffc
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T3103/GHC/Base.lhs
@@ -0,0 +1,24 @@
+
+\begin{code}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module GHC.Base
+ (
+ module GHC.Base,
+ module GHC.Classes,
+ module GHC.Types,
+ module GHC.Prim,
+ )
+ where
+
+import GHC.Types
+import GHC.Classes
+import GHC.Prim
+import GHC.Tuple ()
+import GHC.Integer ()
+
+default ()
+
+type String = [Char]
+\end{code}
+
diff --git a/testsuite/tests/rename/should_compile/T3103/GHC/Num.lhs b/testsuite/tests/rename/should_compile/T3103/GHC/Num.lhs
new file mode 100644
index 0000000000..3b5fe063ca
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T3103/GHC/Num.lhs
@@ -0,0 +1,29 @@
+\begin{code}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module GHC.Num (Num(..)) where
+
+import GHC.Base
+import GHC.Show
+import GHC.Integer
+
+infixl 7 *
+infixl 6 +, -
+
+default ()
+
+class (Eq a, Show a) => Num a where
+ (+), (-), (*) :: a -> a -> a
+ (+) = (+)
+ (-) = (-)
+ (*) = (*)
+ negate :: a -> a
+ negate = negate
+ abs :: a -> a
+ abs = abs
+ signum :: a -> a
+ signum = signum
+ fromInteger :: Integer -> a
+ fromInteger = fromInteger
+\end{code}
+
diff --git a/testsuite/tests/rename/should_compile/T3103/GHC/Show.lhs b/testsuite/tests/rename/should_compile/T3103/GHC/Show.lhs
new file mode 100644
index 0000000000..0049b2717f
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T3103/GHC/Show.lhs
@@ -0,0 +1,18 @@
+\begin{code}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module GHC.Show (Show(..)) where
+
+import GHC.Types
+
+type ShowS = [Char] -> [Char]
+
+class Show a where
+ showsPrec :: Int -> a -> ShowS
+ show :: a -> [Char]
+ showList :: [a] -> ShowS
+
+ showsPrec = showsPrec
+ show = show
+ showList = showList
+\end{code}
diff --git a/testsuite/tests/rename/should_compile/T3103/GHC/Unicode.hs b/testsuite/tests/rename/should_compile/T3103/GHC/Unicode.hs
new file mode 100644
index 0000000000..77220371c2
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T3103/GHC/Unicode.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module GHC.Unicode (
+ isSpace,
+ ) where
+
+import GHC.Types
+import GHC.Show ()
+
+isSpace :: Char -> Bool
+isSpace = isSpace
+
diff --git a/testsuite/tests/rename/should_compile/T3103/GHC/Unicode.hs-boot b/testsuite/tests/rename/should_compile/T3103/GHC/Unicode.hs-boot
new file mode 100644
index 0000000000..995d010287
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T3103/GHC/Unicode.hs-boot
@@ -0,0 +1,8 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module GHC.Unicode where
+
+import GHC.Types
+
+isSpace :: Char -> Bool
+
diff --git a/testsuite/tests/rename/should_compile/T3103/GHC/Word.hs b/testsuite/tests/rename/should_compile/T3103/GHC/Word.hs
new file mode 100644
index 0000000000..9bfe7b77c6
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T3103/GHC/Word.hs
@@ -0,0 +1,26 @@
+{-# LANGUAGE NoImplicitPrelude, MagicHash #-}
+
+module GHC.Word (
+ Word(..),
+ ) where
+
+import GHC.Base
+import GHC.Num
+import {-# SOURCE #-} GHC.Unicode ()
+import GHC.Show (Show(..))
+import GHC.Integer
+
+data Word = W# Word# deriving Eq
+
+instance Show Word where
+
+instance Num Word where
+ (W# x#) + (W# y#) = W# (x# `plusWord#` y#)
+ (W# x#) - (W# y#) = W# (x# `minusWord#` y#)
+ (W# x#) * (W# y#) = W# (x# `timesWord#` y#)
+ negate (W# x#) = W# (int2Word# (negateInt# (word2Int# x#)))
+ abs x = x
+ signum 0 = 0
+ signum _ = 1
+ fromInteger i = W# (integerToWord i)
+
diff --git a/testsuite/tests/rename/should_compile/T3103/Makefile b/testsuite/tests/rename/should_compile/T3103/Makefile
new file mode 100644
index 0000000000..50191fd8b9
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T3103/Makefile
@@ -0,0 +1,4 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
diff --git a/testsuite/tests/rename/should_compile/T3103/T3103.stderr b/testsuite/tests/rename/should_compile/T3103/T3103.stderr
new file mode 100644
index 0000000000..4f9d84dc38
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T3103/T3103.stderr
@@ -0,0 +1,3 @@
+
+GHC/Word.hs:9:23:
+ Warning: {-# SOURCE #-} unnecessary in import of `GHC.Unicode'
diff --git a/testsuite/tests/rename/should_compile/T3103/test.T b/testsuite/tests/rename/should_compile/T3103/test.T
new file mode 100644
index 0000000000..dca5b0ee3b
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T3103/test.T
@@ -0,0 +1,15 @@
+# Args to vtc are: extra compile flags
+
+test('T3103',
+ [only_compiler_types(['ghc']),
+ expect_broken_for(3103, ['optasm', 'hpc']),
+ extra_clean(['Foreign/Ptr.hi', 'Foreign/Ptr.o',
+ 'GHC/Base.hi', 'GHC/Base.o',
+ 'GHC/Num.hi', 'GHC/Num.o',
+ 'GHC/Show.hi', 'GHC/Show.o',
+ 'GHC/Unicode.hi', 'GHC/Unicode.hi-boot',
+ 'GHC/Unicode.o', 'GHC/Unicode.o-boot',
+ 'GHC/Word.hi', 'GHC/Word.o'])],
+ multimod_compile,
+ ['Foreign.Ptr', '-v0 -hide-all-packages -package ghc-prim -package integer-gmp -package-name base'])
+