File: cursor_swiftinterface.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 (74 lines) | stat: -rw-r--r-- 3,424 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import SomeModule

func test() {
  print(SomeFunc())
  let wrapper = XWrapper(x: 43)
  print(wrapper.x)
}

// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/modulecache)
//
// Tests CursorInfo works with modules imported via their .swiftinterface file.
// Setup builds a module interface (.swiftinterface) and doc file (.swiftdoc),
// for SomeModule (built from the SomeModule.swift input) that is imported in
// this file. No .swiftmodule is produced to force it into loading via the
// .swiftinterface file.

// Setup phase 1: build the module interface (.swiftinterface) and doc (.swiftdoc).
//
// RUN: %target-swift-frontend -I %t -module-name SomeModule -emit-module-interface-path %t/SomeModule.swiftinterface -emit-module-doc-path %t/SomeModule.swiftdoc %S/Inputs/SomeModule.swift -emit-module -o /dev/null

// Actual test: Check the CursorInfo results of references to symbols in that
// module, including the available refactoring actions, and associated doc
// comments (from the .swiftdoc file).
//
// RUN: %sourcekitd-test -req=cursor -cursor-action -pos=1:8 %s -- -I %t -module-cache-path %t/modulecache -target %target-triple %s | %FileCheck %s -check-prefix=CHECK1
// CHECK1: source.lang.swift.ref.module
// CHECK1: SomeModule
// CHECK1: ACTIONS BEGIN
// CHECK1-NEXT: ACTIONS END

// RUN: %sourcekitd-test -req=cursor -cursor-action -pos=4:9 %s -- -I %t -module-cache-path %t/modulecache -target %target-triple %s | %FileCheck %s -check-prefix=CHECK2
// CHECK2: source.lang.swift.ref.function.free
// CHECK2: SomeFunc()
// CHECK2: () -> Int
// CHECK2: SomeModule
// CHECK2: <CommentParts><Abstract><Para>This is SomeFunc that serves some function</Para></Abstract><ResultDiscussion><Para>42</Para></ResultDiscussion></CommentParts>
// CHECK2: ACTIONS BEGIN
// CHECK2-NEXT: source.refactoring.kind.rename.global
// CHECK2-NEXT: Global Rename
// CHECK2-NEXT: symbol without a declaration location cannot be renamed
// CHECK2-NEXT: ACTIONS END

// RUN: %sourcekitd-test -req=cursor -cursor-action -pos=5:17 %s -- -I %t -module-cache-path %t/modulecache -target %target-triple %s | %FileCheck %s -check-prefix=CHECK3
// CHECK3: source.lang.swift.ref.struct
// CHECK3: XWrapper
// CHECK3: XWrapper.Type
// CHECK3: SomeModule
// CHECK3: ACTIONS BEGIN
// CHECK3-NEXT: source.refactoring.kind.rename.global
// CHECK3-NEXT: Global Rename
// CHECK3-NEXT: symbol without a declaration location cannot be renamed
// CHECK3-NEXT: ACTIONS END

// RUN: %sourcekitd-test -req=cursor -cursor-action -pos=6:9 %s -- -I %t -module-cache-path %t/modulecache -target %target-triple %s | %FileCheck %s -check-prefix=CHECK4
// CHECK4: source.lang.swift.ref.var.local
// CHECK4: wrapper
// CHECK4: XWrapper
// CHECK4: ACTIONS BEGIN
// CHECK4-NEXT: source.refactoring.kind.rename.local
// CHECK4-NEXT: Local Rename
// CHECK4-NEXT: ACTIONS END

// RUN: %sourcekitd-test -req=cursor -cursor-action -pos=6:17 %s -- -I %t -module-cache-path %t/modulecache -target %target-triple %s | %FileCheck %s -check-prefix=CHECK5
// CHECK5: source.lang.swift.ref.var.instance
// CHECK5: x
// CHECK5: Int
// CHECK5: SomeModule
// CHECK5: <CommentParts><Abstract><Para>This is x, a property of XWrapper</Para></Abstract></CommentParts>
// CHECK5: ACTIONS BEGIN
// CHECK5-NEXT: source.refactoring.kind.rename.global
// CHECK5-NEXT: Global Rename
// CHECK5-NEXT: symbol without a declaration location cannot be renamed
// CHECK5-NEXT: ACTIONS END