diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-01 07:48:22 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-01 07:48:22 -0400 |
| commit | 16cfd6fff822faf8116d8648effe171154fa6bc2 (patch) | |
| tree | a14e155110992951c07c72254a27995299e69cdd | |
| parent | 24b81b6118ce76eb38e2fd33642464e3a7f2063e (diff) | |
Handle multiple returns
| -rw-r--r-- | src/server/analysis.odin | 6 | ||||
| -rw-r--r-- | tests/hover_test.odin | 28 |
2 files changed, 31 insertions, 3 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 14a6f39..127c038 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -3274,18 +3274,18 @@ get_generic_assignment :: proc( if value, ok := symbol.value.(SymbolProcedureValue); ok { if len(value.return_types) == 1 { if proc_type, ok := value.return_types[0].type.derived.(^Proc_Type); ok { - if len(proc_type.results.list) == 1 { + for return_item in proc_type.results.list { get_generic_assignment( file, - proc_type.results.list[0].type, + return_item.type, ast_context, results, calls, flags, is_mutable, ) - return } + return } } } diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 53e2964..93aae1f 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -3392,6 +3392,34 @@ ast_hover_returned_proc_call_parameter :: proc(t: ^testing.T) { "test.a: bool", ) } + +@(test) +ast_hover_returned_proc_call_parameter_multiple_return :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + someData: int, + } + + main :: proc() { + a, b{*} := foo()({}) + } + + foo :: proc() -> proc(data: Foo) -> (int, bool) { + return 1, bar + } + + bar :: proc(data: Foo) -> bool { + return false + } + `, + } + test.expect_hover( + t, + &source, + "test.b: bool", + ) +} /* Waiting for odin fix |