From fb4e4179fde5447e3e2bf86a1a3b9a35743430f7 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 12 Apr 2024 14:33:52 +0200 Subject: [PATCH] edlin_expand: Exclude zero-arity functions when a nesting exists fixes #8366 --- lib/stdlib/src/edlin_expand.erl | 7 ++++++- lib/stdlib/test/edlin_expand_SUITE.erl | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/stdlib/src/edlin_expand.erl b/lib/stdlib/src/edlin_expand.erl index b385b6b40cad..444483a1b743 100644 --- a/lib/stdlib/src/edlin_expand.erl +++ b/lib/stdlib/src/edlin_expand.erl @@ -480,7 +480,12 @@ expand_function_parameter_type(Mod, MFA, FunType, Args, Unfinished, Nestings, FT end, case match_arguments(TypeTree, Args) of false -> {no, [], []}; - true when Parameters == [] -> {yes, ")", [#{title=>MFA, elems=>[{")",[]}], options=>[]}]}; + true when Parameters == [] -> + if Nestings == [] -> + {yes, ")", [#{title=>MFA, elems=>[{")",[]}], options=>[]}]}; + true -> + {no, [], []} + end; true -> Parameter = lists:nth(length(Args)+1, Parameters), {T, _Name} = case Parameter of diff --git a/lib/stdlib/test/edlin_expand_SUITE.erl b/lib/stdlib/test/edlin_expand_SUITE.erl index 39baac3e9d14..15abaaa7f07e 100644 --- a/lib/stdlib/test/edlin_expand_SUITE.erl +++ b/lib/stdlib/test/edlin_expand_SUITE.erl @@ -276,6 +276,7 @@ function_parameter_completion(Config) -> options:=[{highlight_param,1}]}], options:=[highlight_all]}]} = do_expand("complete_function_parameter:multi_arity_fun("), {no, [], [#{elems:=[#{elems:=[#{elems:=[{"true",[]},{"false",[]}]}]}]}]} = do_expand("complete_function_parameter:multi_arity_fun(1,"), + {no, [], []} = do_expand("complete_function_parameter:multi_arity_fun(["), {no,[], [#{elems := [#{elems :=