diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T20143.hs | 20 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/all.T | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T20143.hs b/testsuite/tests/simplCore/should_compile/T20143.hs new file mode 100644 index 0000000000..d85f173954 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T20143.hs @@ -0,0 +1,20 @@ +{-# LANGUAGE ViewPatterns, GADTs #-} + +module T30243( getUL ) where + +import Data.Kind +import Unsafe.Coerce + +newtype AsUnitLoop a (b :: Type) (c :: Type) = UnsafeUL a + +data SafeUnitLoop a b c where + SafeUnitLoop :: !a -> SafeUnitLoop a () () + +mkSafeUnitLoop :: AsUnitLoop a b c -> SafeUnitLoop a b c +mkSafeUnitLoop (UnsafeUL a) = unsafeCoerce (SafeUnitLoop a) + +getUL :: AsUnitLoop a b c -> a +getUL (mkSafeUnitLoop -> SafeUnitLoop a) = a + +-- There should be no unsafeEqualityProof in the output +-- when compiled with -O diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 2fe050e1ba..616a469746 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -368,3 +368,4 @@ test('T19780', normal, compile, ['-O2']) test('T19794', normal, compile, ['-O']) test('T19890', [ grep_errmsg(r'= T19890.foo1') ], compile, ['-O -ddump-simpl']) test('T20125', [ grep_errmsg(r'= T20125.MkT') ], compile, ['-O -ddump-simpl -dsuppress-uniques']) +test('T20143', [ grep_errmsg(r'unsafeEqualityProof') ], compile, ['-O -ddump-simpl -dsuppress-uniques']) |