From c46faf31c3a58e009c076f5d136207436dbe9f53 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Mon, 12 Sep 2011 12:22:10 +0100 Subject: Add a test for #3103 --- .../rename/should_compile/T3103/Foreign/Ptr.hs | 14 +++++++++++ .../tests/rename/should_compile/T3103/GHC/Base.lhs | 24 ++++++++++++++++++ .../tests/rename/should_compile/T3103/GHC/Num.lhs | 29 ++++++++++++++++++++++ .../tests/rename/should_compile/T3103/GHC/Show.lhs | 18 ++++++++++++++ .../rename/should_compile/T3103/GHC/Unicode.hs | 12 +++++++++ .../should_compile/T3103/GHC/Unicode.hs-boot | 8 ++++++ .../tests/rename/should_compile/T3103/GHC/Word.hs | 26 +++++++++++++++++++ .../tests/rename/should_compile/T3103/Makefile | 4 +++ .../tests/rename/should_compile/T3103/T3103.stderr | 3 +++ testsuite/tests/rename/should_compile/T3103/test.T | 15 +++++++++++ 10 files changed, 153 insertions(+) create mode 100644 testsuite/tests/rename/should_compile/T3103/Foreign/Ptr.hs create mode 100644 testsuite/tests/rename/should_compile/T3103/GHC/Base.lhs create mode 100644 testsuite/tests/rename/should_compile/T3103/GHC/Num.lhs create mode 100644 testsuite/tests/rename/should_compile/T3103/GHC/Show.lhs create mode 100644 testsuite/tests/rename/should_compile/T3103/GHC/Unicode.hs create mode 100644 testsuite/tests/rename/should_compile/T3103/GHC/Unicode.hs-boot create mode 100644 testsuite/tests/rename/should_compile/T3103/GHC/Word.hs create mode 100644 testsuite/tests/rename/should_compile/T3103/Makefile create mode 100644 testsuite/tests/rename/should_compile/T3103/T3103.stderr create mode 100644 testsuite/tests/rename/should_compile/T3103/test.T (limited to 'testsuite/tests/rename') 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']) + -- cgit v1.2.1