Skip to content
Snippets Groups Projects
Commit 343cb32d authored by mrkgnao's avatar mrkgnao Committed by Ben Gamari
Browse files

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: default avatarSoham Chowdhury <chow.soham@gmail.com>

Reviewers: mpickering, austin, bgamari

Reviewed By: mpickering, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13568

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

(cherry picked from commit 1381c142)
parent 56a4863b
No related branches found
No related tags found
No related merge requests found
Showing
with 59 additions and 20 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment