Fix infix record field fixity (#11167 and #11173).
ClosedPublic

Authored by adamgundry on Dec 11 2015, 10:29 AM.

Details

Summary

This extends D1585 with proper support for infix duplicate record fields.
In particular, it is now possible to declare record fields as infix in a
module for which DuplicateRecordFields is enabled, fixity is looked up
correctly and a readable (although unpleasant) error message is generated
if multiple fields with different fixities are in scope.

As a bonus, DEPRECATED and WARNING pragmas now work for
duplicate record fields. The pragma applies to all fields with the given label.

In addition, a couple of minor DuplicateRecordFields bugs, which were
pinpointed by the T11167_ambig test case, are fixed by this patch:

  • Ambiguous infix fields can now be disambiguated by putting a type signature on the first argument
  • Polymorphic type constructor signatures (such as ContT () IO a in T11167_ambig) now work for disambiguation

Parts of this patch are from D1585 authored by @KaneTW.

Test Plan

New tests added.

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 retitled this revision from to Fix infix record field fixity (#11167 and #11173)..Dec 11 2015, 10:29 AM
adamgundry updated this object.
adamgundry edited the test plan for this revision. (Show Details)
adamgundry added reviewers: austin, bgamari, KaneTW.
adamgundry updated the Trac tickets for this revision.
adamgundry added subscribers: hvr, thomie.
bgamari accepted this revision.Dec 11 2015, 11:16 AM
bgamari added inline comments.
compiler/rename/RnExpr.hs
48

It looks like this import is redundant, causing validation to fail.

This revision is now accepted and ready to land.Dec 11 2015, 11:16 AM
adamgundry updated this revision to Diff 5609.Dec 11 2015, 11:18 AM
  • Remove redundant import
adamgundry updated this object.Dec 11 2015, 11:22 AM

Please mention KaneTW (David Kraeutmann) in the commit message (click edit revision in topright corner).

bgamari updated this object.Dec 11 2015, 3:42 PM
In D1600#47350, @thomie wrote:

Please mention KaneTW (David Kraeutmann) in the commit message (click edit revision in topright corner).

Very good point. I've gone ahead and added a reference.

This revision was automatically updated to reflect the committed changes.