Implement HasField constraint solving and modify OverloadedLabels
authorAdam Gundry <adam@well-typed.com>
Tue, 14 Feb 2017 14:53:28 +0000 (09:53 -0500)
committerBen Gamari <ben@smart-cactus.org>
Tue, 14 Feb 2017 15:53:01 +0000 (10:53 -0500)
commitda493897ac6ee2b17a0c58b51315f9d136de730d
tree08e13ee790290eada30f1ff1c7d1a2cae9f9d69b
parentc3bbd1afc85cd634d8d26e27bafb92cc7481667b
Implement HasField constraint solving and modify OverloadedLabels

This implements automatic constraint solving for the new HasField class
and modifies the existing OverloadedLabels extension, as described in
the GHC proposal
(https://github.com/ghc-proposals/ghc-proposals/pull/6). Per the current
form of the proposal, it does *not* currently introduce a separate
`OverloadedRecordFields` extension.

This replaces D1687.

The users guide documentation still needs to be written, but I'll do
that after the implementation is merged, in case there are further
design changes.

Test Plan: new and modified tests in overloadedrecflds

Reviewers: simonpj, goldfire, dfeuer, bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: maninalift, dfeuer, ysangkok, thomie, mpickering

Differential Revision: https://phabricator.haskell.org/D2708
56 files changed:
compiler/basicTypes/DataCon.hs
compiler/basicTypes/RdrName.hs
compiler/deSugar/Coverage.hs
compiler/deSugar/DsBinds.hs
compiler/deSugar/DsExpr.hs
compiler/deSugar/DsMeta.hs
compiler/deSugar/Match.hs
compiler/hsSyn/HsExpr.hs
compiler/parser/Parser.y
compiler/prelude/PrelNames.hs
compiler/rename/RnExpr.hs
compiler/rename/RnPat.hs
compiler/typecheck/TcEvidence.hs
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcHsSyn.hs
compiler/typecheck/TcInteract.hs
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcSMonad.hs
compiler/typecheck/TcValidity.hs
compiler/types/TyCon.hs
compiler/utils/FastStringEnv.hs
libraries/base/GHC/OverloadedLabels.hs
libraries/base/GHC/Records.hs [new file with mode: 0644]
libraries/base/base.cabal
testsuite/driver/extra_files.py
testsuite/tests/overloadedrecflds/ghci/all.T
testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.script [moved from testsuite/tests/overloadedrecflds/ghci/overloadedrecfldsghci01.script with 100% similarity]
testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.stdout [moved from testsuite/tests/overloadedrecflds/ghci/overloadedrecfldsghci01.stdout with 100% similarity]
testsuite/tests/overloadedrecflds/ghci/overloadedlabelsghci01.script
testsuite/tests/overloadedrecflds/should_fail/HasFieldFail01_A.hs [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/all.T
testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.hs [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.stderr [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/hasfieldfail02.hs [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/hasfieldfail02.stderr [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/hasfieldfail03.hs [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/hasfieldfail03.stderr [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.hs
testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr
testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail02.hs [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail02.stderr [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail03.hs [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail03.stderr [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_run/OverloadedLabelsRun04_A.hs
testsuite/tests/overloadedrecflds/should_run/T12243.hs [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_run/T12243.stdout [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_run/all.T
testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.hs [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.stdout [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun01.hs
testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun02.hs
testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun03.hs
testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun07.hs [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun07.stdout [new file with mode: 0644]