File: cursor_generated_interface.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 (120 lines) | stat: -rw-r--r-- 4,852 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// REQUIRES: objc_interop

// RUN: %empty-directory(%t)
// RUN: mkdir -p %t/frameworks/LibA.framework/Modules/LibA.swiftmodule %t/mods %t/mods
// RUN: split-file --leading-lines %s %t

// RUN: %target-swift-frontend -module-name LibB -emit-module -emit-module-path %t/mods/LibB.swiftmodule -emit-module-source-info-path %t/mods/LibB.swiftsourceinfo %t/libB.swift
// RUN: %target-swift-frontend -module-name LibC -emit-module -emit-module-path %t/mods/LibC.swiftmodule %t/libC.swift
// RUN: %target-swift-frontend -module-name LibA -emit-module -emit-module-path %t/frameworks/LibA.framework/Modules/LibA.swiftmodule/%target-swiftmodule-name -import-underlying-module -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -F %t/frameworks -I %t/mods %t/libA.swift
// RUN: %swift-ide-test -print-module -print-interface -source-filename dummy -module-to-print LibA -F %t/frameworks -target %target-triple &> %t/generated.swift

// Check that we always include module name, regardless of whether we have
// source information or not. If we have source information, we should also
// output it.

//--- use.swift

import LibA

// RUN: %sourcekitd-test -req=cursor -pos=%(line+1):8 -print-raw-response %t/use.swift -- -F %t/frameworks -target %target-triple %t/use.swift | %FileCheck %s --check-prefix=CHECKSWIFT
let _: ASwiftType
// CHECKSWIFT: key.name: "ASwiftType"
// CHECKSWIFT: key.modulename: "LibA"
// CHECKSWIFT: key.decl_lang: source.lang.swift

// RUN: %sourcekitd-test -req=cursor -pos=%(line+1):8 -print-raw-response %t/use.swift -- -F %t/frameworks -target %target-triple %t/use.swift | %FileCheck %s --check-prefix=CHECKOBJC
let _: AObjcType
// CHECKOBJC: key.name: "AObjcType"
// CHECKOBJC: key.modulename: "LibA"
// CHECKOBJC: key.decl_lang: source.lang.objc

//--- libA.swift

import LibB
import LibC
import LibD

public class ASwiftType {
  public func aTypes(swift: ASwiftType, objc: AObjcType, sub: ASubType) {}
  public func others(b: BType, c: CType, d: DType) {}
}

// LibA is a mixed framework with no source info and a submodule
// RUN: %sourcekitd-test -req=interface-gen-open -module LibA -- -F %t/frameworks -target %target-triple == -req=cursor -pos=12:36 -print-raw-response | %FileCheck %s --check-prefix=CHECKA
// CHECKA: key.name: "ASwiftType"
// CHECKA: key.modulename: "LibA"
// CHECKA: key.decl_lang: source.lang.swift

//--- frameworks/LibA.framework/module.map
framework module LibA {
  header "LibA.h"
  export *

  module Sub {
    header "LibASub.h"
  }
}

//--- frameworks/LibA.framework/Headers/LibA.h
@interface AObjcType
@end

// RUN: %sourcekitd-test -req=interface-gen-open -module LibA -- -F %t/frameworks -target %target-triple == -req=cursor -pos=12:54 -print-raw-response | %FileCheck %s --check-prefix=CHECKAOBJ
// CHECKAOBJ: key.name: "AObjcType"
// CHECKAOBJ: key.line: [[@LINE-5]]
// CHECKAOBJ: key.column: 12
// CHECKAOBJ: key.filepath: {{.*}}LibA.h
// CHECKAOBJ: key.modulename: "LibA"
// CHECKAOBJ: key.decl_lang: source.lang.objc

//--- frameworks/LibA.framework/Headers/LibASub.h
@interface ASubType
@end

// RUN: %sourcekitd-test -req=interface-gen-open -module LibA -- -F %t/frameworks -target %target-triple == -req=cursor -pos=12:70 -print-raw-response | %FileCheck %s --check-prefix=CHECKASUB
// CHECKASUB: key.name: "ASubType"
// CHECKASUB: key.line: [[@LINE-5]]
// CHECKASUB: key.column: 12
// CHECKASUB: key.filepath: {{.*}}LibASub.h
// CHECKASUB: key.modulename: "LibA.Sub"
// CHECKASUB: key.decl_lang: source.lang.objc

//--- libB.swift
public class BType {}

// LibB has source info
// RUN: %sourcekitd-test -req=interface-gen-open -module LibA -- -F %t/frameworks -target %target-triple == -req=cursor -pos=14:32 -print-raw-response | %FileCheck %s --check-prefix=CHECKB
// CHECKB: key.name: "BType"
// CHECKB: key.line: [[@LINE-5]]
// CHECKB: key.column: 14
// CHECKB: key.filepath: {{.*}}libB.swift
// CHECKB: key.modulename: "LibB"
// CHECKB: key.decl_lang: source.lang.swift

//--- libC.swift
public class CType {}

// LibC has no source info
// RUN: %sourcekitd-test -req=interface-gen-open -module LibA -- -F %t/frameworks -target %target-triple == -req=cursor -pos=14:47 -print-raw-response | %FileCheck %s --check-prefix=CHECKC
// CHECKC: key.name: "CType"
// CHECKC: key.modulename: "LibC"
// CHECKC: key.decl_lang: source.lang.swift

//--- mods/LibD.h
@interface DType
@end

// RUN: %sourcekitd-test -req=interface-gen-open -module LibA -- -F %t/frameworks -target %target-triple == -req=cursor -pos=14:57 -print-raw-response | %FileCheck %s --check-prefix=CHECKD
// CHECKD: key.name: "DType"
// CHECKD: key.line: [[@LINE-5]]
// CHECKD: key.column: 12
// CHECKD: key.filepath: {{.*}}LibD.h
// CHECKD: key.modulename: "LibD"
// CHECKD: key.decl_lang: source.lang.objc

//--- mods/module.map
module LibD {
  header "LibD.h"
  export *
}