aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-06 09:30:25 -0400
committerGitHub <noreply@github.com>2025-09-06 09:30:25 -0400
commita5b9d01b7a74f267e8b5e9e9e960336ffdcdab8b (patch)
tree8d42fe1b599af2a67ebce32303de76ca5e127870
parent4ffd0ea97e4bea5dc6f4037ee0b0d4eb111d0717 (diff)
parent10265e881364c5f672a55fba5a0c4a6850686b81 (diff)
Merge pull request #970 from BradLewis/fix/resolve-proc-arg-bitsets-with-default-value
Correctly resolve proc default values for bitsets
-rw-r--r--src/server/analysis.odin8
-rw-r--r--tests/hover_test.odin28
2 files changed, 35 insertions, 1 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 9672824..1f2a1c4 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -2126,7 +2126,13 @@ resolve_implicit_selector :: proc(
return {}, false
}
- return resolve_type_expression(ast_context, proc_value.arg_types[parameter_index].type)
+ arg := proc_value.arg_types[parameter_index]
+ type := arg.type
+ if type == nil {
+ type = arg.default_value
+ }
+
+ return resolve_type_expression(ast_context, type)
} else if enum_value, ok := symbol.value.(SymbolEnumValue); ok {
return symbol, ok
}
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index c64f328..daff8e4 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -4430,6 +4430,34 @@ ast_hover_overloaded_proc_slice_dynamic_array :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.foo: proc(array: $A/[dynamic]$T)")
}
+
+
+@(test)
+ast_hover_proc_call_implicit_selector_with_default_value :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+
+ Foo :: enum {
+ X, Y,
+ }
+
+ Option :: enum {
+ A,
+ B,
+ }
+
+ Options :: distinct bit_set[Option]
+
+ foo :: proc(options := Options{}) {
+ }
+
+ main :: proc() {
+ foo({.A, .B{*}})
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.Option: .B")
+}
/*
Waiting for odin fix