diff options
Diffstat (limited to 'testsuite/tests/showIface')
-rw-r--r-- | testsuite/tests/showIface/Makefile | 7 | ||||
-rw-r--r-- | testsuite/tests/showIface/Orphans.hs | 26 | ||||
-rw-r--r-- | testsuite/tests/showIface/Orphans.stdout | 6 | ||||
-rw-r--r-- | testsuite/tests/showIface/all.T | 1 |
4 files changed, 40 insertions, 0 deletions
diff --git a/testsuite/tests/showIface/Makefile b/testsuite/tests/showIface/Makefile new file mode 100644 index 0000000000..49b90342b3 --- /dev/null +++ b/testsuite/tests/showIface/Makefile @@ -0,0 +1,7 @@ +TOP=../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +Orphans: + '$(TEST_HC)' $(TEST_HC_OPTS) -c Orphans.hs + '$(TEST_HC)' $(TEST_HC_OPTS) --show-iface Orphans.hi | grep -E '^(instance |family instance |"myrule)' | grep -v 'family instance modules:' diff --git a/testsuite/tests/showIface/Orphans.hs b/testsuite/tests/showIface/Orphans.hs new file mode 100644 index 0000000000..f3b7b6adec --- /dev/null +++ b/testsuite/tests/showIface/Orphans.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE TypeFamilies #-} +{-# OPTIONS_GHC -O -Wno-inline-rule-shadowing #-} +-- Rules are ignored without -O + +module Orphans where + +import GHC.Exts (IsList(..)) + +-- Some orphan things +instance IsList Bool where + type Item Bool = Double + fromList = undefined + toList = undefined + +{-# RULES "myrule1" id id = id #-} + +-- And some non-orphan things +data X = X [Int] +instance IsList X where + type Item X = Int + fromList = undefined + toList = undefined + +f :: X -> X +f x = x +{-# RULES "myrule2" id f = f #-} diff --git a/testsuite/tests/showIface/Orphans.stdout b/testsuite/tests/showIface/Orphans.stdout new file mode 100644 index 0000000000..d61a5c98f3 --- /dev/null +++ b/testsuite/tests/showIface/Orphans.stdout @@ -0,0 +1,6 @@ +instance [orphan] IsList [Bool] = $fIsListBool +instance IsList [X] = $fIsListX +family instance Item [X] = D:R:ItemX +family instance [orphan] Item [Bool] = D:R:ItemBool +"myrule1" [orphan] forall @ a id @ (a -> a) (id @ a) = id @ a +"myrule2" forall id @ (X -> X) f = f diff --git a/testsuite/tests/showIface/all.T b/testsuite/tests/showIface/all.T new file mode 100644 index 0000000000..5c89b70b59 --- /dev/null +++ b/testsuite/tests/showIface/all.T @@ -0,0 +1 @@ +test('Orphans', normal, run_command, ['$MAKE -s --no-print-directory Orphans']) |