Identify fields by selector when type-checking (fixes #13644)

Authored by adamgundry on Sep 18 2017, 4:14 PM.



By the time we are type-checking patterns or expressions involving record data constructors, we have already figured out the right selector names, so we should use the names rather than comparing field labels. Overwise we end up accidentally using the wrong identifiers. This fixes Trac #13644, Trac #13847 and a whole host of duplicates.

Test Plan

new test for Trac #13847, and the test for Trac #13644 now passes

Diff Detail

rGHC Glasgow Haskell Compiler
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
adamgundry created this revision.Sep 18 2017, 4:14 PM
mpickering accepted this revision.Sep 19 2017, 4:13 AM

Looks right to me. This changes the error back to what it was in ghc-7.10.3.

This revision is now accepted and ready to land.Sep 19 2017, 4:13 AM
simonpj accepted this revision.Sep 19 2017, 8:17 AM
simonpj added a subscriber: simonpj.

I didn't check in detail but this smells right to me, and I'm sure Adam has the details right.

Thanks Adam!

This revision was automatically updated to reflect the committed changes.