@@ -2199,13 +2199,18 @@ function parse_function_signature(ps::ParseState, is_function::Bool)
21992199 is_empty_tuple = peek (ps, skip_newlines= true ) == K " )"
22002200 opts = parse_brackets (ps, K " )" ) do had_commas, had_splat, num_semis, num_subexprs
22012201 _parsed_call = was_eventually_call (ps)
2202- _needs_parse_call = peek (ps, 2 ) ∈ KSet " ( ."
2202+ _maybe_grouping_parens = ! had_commas && ! had_splat && num_semis == 0 && num_subexprs == 1
2203+ # Skip intervening newlines only when the parentheses hold a single
2204+ # expression, which is the ambiguous case between a name like (::T)
2205+ # and an anonymous function parameter list.
2206+ next_kind = peek (ps, 2 , skip_newlines= _maybe_grouping_parens)
2207+ _needs_parse_call = next_kind ∈ KSet " ( ."
22032208 _is_anon_func = (! _needs_parse_call && ! _parsed_call) || had_commas
2204- return (needs_parameters = _is_anon_func,
2205- is_anon_func = _is_anon_func,
2206- parsed_call = _parsed_call,
2207- needs_parse_call = _needs_parse_call,
2208- maybe_grouping_parens = ! had_commas && ! had_splat && num_semis == 0 && num_subexprs == 1 )
2209+ return (needs_parameters = _is_anon_func,
2210+ is_anon_func = _is_anon_func,
2211+ parsed_call = _parsed_call,
2212+ needs_parse_call = _needs_parse_call,
2213+ maybe_grouping_parens = _maybe_grouping_parens )
22092214 end
22102215 is_anon_func = opts. is_anon_func
22112216 parsed_call = opts. parsed_call
0 commit comments