Use data con name instead of parent in lookupRecFieldOcc
ClosedPublic

Authored by adamgundry on Jun 9 2018, 4:23 AM.

Details

Summary

This simplifies rnHsRecFields (because we no longer need to look up the parent type constructor) and corrects awkward cases involving pattern synonyms (Trac #14747) or data families (Trac #15149).

Test Plan

new tests rename/should_compile/{T14747,T15149}

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
adamgundry created this revision.Jun 9 2018, 4:23 AM
adamgundry updated this revision to Diff 16810.Jun 9 2018, 8:11 AM
  • Permit unqualified field labels even if only in scope qualified
bgamari requested changes to this revision.Jun 9 2018, 11:22 AM

It looks like there are a few testsuite failures here.

This revision now requires changes to proceed.Jun 9 2018, 11:22 AM
adamgundry updated this revision to Diff 16829.Jun 10 2018, 6:22 AM
  • Further corner cases of record field lookup
adamgundry planned changes to this revision.Jun 11 2018, 2:43 AM

Sorry for the CI noise. I'm now back at my desktop so will make sure this validates before the next diff update.

Generally great. Some mysteries.

compiler/rename/RnEnv.hs
460

I don' t understand this guard. Example?

468

I don't see the connection to Trac #9975

486

I don't understand this at all. In module Foo I guess that both MkT and x will be original names, so the renamer knows exactly what they are.

adamgundry updated this revision to Diff 16845.Jun 11 2018, 4:56 PM
  • Remove unused argument of lookupRecFieldOcc
  • Comments on how DisambiguateRecordFields (now) works

Thanks for the review. I've added extensive comments and (hopefully) validate should now pass.

bgamari accepted this revision.Jun 15 2018, 1:11 PM

Indeed this looks good.

This revision is now accepted and ready to land.Jun 15 2018, 1:11 PM
This revision was automatically updated to reflect the committed changes.