diff options
3 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/overloadedrecflds/should_fail/T19287.hs b/testsuite/tests/overloadedrecflds/should_fail/T19287.hs new file mode 100644 index 0000000000..f3dedbe4bc --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T19287.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE DuplicateRecordFields #-} +module Main where + +data R a b = R { x :: a , x :: b} + +unsafeCoerce :: a -> b +unsafeCoerce i = case (R i i){x = i} of + R a b -> b + +main = do + print (unsafeCoerce (1 :: Int) :: Bool) diff --git a/testsuite/tests/overloadedrecflds/should_fail/T19287.stderr b/testsuite/tests/overloadedrecflds/should_fail/T19287.stderr new file mode 100644 index 0000000000..c0c5a0caa9 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T19287.stderr @@ -0,0 +1,5 @@ + +T19287.hs:4:27: error: + Multiple declarations of ‘x’ + Declared at: T19287.hs:4:18 + T19287.hs:4:27 diff --git a/testsuite/tests/overloadedrecflds/should_fail/all.T b/testsuite/tests/overloadedrecflds/should_fail/all.T index 8400644908..169d47813a 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/all.T +++ b/testsuite/tests/overloadedrecflds/should_fail/all.T @@ -46,3 +46,4 @@ test('NFSDuplicate', normal, compile_fail, ['']) test('NFSExport', normal, compile_fail, ['']) test('T18999_NoDisambiguateRecordFields', normal, compile_fail, ['']) test('DRFUnused', normal, compile_fail, ['']) +test('T19287', normal, compile_fail, ['']) |