summaryrefslogtreecommitdiff
path: root/testsuite/tests/rename/should_fail/T14307.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-10-03 14:42:56 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2017-10-03 14:42:56 +0100
commitcb767542307b41c91061e743a4a4f448949b34cf (patch)
treebb5652c37ad3da06d53558c19144d8313415c5d7 /testsuite/tests/rename/should_fail/T14307.hs
parentdbbee1bacef1a8accc630908c31cf267a3cb98a9 (diff)
downloadhaskell-cb767542307b41c91061e743a4a4f448949b34cf.tar.gz
Suppress error cascade in record fields
When a record contruction or pattern uses a data constructor that isn't in scope, we may produce spurious ambiguous-field errors (Trac #14307). E.g. f (A { fld = x }) = e where 'A' is not in scope. We want to draw attention to the out-of-scope data constructor first; once that is fixed we can think about the fields. This patch suppresses the field errors if the data con is out of scope.
Diffstat (limited to 'testsuite/tests/rename/should_fail/T14307.hs')
-rw-r--r--testsuite/tests/rename/should_fail/T14307.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_fail/T14307.hs b/testsuite/tests/rename/should_fail/T14307.hs
new file mode 100644
index 0000000000..9bb33b7425
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T14307.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE NamedFieldPuns #-}
+
+module T14307 where
+
+data A = A { field :: Int }
+data B = B { field :: Int }
+
+f :: B -> Int
+f (C { field }) = field