Skip to content
Open
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
5 changes: 4 additions & 1 deletion src/packagedef.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ Parses an expression starting with a `(`.
function parse_paren(ps::ParseState)
args = EXPR[]
trivia = EXPR[EXPR(ps)]
@closeparen ps @default ps @nocloser ps :inwhere parse_comma_sep(ps, args, trivia, false, true, true, insert_params_at = 1)

anon_func_block = VERSION < v"1.11-" || kindof(ps.lt) != Tokens.FUNCTION

@closeparen ps @default ps @nocloser ps :inwhere parse_comma_sep(ps, args, trivia, false, anon_func_block, true, insert_params_at = 1)
if length(args) == 1 && length(trivia) == 1 && ((kindof(ps.ws) !== SemiColonWS || headof(args[1]) === :block) && headof(args[1]) !== :parameters)
accept_rparen(ps, trivia)
ret = EXPR(:brackets, args, trivia)
Expand Down
3 changes: 3 additions & 0 deletions test/parser/test_parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ end
@test "-1^a" |> test_expr
@test "function(f, args...; kw...) end" |> test_expr
@test "function(f, args...=1; kw...) end" |> test_expr
@test "function (f; args...) end" |> test_expr
@test "function (; args...) end" |> test_expr
@test "function (args...) end" |> test_expr
@test "2a * b" |> test_expr
@test "(g1090(x::T)::T) where {T} = x+1.0" |> test_expr
@test "(:) = Colon()" |> test_expr
Expand Down