summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/rename/RnEnv.hs9
-rw-r--r--testsuite/tests/ghci/scripts/T10439.script6
-rw-r--r--testsuite/tests/ghci/scripts/T10439.stdout3
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
4 files changed, 17 insertions, 2 deletions
diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs
index 3dcf2ccb11..73dfbeb448 100644
--- a/compiler/rename/RnEnv.hs
+++ b/compiler/rename/RnEnv.hs
@@ -482,8 +482,13 @@ lookupSubBndrOcc warnIfDeprec parent doc rdr_name
[gre] -> do { addUsedRdrName warnIfDeprec gre (used_rdr_name gre)
-- Add a usage; this is an *occurrence* site
; return (gre_name gre) }
- [] -> do { addErr (unknownSubordinateErr doc rdr_name)
- ; return (mkUnboundName rdr_name) }
+ [] -> do { ns <- lookupQualifiedNameGHCi rdr_name
+ ; case ns of {
+ (n:_) -> return n ;
+ -- Unlikely to be more than one...?
+ [] -> do
+ { addErr (unknownSubordinateErr doc rdr_name)
+ ; return (mkUnboundName rdr_name) } } }
gres -> do { addNameClashErrRn rdr_name gres
; return (gre_name (head gres)) } }
where
diff --git a/testsuite/tests/ghci/scripts/T10439.script b/testsuite/tests/ghci/scripts/T10439.script
new file mode 100644
index 0000000000..7f481abadd
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T10439.script
@@ -0,0 +1,6 @@
+let tree = Data.Tree.Node 0 []
+Data.Tree.rootLabel tree
+let f (Data.Tree.Node i j) k = Data.Tree.Node k j
+f tree 1
+let g i j = i { Data.Tree.rootLabel = j }
+g tree 2
diff --git a/testsuite/tests/ghci/scripts/T10439.stdout b/testsuite/tests/ghci/scripts/T10439.stdout
new file mode 100644
index 0000000000..63a6be7820
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T10439.stdout
@@ -0,0 +1,3 @@
+0
+Node {rootLabel = 1, subForest = []}
+Node {rootLabel = 2, subForest = []}
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 384868e0d8..aecadc4fe6 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -219,6 +219,7 @@ test('T10408B', normal, run_command,
test('T10248', normal, ghci_script, ['T10248.script'])
test('T10110', normal, ghci_script, ['T10110.script'])
test('T10322', normal, ghci_script, ['T10322.script'])
+test('T10439', normal, ghci_script, ['T10439.script'])
test('T10466', normal, ghci_script, ['T10466.script'])
test('T10501', normal, ghci_script, ['T10501.script'])
test('T10508', normal, ghci_script, ['T10508.script'])