aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-28 19:33:53 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-28 19:33:53 -0400
commite9a12f457c21ed5cc42ecfb7e9d0a0705d6430fa (patch)
treeeed27e68bd4e7b333c5c6ff78771ae537207ac5b /tests
parent62cae61b822416979ff25b3672feb3679c93eebc (diff)
Correctly resolve semantic tokens for basic literals and casts
Diffstat (limited to 'tests')
-rw-r--r--tests/semantic_tokens_test.odin19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/semantic_tokens_test.odin b/tests/semantic_tokens_test.odin
index 099ffde..88ad3c9 100644
--- a/tests/semantic_tokens_test.odin
+++ b/tests/semantic_tokens_test.odin
@@ -50,3 +50,22 @@ semantic_tokens_global_consts :: proc(t: ^testing.T) {
{0, 11, 3, .Type, {.ReadOnly}}, // [3] f32
})
}
+
+@(test)
+semantic_tokens_literals_with_explicit_types :: proc(t: ^testing.T) {
+ src := test.Source {
+ main = `package test
+ Foo :: 1
+ Foo2 : int : 1
+ Foo3 :: cast(string) "hello"
+ `
+ }
+
+ test.expect_semantic_tokens(t, &src, {
+ {1, 2, 3, .Variable, {.ReadOnly}}, // [0] Foo
+ {1, 2, 4, .Variable, {.ReadOnly}}, // [1] Foo2
+ {0, 7, 3, .Type, {.ReadOnly}}, // [2] int
+ {1, 2, 4, .Variable, {.ReadOnly}}, // [3] Foo3
+ {0, 13, 6, .Type, {.ReadOnly}}, // [4] string
+ })
+}