Skip to content

Commit

Permalink
RakuAST: fix handling of constants in coercing situations
Browse files Browse the repository at this point in the history
In the "maybe typename" check, check if the given name is a known
type (by name).  However, some ASTs (specificall RakuAST::Type::Coercion)
do not have a name: take that to mean it is indeed a type.

The ::Coercion case happens with embedded coercions, such as Int(Str())
  • Loading branch information
lizmat committed Mar 12, 2023
1 parent c0c08a7 commit 4a1fad5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Raku/Grammar.nqp
Expand Up @@ -1767,7 +1767,10 @@ grammar Raku::Grammar is HLL::Grammar does Raku::Common {
[
<?[(]> <?{ $*is-type }>
'(' <.ws> [
|| <accept=.maybe_typename> <!{ nqp::isconcrete($<accept>.ast) }>
|| <accept=.maybe_typename> <?{
my $it := $<accept>.ast;
!nqp::can($it,"name") || $*R.is-name-type($it.name)
}>
|| $<accept_any>=<?>
] <.ws> ')'
]?
Expand Down

0 comments on commit 4a1fad5

Please sign in to comment.