Simon Peyton Jones pushed to branch wip/ani/tc-expand at Glasgow Haskell Compiler / GHC
Commits:
-
893b2ba6
by Simon Peyton Jones at 2026-03-26T23:41:25+00:00
1 changed file:
Changes:
| ... | ... | @@ -679,17 +679,21 @@ tcExpr expr@(RecordCon { rcon_con = L loc qcon@(WithUserRdr _ con_name) |
| 679 | 679 | , rcon_con = L loc con_like
|
| 680 | 680 | , rcon_flds = rbinds' }
|
| 681 | 681 | |
| 682 | + ; co <- tcSubTypeMono expr actual_res_ty res_ty
|
|
| 683 | + |
|
| 682 | 684 | -- Check for missing fields. We do this after type-checking to get
|
| 683 | 685 | -- better types in error messages (cf #18869). For example:
|
| 684 | 686 | -- data T a = MkT { x :: a, y :: a }
|
| 685 | 687 | -- r = MkT { y = True }
|
| 686 | 688 | -- Then we'd like to warn about a missing field `x :: True`, rather than `x :: a0`.
|
| 687 | 689 | --
|
| 688 | - -- NB: to do this really properly we should delay reporting until typechecking is complete,
|
|
| 689 | - -- via a new `HoleSort`. But that seems too much work.
|
|
| 690 | + -- NB: to do this really properly we should delay reporting until typechecking
|
|
| 691 | + -- is complete, via a new `HoleSort`. But that seems too much work.
|
|
| 692 | + --
|
|
| 693 | + -- However, it's worth doing it after calling `tcSubTypeMono`,
|
|
| 694 | + -- which may do some useful unifications
|
|
| 690 | 695 | ; checkMissingFields con_like rbinds arg_tys
|
| 691 | 696 | |
| 692 | - ; co <- tcSubTypeMono expr actual_res_ty res_ty
|
|
| 693 | 697 | ; return (mkHsWrapCo co expr') }
|
| 694 | 698 | where
|
| 695 | 699 | orig = OccurrenceOf con_name
|