aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-28 19:41:11 -0400
committerGitHub <noreply@github.com>2025-07-28 19:41:11 -0400
commit87da843330c8f7e7cab55951fd1536d9f21e17cd (patch)
tree377be1fce8f782a1bf501668ae1cde820510780b /tests
parentd1dfb42e168285954cfb037c653b8c33a31191ce (diff)
parente9a12f457c21ed5cc42ecfb7e9d0a0705d6430fa (diff)
Merge pull request #797 from BradLewis/fix/further-semantic-token-improvements
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
+ })
+}