From 9e16906c539a944e08792cae6a908b3611244c7a Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Thu, 10 Jul 2025 15:20:31 +0100 Subject: [PATCH] [test] Add test case for raw identifier semantic tokens rdar://152273926 --- .../SemanticTokens/raw_identifiers.swift | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/SourceKit/SemanticTokens/raw_identifiers.swift diff --git a/test/SourceKit/SemanticTokens/raw_identifiers.swift b/test/SourceKit/SemanticTokens/raw_identifiers.swift new file mode 100644 index 0000000000000..72a66e5ce2a9f --- /dev/null +++ b/test/SourceKit/SemanticTokens/raw_identifiers.swift @@ -0,0 +1,33 @@ +// RUN: %empty-directory(%t) +// RUN: split-file %s %t +// RUN: %sourcekitd-test -req=semantic-tokens %t/main.swift -- %t/main.swift > %t/result.json +// RUN: diff -u %t/tokens.json %t/result.json + +//--- main.swift +func `foo`(x: Int) {} +`foo`(x: 0) + +func `foo bar baz`() {} +`foo bar baz`() + +//--- tokens.json +{ + key.semantic_tokens: [ + { + key.kind: source.lang.swift.ref.struct, + key.offset: 14, + key.length: 3, + key.is_system: 1 + }, + { + key.kind: source.lang.swift.ref.function.free, + key.offset: 22, + key.length: 5 + }, + { + key.kind: source.lang.swift.ref.function.free, + key.offset: 59, + key.length: 13 + } + ] +}