[commit: ghc] master: Fix incorrect ambiguity error on identically-named data constructors (1381c14)
git at git.haskell.org
git at git.haskell.org
Thu May 11 21:33:32 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/1381c142cd8d030f9997cdc206dcad006c028bbb/ghc
>---------------------------------------------------------------
commit 1381c142cd8d030f9997cdc206dcad006c028bbb
Author: Soham Chowdhury <chow.soham at gmail.com>
Date: Thu May 11 15:40:18 2017 -0400
Fix incorrect ambiguity error on identically-named data constructors
Given multiple in-scope constructors with the same name, say `A`, and a
function of type `A -> Int`, say, the compiler reports both a "type `A`
is not in scope" and (incorrectly) an ambiguity error. The latter
shouldn't be there if `DataKinds` isn't enabled.
This issue was recommended to me by @mpickering as a suitable first
task, and the fix was also outlined in the original Trac ticket. It
involved a simple reordering of the steps taken in `lookup_demoted` in
`RnEnv.hs`. The fix is to make the `DataKinds` check happen earlier,
ensuring that the ambiguity check doesn't happen at all if we know the
constructors couldn't have been promoted.
Signed-off-by: Soham Chowdhury <chow.soham at gmail.com>
Reviewers: mpickering, austin, bgamari
Reviewed By: mpickering, bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13568
Differential Revision: https://phabricator.haskell.org/D3547
>---------------------------------------------------------------
1381c142cd8d030f9997cdc206dcad006c028bbb
compiler/rename/RnEnv.hs | 21 +++++++++++----------
testsuite/tests/module/mod122.stderr | 4 +++-
testsuite/tests/module/mod123.stderr | 4 +++-
testsuite/tests/module/mod124.stderr | 1 +
testsuite/tests/module/mod127.stderr | 1 +
testsuite/tests/module/mod29.stderr | 1 +
testsuite/tests/module/mod50.stderr | 4 +++-
.../tests/parser/should_fail/readFail001.stderr | 1 +
.../tests/rename/prog003/rename.prog003.stderr | 4 +++-
testsuite/tests/rename/should_fail/T13568.hs | 8 ++++++++
testsuite/tests/rename/should_fail/T13568.stderr | 4 ++++
testsuite/tests/rename/should_fail/T13568a.hs | 3 +++
testsuite/tests/rename/should_fail/T1595a.stderr | 4 +++-
testsuite/tests/rename/should_fail/T5745.stderr | 4 +++-
testsuite/tests/rename/should_fail/all.T | 1 +
testsuite/tests/typecheck/should_fail/T1595.stderr | 6 ++++--
.../tests/typecheck/should_fail/tcfail048.stderr | 4 +++-
.../tests/typecheck/should_fail/tcfail053.stderr | 4 +++-
18 files changed, 59 insertions(+), 20 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1381c142cd8d030f9997cdc206dcad006c028bbb
More information about the ghc-commits
mailing list