File: cursor_uses_swiftsourceinfo.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (27 lines) | stat: -rw-r--r-- 1,218 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/build)
// RUN: split-file %s %t

// RUN: %target-swift-frontend -emit-module -module-name MyModule -emit-module-path %t/build/MyModule.swiftmodule -emit-module-source-info-path %t/build/MyModule.swiftsourceinfo %t/Action.swift
// RUN: %sourcekitd-test -req=cursor -req-opts=retrieve_symbol_graph=1 -pos=5:14 %t/test.swift -- %t/test.swift -I %t/build -target %target-triple | %FileCheck %s

// We should also get source doc info if we execute a code completion request (which doesn't need source doc info) first
// RUN: %sourcekitd-test \
// RUN: -req=complete %t/test.swift -pos=5:14 -- %t/test.swift -I %t/build -target %target-triple == \
// RUN: -req=cursor -req-opts=retrieve_symbol_graph=1 -pos=5:14 %t/test.swift -- %t/test.swift -I %t/build -target %target-triple

// CHECK: REFERENCED DECLS BEGIN
// CHECK-NEXT: s:8MyModule6ActionP | public | {{.*}}Action.swift | MyModule | User | NonSPI | source.lang.swift
// CHECK-NEXT: Action swift.protocol s:8MyModule6ActionP
// CHECK-NEXT: REFERENCED DECLS END

//--- Action.swift
public protocol Action {}

//--- test.swift
import MyModule

func test(action: Action) {
    switch action {
    case let action