Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/_007/Parser/Actions.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class _007::Parser::Actions {
make Q::TraitList.new(:traits(Val::Array.new(:elements(@traits))));
}
method trait($/) {
make Q::Trait.new(:identifier($<identifier>.ast), :expr($<EXPR>.ast));
make Q::Trait.new(:identifier($<identifier>.ast), :expr(ast-if-any($<EXPR>)));
}

method blockoid ($/) {
Expand Down
2 changes: 1 addition & 1 deletion lib/_007/Parser/Syntax.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ grammar _007::Parser::Syntax {
<trait> *
}
token trait {
is» <.ws> <identifier> '(' <EXPR> ')'
is» <.ws> <identifier> [<.ws> '(' <.ws> <EXPR> ')']?
}

# requires a <.newpad> before invocation
Expand Down
12 changes: 12 additions & 0 deletions t/features/funcs.t
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,16 @@ use _007::Test;
outputs $program, "<func ()>\n", "an anonymous func stringifies without a name";
}

{
my $program = q:to/./;
func foo() is test {
say("OH HAI");
}

foo();
.

outputs $program, "OH HAI\n", "traits don't have to be followed by parentheses";
}

done-testing;