aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/analysis.odin3
-rw-r--r--tests/signatures_test.odin38
2 files changed, 41 insertions, 0 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 8e27d1e..000080d 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -2299,6 +2299,9 @@ internal_resolve_comp_literal :: proc(
set_ast_package_set_scoped(ast_context, symbol.pkg)
+ if position_context.parent_comp_lit == nil {
+ return {}, false
+ }
symbol, _ = resolve_type_comp_literal(
ast_context,
position_context,
diff --git a/tests/signatures_test.odin b/tests/signatures_test.odin
index d81a4da..4ee9ff3 100644
--- a/tests/signatures_test.odin
+++ b/tests/signatures_test.odin
@@ -649,6 +649,44 @@ signature_comp_lit_bit_set :: proc(t: ^testing.T) {
)
}
+@(test)
+signature_comp_lit_struct_field_after_comma :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: struct {
+ A,{*}
+ B,
+ }
+ `,
+ config = {
+ enable_comp_lit_signature_help = true,
+ }
+ }
+
+ test.expect_signature_labels(
+ t,
+ &source,
+ {},
+ )
+}
+
+@(test)
+signature_comp_lit_proc_field_after_comma :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ foo :: proc(a, b,{*}: int) {}
+ `,
+ config = {
+ enable_comp_lit_signature_help = true,
+ }
+ }
+
+ test.expect_signature_labels(
+ t,
+ &source,
+ {},
+ )
+}
/*
@(test)
signature_function_inside_when :: proc(t: ^testing.T) {