File: implementation-only-imports.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 (69 lines) | stat: -rw-r--r-- 3,436 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
// RUN: %empty-directory(%t)
//
// RUN: %target-swift-frontend -emit-module -o %t -module-name CoreFoo %S/Inputs/implementation-only-imports-helper.swift
// RUN: %target-swift-frontend -emit-module -I %t -o %t -module-name FooKit %s
// RUN: %target-swift-ide-test -print-indexed-symbols -module-name FooKit -source-filename %s -I %t > %t.out

// RUN: mv %t/CoreFoo.swiftmodule %t/SecretCoreFoo.swiftmodule
// RUN: echo '---FROM MODULE---' >> %t.out
// RUN: %target-swift-ide-test -print-indexed-symbols -module-to-print FooKit -source-filename %s -I %t >> %t.out
// RUN: %FileCheck %s -input-file=%t.out
// RUN: %FileCheck -check-prefix NEGATIVE %s -input-file=%t.out

// CHECK: module | user | CoreFoo | {{.+}}CoreFoo.swiftmodule
@_implementationOnly import CoreFoo
// CHECK: [[@LINE-1]]:{{[0-9]+}} | module/Swift | CoreFoo | c:@M@CoreFoo | Ref | rel: 0

internal class SECRETSubclass : SECRETClass {}
// CHECK: [[@LINE-1]]:{{[0-9]+}} | class/Swift | SECRETSubclass | [[SECRET_SUBCLASS_USR:s:[^|]+]] | Def | rel: 0
// CHECK: [[@LINE-2]]:{{[0-9]+}} | class/Swift | SECRETClass | [[SECRET_CLASS_USR:s:[^|]+]] | Ref,RelBase | rel: 1
// CHECK-NEXT:  RelBase | class/Swift | SECRETSubclass | [[SECRET_SUBCLASS_USR]]{{$}}

public class PublicClass {
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | class/Swift | PublicClass | [[PUBLIC_CLASS_USR:s:[^|]+]] | Def | rel: 0
  internal var propSECRET: SECRETClass? { nil }
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | instance-property/Swift | propSECRET |
  internal var propSECRET2: SECRETSubclass? { nil }
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | instance-property/Swift | propSECRET2 |
}

extension SECRETClass {
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | extension/ext-class/Swift | SECRETClass |
  internal func testSECRET() {}
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | instance-method/Swift | testSECRET() |
}

extension PublicClass {
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | extension/ext-class/Swift | PublicClass | [[PUBLIC_CLASS_EXTENSION_USR:s:[^|]+]] |
  public func extensionNamingMethod() {}
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | instance-method/Swift | extensionNamingMethod() |

  internal func testSECRET() {}
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | instance-method/Swift | testSECRET() |

  internal struct SECRETStruct: SECRETProtocol {}
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | struct/Swift | SECRETStruct | [[SECRET_NESTED_STRUCT_USR:s:[^|]+]] |
  // CHECK: [[@LINE-2]]:{{[0-9]+}} | protocol/Swift | SECRETProtocol | [[SECRET_PROTOCOL_USR:s:[^|]+]] | Ref,RelBase | rel: 1
  // CHECK-NEXT: RelBase | struct/Swift | SECRETStruct | [[SECRET_NESTED_STRUCT_USR]]
}

extension Optional where Wrapped: SECRETProtocol {
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | extension/ext-enum/Swift | Optional |
  internal func extensionNamingMethod() {}
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | instance-method/Swift | extensionNamingMethod() |

  internal func testSECRET() {}
  // CHECK: [[@LINE-1]]:{{[0-9]+}} | instance-method/Swift | testSECRET() |
}

// CHECK-LABEL: ---FROM MODULE---
// NEGATIVE-LABEL: ---FROM MODULE---

// CHECK: 0:0 | class/Swift | PublicClass | [[PUBLIC_CLASS_USR]] | Def | rel: 0
// CHECK: 0:0 | extension/ext-class/Swift | PublicClass | [[PUBLIC_CLASS_EXTENSION_USR]] | Def | rel: 0
// CHECK: 0:0 | class/Swift | PublicClass | [[PUBLIC_CLASS_USR]] | Ref,RelExt | rel: 1
// CHECK-NEXT: RelExt | extension/ext-class/Swift | PublicClass | [[PUBLIC_CLASS_EXTENSION_USR]]


// NEGATIVE-NOT: CoreFoo
// NEGATIVE-NOT: SECRET