[Git][ghc/ghc][master] Extend HsExpr with the StarIsType syntax (#26587, #26967)
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 66e5e324 by Vladislav Zavialov at 2026-03-27T04:42:25-04:00 Extend HsExpr with the StarIsType syntax (#26587, #26967) This patch allows kinds of the form `k -> *` and `* -> k` to occur in expression syntax, i.e. to be used as required type arguments. For example: {-# LANGUAGE RequiredTypeArguments, StarIsType #-} x1 = f (* -> * -> *) x2 = f (forall k. k -> *) x3 = f ((* -> *) -> Constraint) Summary of the changes: * Introduce the HsStar constructor of HsExpr and its extension field XStar. It is analogous to HsStarTy in HsType. * Refactor HsStarTy to store the unicode flag as TokStar, defined as type TokStar = EpUniToken "*" "★" -- similar to TokForall, TokRArrow, etc. The token is stored in the extension field and replaces the Bool field. * Extend the `infixexp2` nonterminal to parse `*` as a direct argument of `->`. This is more limited than the full StarIsType syntax, but has the nice property of not conflicting with the multiplication operator `a * b`. Test case: T26967 T26967_tyop - - - - - 37 changed files: - compiler/GHC/Hs/Expr.hs - compiler/GHC/Hs/Syn/Type.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/HsToCore/Expr.hs - compiler/GHC/HsToCore/Quote.hs - compiler/GHC/HsToCore/Ticks.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/Errors/Types.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Rename/Expr.hs - compiler/GHC/Rename/HsType.hs - compiler/GHC/Rename/Pat.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/App.hs - compiler/GHC/Tc/Gen/Expr.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Types/Origin.hs - compiler/GHC/Tc/Zonk/Type.hs - compiler/GHC/Utils/Outputable.hs - compiler/Language/Haskell/Syntax/Expr.hs - compiler/Language/Haskell/Syntax/Extension.hs - compiler/Language/Haskell/Syntax/Type.hs - docs/users_guide/exts/required_type_arguments.rst - + testsuite/tests/vdq-rta/should_compile/T26967.hs - + testsuite/tests/vdq-rta/should_compile/T26967.stderr - + testsuite/tests/vdq-rta/should_compile/T26967_tyop.hs - + testsuite/tests/vdq-rta/should_compile/T26967_tyop.stderr - testsuite/tests/vdq-rta/should_compile/all.T - utils/check-exact/ExactPrint.hs - utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs - utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs - utils/haddock/haddock-api/src/Haddock/Interface/RenameType.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66e5e3245a26bdaadfaab5358df04f9c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66e5e3245a26bdaadfaab5358df04f9c... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)