diff --git a/src/packagedef.jl b/src/packagedef.jl index af354c4c..abe731e5 100644 --- a/src/packagedef.jl +++ b/src/packagedef.jl @@ -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) diff --git a/test/parser/test_parser.jl b/test/parser/test_parser.jl index 18676de5..54bab35b 100644 --- a/test/parser/test_parser.jl +++ b/test/parser/test_parser.jl @@ -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