Apoorv Ingle pushed to branch wip/spj-apporv-Oct24 at Glasgow Haskell Compiler / GHC
Commits:
-
50f0aaae
by Apoorv Ingle at 2026-03-30T14:14:47-05:00
5 changed files:
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Types/Origin.hs
- testsuite/tests/rep-poly/RepPolyDoBind.stderr
- testsuite/tests/rep-poly/RepPolyDoBody1.stderr
- testsuite/tests/rep-poly/RepPolyDoBody2.stderr
Changes:
| ... | ... | @@ -916,7 +916,7 @@ tcInstFun do_ql inst_final (fun_orig, rn_fun, fun_lspan) tc_fun fun_sigma rn_arg |
| 916 | 916 | mk_herald :: HsExpr GhcTc -> HsExpr GhcRn -> ExpectedFunTyCtxt
|
| 917 | 917 | mk_herald tc_fun arg
|
| 918 | 918 | = case fun_orig of
|
| 919 | - DoStmtOrigin -> ExpectedTySyntax DoStmtOrigin arg
|
|
| 919 | + DoStmtOrigin -> ExpectedFunTySyntaxOp DoStmtOrigin tc_fun
|
|
| 920 | 920 | _ -> ExpectedFunTyArg (HsExprTcThing tc_fun) arg
|
| 921 | 921 | |
| 922 | 922 | -- Is the argument supposed to instantiate a forall?
|
| ... | ... | @@ -1536,13 +1536,6 @@ data ExpectedFunTyCtxt |
| 1536 | 1536 | => ExpectedFunTySyntaxOp !CtOrigin !(HsExpr (GhcPass p))
|
| 1537 | 1537 | -- ^ rebindable syntax operator
|
| 1538 | 1538 | |
| 1539 | - -- | A rebindable syntax operator is expected to have a function type.
|
|
| 1540 | - --
|
|
| 1541 | - -- Test cases for representation-polymorphism checks:
|
|
| 1542 | - -- RepPolyDoBind, RepPolyDoBody{1,2},
|
|
| 1543 | - -- This constructor will merge with ExpectedFunTySyntaxOp when tcSyntaxOp is retired.
|
|
| 1544 | - | ExpectedTySyntax !CtOrigin !(HsExpr GhcRn)
|
|
| 1545 | - |
|
| 1546 | 1539 | -- | A view pattern must have a function type.
|
| 1547 | 1540 | --
|
| 1548 | 1541 | -- Test cases for representation-polymorphism checks:
|
| ... | ... | @@ -1598,9 +1591,6 @@ pprExpectedFunTyCtxt funTy_origin i = |
| 1598 | 1591 | , text "the rebindable syntax operator"
|
| 1599 | 1592 | , quotes (ppr op) ]
|
| 1600 | 1593 | , nest 2 (ppr orig) ]
|
| 1601 | - ExpectedTySyntax orig arg ->
|
|
| 1602 | - vcat [ text "The expression" <+> quotes (ppr arg)
|
|
| 1603 | - , nest 2 (ppr orig) ]
|
|
| 1604 | 1594 | ExpectedFunTyViewPat expr ->
|
| 1605 | 1595 | vcat [ the_arg_of <+> text "the view pattern"
|
| 1606 | 1596 | , nest 2 (ppr expr) ]
|
| ... | ... | @@ -1629,8 +1619,6 @@ pprExpectedFunTyCtxt funTy_origin i = |
| 1629 | 1619 | pprExpectedFunTyHerald :: ExpectedFunTyCtxt -> SDoc
|
| 1630 | 1620 | pprExpectedFunTyHerald (ExpectedFunTySyntaxOp {})
|
| 1631 | 1621 | = text "This rebindable syntax expects a function with"
|
| 1632 | -pprExpectedFunTyHerald (ExpectedTySyntax orig _)
|
|
| 1633 | - = pprCtOriginBriefly orig
|
|
| 1634 | 1622 | pprExpectedFunTyHerald (ExpectedFunTyViewPat {})
|
| 1635 | 1623 | = text "A view pattern expression expects"
|
| 1636 | 1624 | pprExpectedFunTyHerald (ExpectedFunTyArg fun _)
|
| 1 | 1 | RepPolyDoBind.hs:26:3: error: [GHC-55287]
|
| 2 | - • The expression ‘undefined’
|
|
| 2 | + • The first argument of the rebindable syntax operator ‘(>>=)’
|
|
| 3 | 3 | arising from a do statement
|
| 4 | 4 | does not have a fixed runtime representation.
|
| 5 | 5 | Its type is:
|
| 1 | 1 | RepPolyDoBody1.hs:24:3: error: [GHC-55287]
|
| 2 | - • The expression ‘undefined :: ma’
|
|
| 2 | + • The first argument of the rebindable syntax operator ‘(>>)’
|
|
| 3 | 3 | arising from a do statement
|
| 4 | 4 | does not have a fixed runtime representation.
|
| 5 | 5 | Its type is:
|
| 1 | 1 | RepPolyDoBody2.hs:23:3: error: [GHC-55287]
|
| 2 | - • The expression ‘return ()’
|
|
| 2 | + • The first argument of the rebindable syntax operator ‘(>>)’
|
|
| 3 | 3 | arising from a do statement
|
| 4 | 4 | does not have a fixed runtime representation.
|
| 5 | 5 | Its type is:
|