From 2f689a8bdf0bb6342794e0d8243e86e6cc4f4962 Mon Sep 17 00:00:00 2001 From: Adam Gundry Date: Fri, 8 Jan 2021 20:17:15 +0000 Subject: Add regression test for #11228 --- testsuite/tests/overloadedrecflds/should_run/T11228.hs | 13 +++++++++++++ testsuite/tests/overloadedrecflds/should_run/T11228.stdout | 1 + testsuite/tests/overloadedrecflds/should_run/all.T | 1 + 3 files changed, 15 insertions(+) create mode 100644 testsuite/tests/overloadedrecflds/should_run/T11228.hs create mode 100644 testsuite/tests/overloadedrecflds/should_run/T11228.stdout diff --git a/testsuite/tests/overloadedrecflds/should_run/T11228.hs b/testsuite/tests/overloadedrecflds/should_run/T11228.hs new file mode 100644 index 0000000000..6a90df5890 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_run/T11228.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE PatternSynonyms #-} + +pattern MkS { x } = [x] +pattern MkT { x, y } = (x,y) + +e :: ([Int], Int) +e = MkT { x = MkS { x = 0 }, y = 1 } + +f t@(MkT { x = MkS { x = x }, y = y }) = t { x = x + y, y = y - x } +f _ = undefined + +main = print (f e) diff --git a/testsuite/tests/overloadedrecflds/should_run/T11228.stdout b/testsuite/tests/overloadedrecflds/should_run/T11228.stdout new file mode 100644 index 0000000000..f750ba3510 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_run/T11228.stdout @@ -0,0 +1 @@ +(1,1) diff --git a/testsuite/tests/overloadedrecflds/should_run/all.T b/testsuite/tests/overloadedrecflds/should_run/all.T index 3136beedf8..4267c10d5e 100644 --- a/testsuite/tests/overloadedrecflds/should_run/all.T +++ b/testsuite/tests/overloadedrecflds/should_run/all.T @@ -17,3 +17,4 @@ test('overloadedlabelsrun04', [extra_files(['OverloadedLabelsRun04_A.hs']), test('hasfieldrun01', normal, compile_and_run, ['']) test('hasfieldrun02', normal, compile_and_run, ['']) test('T12243', normal, compile_and_run, ['']) +test('T11228', normal, compile_and_run, ['']) -- cgit v1.2.1