Commit 1d6ead7d authored by Zejun Wu's avatar Zejun Wu Committed by Ben Gamari

Enable using qualified field of constructor in GHCi

The -fimplicit-import-qualified made it possible to uses qualifed names
in GHCi without explicitly import the modules. But it didn't work for
field of constructor, this patch fixed this issue.

Test Plan:
cd testsuite/tests/rename/ && make
cd testsuite/tests/ghci/ && make

Reviewers: austin, simonpj

Reviewed By: austin, simonpj

Subscribers: bgamari, thomie

Differential Revision: https://phabricator.haskell.org/D900

GHC Trac Issues: #10439
parent b5e1944e
......@@ -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
......
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
0
Node {rootLabel = 1, subForest = []}
Node {rootLabel = 2, subForest = []}
......@@ -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'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment