T2T in Expressions (#23738)
This patch implements the T2T (term-to-type) transformation in expressions. Given a function with a required type argument vfun :: forall a -> ... the user can now call it as vfun (Maybe Int) instead of vfun (type (Maybe Int)) The Maybe Int argument is parsed and renamed as a term (HsExpr), but then undergoes a conversion to a type (HsType). See the new function expr_to_type in compiler/GHC/Tc/Gen/App.hs and Note [RequiredTypeArguments and the T2T mapping] Left as future work: checking for puns.
Showing
- compiler/GHC/Hs/Expr.hs 7 additions, 2 deletionscompiler/GHC/Hs/Expr.hs
- compiler/GHC/Tc/Errors/Ppr.hs 17 additions, 3 deletionscompiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs 34 additions, 7 deletionscompiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/App.hs 212 additions, 9 deletionscompiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Types/Error/Codes.hs 2 additions, 0 deletionscompiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/Hint.hs 6 additions, 0 deletionscompiler/GHC/Types/Hint.hs
- compiler/GHC/Types/Hint/Ppr.hs 5 additions, 0 deletionscompiler/GHC/Types/Hint/Ppr.hs
- compiler/GHC/Types/Name/Occurrence.hs 4 additions, 1 deletioncompiler/GHC/Types/Name/Occurrence.hs
- docs/users_guide/exts/required_type_arguments.rst 2 additions, 4 deletionsdocs/users_guide/exts/required_type_arguments.rst
- testsuite/tests/diagnostic-codes/codes.stdout 0 additions, 1 deletiontestsuite/tests/diagnostic-codes/codes.stdout
- testsuite/tests/vdq-rta/should_compile/T22326_idv.hs 6 additions, 1 deletiontestsuite/tests/vdq-rta/should_compile/T22326_idv.hs
- testsuite/tests/vdq-rta/should_compile/T23738_basic.hs 19 additions, 0 deletionstestsuite/tests/vdq-rta/should_compile/T23738_basic.hs
- testsuite/tests/vdq-rta/should_compile/T23738_nested.hs 14 additions, 0 deletionstestsuite/tests/vdq-rta/should_compile/T23738_nested.hs
- testsuite/tests/vdq-rta/should_compile/T23738_overlit.hs 20 additions, 0 deletionstestsuite/tests/vdq-rta/should_compile/T23738_overlit.hs
- testsuite/tests/vdq-rta/should_compile/T23738_sigforall.hs 28 additions, 0 deletionstestsuite/tests/vdq-rta/should_compile/T23738_sigforall.hs
- testsuite/tests/vdq-rta/should_compile/T23738_th.hs 17 additions, 0 deletionstestsuite/tests/vdq-rta/should_compile/T23738_th.hs
- testsuite/tests/vdq-rta/should_compile/T23738_tyvar.hs 15 additions, 0 deletionstestsuite/tests/vdq-rta/should_compile/T23738_tyvar.hs
- testsuite/tests/vdq-rta/should_compile/T23738_wild.hs 14 additions, 0 deletionstestsuite/tests/vdq-rta/should_compile/T23738_wild.hs
- testsuite/tests/vdq-rta/should_compile/all.T 8 additions, 1 deletiontestsuite/tests/vdq-rta/should_compile/all.T
- testsuite/tests/vdq-rta/should_fail/T22326_fail_raw_arg.stderr 0 additions, 1 deletion...uite/tests/vdq-rta/should_fail/T22326_fail_raw_arg.stderr
Loading
Please register or sign in to comment