Files
zijievv 99ec167194 [IDE] Report module selectors as module references
Report module selectors separately from declaration references,
consistent with Module.member.

Preserve full selector token ranges, including escaped identifiers, and
add cursor info, annotation, and indexing regression coverage.
2026-09-12 12:34:37 +00:00

49 lines
3.2 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// RUN: %target-swift-frontend -emit-module -module-name TestModule -emit-module-path %t/TestModule.swiftmodule %t/TestModule.swift
// RUN: %sourcekitd-test -req=cursor -pos=3:50 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=UNBOUND
// RUN: %sourcekitd-test -req=cursor -pos=4:51 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=COMPOUND
// RUN: %sourcekitd-test -req=cursor -pos=3:19 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=MODULE
// RUN: %sourcekitd-test -req=cursor -pos=3:38 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=MODULE
// RUN: %sourcekitd-test -req=cursor -pos=4:39 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=MODULE
// RUN: %sourcekitd-test -req=cursor -pos=3:31 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=WIDGET
// RUN: %sourcekitd-test -req=cursor -pos=3:29 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=NONE
// RUN: %sourcekitd-test -req=cursor -pos=3:30 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=NONE
// RUN: %sourcekitd-test -req=cursor -pos=4:49 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=NONE
// RUN: %sourcekitd-test -req=cursor -pos=4:50 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=NONE
// RUN: %sourcekitd-test -req=cursor -pos=5:14 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=MODULE
// RUN: %sourcekitd-test -req=cursor -pos=5:25 -print-raw-response %t/main.swift -- %t/main.swift -I %t -target %target-triple | %FileCheck %s --check-prefix=WIDGET
// MODULE: key.kind: source.lang.swift.ref.module
// MODULE: key.name: "TestModule"
// WIDGET: key.kind: source.lang.swift.ref.struct
// WIDGET: key.name: "Widget"
// WIDGET: key.usr: "s:10TestModule6WidgetV"
// NONE-NOT: key.kind
// NONE: key.internal_diagnostic: "Unable to resolve cursor info."
// UNBOUND: key.kind: source.lang.swift.ref.function.method.instance
// UNBOUND: key.name: "method(label:)"
// UNBOUND: key.usr: "s:10TestModule6WidgetV6method5labelySi_tF"
// UNBOUND: key.modulename: "TestModule"
// COMPOUND: key.kind: source.lang.swift.ref.function.method.instance
// COMPOUND: key.name: "method(label:)"
// COMPOUND: key.usr: "s:10TestModule6WidgetV6method5labelySi_tF"
// COMPOUND: key.modulename: "TestModule"
//--- TestModule.swift
public struct Widget {
public init() {}
public func method(label: Int) {}
}
//--- main.swift
import TestModule
let unbound: () = TestModule::Widget.TestModule::method(Widget())(label: 1)
let compound: () = TestModule::Widget.TestModule::method(label:)(Widget())(1)
let dotted = TestModule.Widget.self