-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathcomplete_from_swift_module_spi.swift
57 lines (38 loc) · 2.37 KB
/
complete_from_swift_module_spi.swift
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
// RUN: %empty-directory(%t/split)
// RUN: %empty-directory(%t/build)
// RUN: %{python} %utils/split_file.py -o %t/split %s
// RUN: %target-swift-frontend -emit-module -o %t/build %t/split/pck.swift
// First SPI completion then completion in file without SPI import
// RUN: %empty-directory(%t/cc-cache)
// RUN: %target-swift-ide-test -code-completion -completion-cache-path %t/cc-cache -source-filename %t/split/with-spi-import.swift -I %t/build -code-completion-token=COMPLETE | %FileCheck %s --check-prefix=WITH_SPI
// RUN: %target-swift-ide-test -code-completion -completion-cache-path %t/cc-cache -source-filename %t/split/with-different-spi-import.swift -I %t/build -code-completion-token=COMPLETE | %FileCheck %s --check-prefix=WITHOUT_SPI
// RUN: %target-swift-ide-test -code-completion -completion-cache-path %t/cc-cache -source-filename %t/split/with-normal-import.swift -I %t/build -code-completion-token=COMPLETE | %FileCheck %s --check-prefix=WITHOUT_SPI
// First completion in file without SPI import, then with SPI import
// RUN: %empty-directory(%t/cc-cache)
// RUN: %target-swift-ide-test -code-completion -completion-cache-path %t/cc-cache -source-filename %t/split/with-normal-import.swift -I %t/build -code-completion-token=COMPLETE | %FileCheck %s --check-prefix=WITHOUT_SPI
// RUN: %target-swift-ide-test -code-completion -completion-cache-path %t/cc-cache -source-filename %t/split/with-different-spi-import.swift -I %t/build -code-completion-token=COMPLETE | %FileCheck %s --check-prefix=WITHOUT_SPI
// RUN: %target-swift-ide-test -code-completion -completion-cache-path %t/cc-cache -source-filename %t/split/with-spi-import.swift -I %t/build -code-completion-token=COMPLETE | %FileCheck %s --check-prefix=WITH_SPI
// WITH_SPI-DAG: Decl[FreeFunction]/OtherModule[pck]: apiFunc()[#Void#]; name=apiFunc()
// WITH_SPI-DAG: Decl[FreeFunction]/OtherModule[pck]: spiFunc()[#Void#]; name=spiFunc()
// WITHOUT_SPI-NOT: spiFunc
// WITHOUT_SPI-DAG: Decl[FreeFunction]/OtherModule[pck]: apiFunc()[#Void#]; name=apiFunc()
// WITHOUT_SPI-NOT: spiFunc
// BEGIN pck.swift
public func apiFunc() {}
@_spi(MySPI)
public func spiFunc() {}
// BEGIN with-spi-import.swift
@_spi(MySPI) import pck
func test() {
#^COMPLETE^#
}
// BEGIN with-different-spi-import.swift
@_spi(OtherSPI) import pck
func test() {
#^COMPLETE^#
}
// BEGIN with-normal-import.swift
import pck
func test() {
#^COMPLETE^#
}