aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-17 19:54:22 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-17 19:54:22 -0400
commit7be81e2f75e79226148ca83a15bad035c71ead7c (patch)
tree578b8f4e084ea8adcffa473c0d0a176565e63dcd /tests
parent753404b760316aed6c612be1c2bb6d6ebf70ebce (diff)
Correctly parse param default value for semantic types
Diffstat (limited to 'tests')
-rw-r--r--tests/semantic_tokens_test.odin24
1 files changed, 24 insertions, 0 deletions
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
+ })
+}