From 7be81e2f75e79226148ca83a15bad035c71ead7c Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Wed, 17 Sep 2025 19:54:22 -0400 Subject: Correctly parse param default value for semantic types --- tests/semantic_tokens_test.odin | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests') diff --git a/tests/semantic_tokens_test.odin b/tests/semantic_tokens_test.odin index afb6b6a..6aec84b 100644 --- a/tests/semantic_tokens_test.odin +++ b/tests/semantic_tokens_test.odin @@ -142,3 +142,27 @@ semantic_tokens_fixed_array_fields :: proc(t: ^testing.T) { {0, 4, 1, .Property, {}}, // [5] x }) } + +@(test) +semantic_tokens_enum_member_default_param :: proc(t: ^testing.T) { + src := test.Source { + main = `package test + Foo :: enum { + A, + B, + } + + bar :: proc(foo: Foo = .A) {} + ` + } + + test.expect_semantic_tokens(t, &src, { + {1, 2, 3, .Enum, {.ReadOnly}}, // [0] Foo + {1, 3, 1, .EnumMember, {}}, // [1] A + {1, 3, 1, .EnumMember, {}}, // [2] B + {3, 2, 3, .Function, {.ReadOnly}}, // [3] bar + {0, 12, 3, .Parameter, {}}, // [4] foo + {0, 5, 3, .Enum, {.ReadOnly}}, // [5] Foo + {0, 7, 1, .EnumMember, {}}, // [6] A + }) +} -- cgit v1.2.3