aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-07 22:34:43 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-07 22:34:43 -0400
commitfd12714250f96b8dbdb65825ac8b265edbe3bd10 (patch)
treedea664ed82d7f5671adaf28203165aa7689ef227
parenta3ebb67fd1893881a7e88021341f712461fc3a79 (diff)
Proc named returns should not be marked as parameters
-rw-r--r--src/server/locals.odin4
-rw-r--r--tests/semantic_tokens_test.odin19
2 files changed, 21 insertions, 2 deletions
diff --git a/src/server/locals.odin b/src/server/locals.odin
index 267a2a2..e6cf70e 100644
--- a/src/server/locals.odin
+++ b/src/server/locals.odin
@@ -998,7 +998,7 @@ get_locals_proc_param_and_results :: proc(
false,
true,
"",
- true,
+ false,
)
} else {
str := get_ast_node_string(name, file.src)
@@ -1012,7 +1012,7 @@ get_locals_proc_param_and_results :: proc(
false,
true,
"",
- true,
+ false,
)
}
}
diff --git a/tests/semantic_tokens_test.odin b/tests/semantic_tokens_test.odin
index 35714df..8fd8468 100644
--- a/tests/semantic_tokens_test.odin
+++ b/tests/semantic_tokens_test.odin
@@ -102,3 +102,22 @@ semantic_tokens_struct_fields :: proc(t: ^testing.T) {
{0, 4, 3, .Property, {}}, // [7] bar
})
}
+
+@(test)
+semantic_tokens_proc_return :: proc(t: ^testing.T) {
+ src := test.Source {
+ main = `package test
+ foo :: proc() -> (ret: int) {
+ ret += 1
+ return
+ }
+ `
+ }
+
+ test.expect_semantic_tokens(t, &src, {
+ {1, 2, 3, .Function, {.ReadOnly}}, // [0] foo
+ {0, 18, 3, .Variable, {}}, // [1] ret
+ {0, 5, 3, .Type, {.ReadOnly}}, // [2] proc
+ {1, 3, 3, .Variable, {}}, // [3] ret
+ })
+}