File: imports-swift7.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 (53 lines) | stat: -rw-r--r-- 3,567 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
/// Swift 7 variant to imports.swift.

// RUN: %empty-directory(%t)
// RUN: split-file --leading-lines %s %t
// RUN: %target-swift-frontend -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -emit-module -o %t/nonResilient.swiftmodule %t/empty.swift
// RUN: %target-swift-frontend -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -emit-module -o %t/resilient.swiftmodule %t/empty.swift -enable-library-evolution

/// Check errors.
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %t/clientWithError.swift -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -I %t -verify -enable-upcoming-feature InternalImportsByDefault

/// Check Swift 7 imports printed in swiftinterface from 2 source files.
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %t/main.swift %t/main-other.swift -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -I %S/Inputs/imports-clang-modules/ -I %t -verify -enable-upcoming-feature InternalImportsByDefault
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -I %S/Inputs/imports-clang-modules/ -I %t
// RUN: %FileCheck -implicit-check-not BAD -check-prefix CHECK-7 %s < %t.swiftinterface

//--- empty.swift

//--- main.swift
@_exported public import resilient
public import B.B2 // expected-warning {{public import of 'B' was not used in public declarations or inlinable code}}

public import func C.c // expected-warning {{public import of 'C' was not used in public declarations or inlinable code}}
// expected-warning @-1 {{scoped imports are not yet supported in module interfaces}}
import D
@_implementationOnly import Secret_BAD

@_implementationOnly import NotSoSecret // expected-note {{imported as implementation-only here}}
public import NotSoSecret2 // expected-warning {{'NotSoSecret2' inconsistently imported as implementation-only}}
// expected-warning @-1 {{public import of 'NotSoSecret2' was not used in public declarations or inlinable code}}

//--- main-other.swift
public import A // expected-warning {{public import of 'A' was not used in public declarations or inlinable code}}
public import B.B3 // expected-warning {{public import of 'B' was not used in public declarations or inlinable code}}
public import D // expected-warning {{public import of 'D' was not used in public declarations or inlinable code}}

public import NotSoSecret // expected-warning {{'NotSoSecret' inconsistently imported as implementation-only}}
// expected-warning @-1 {{public import of 'NotSoSecret' was not used in public declarations or inlinable code}}
@_implementationOnly import NotSoSecret2 // expected-note {{imported as implementation-only here}}
//--- clientWithError.swift
@_exported public import nonResilient // expected-error {{module 'nonResilient' was not compiled with library evolution support; using it means binary compatibility for 'clientWithError' can't be guaranteed}}

// CHECK-7-NOT: import
// CHECK-7: {{^}}public import A{{$}}
// CHECK-7-NEXT: {{^}}public import B{{$}}
// CHECK-7-NEXT: {{^}}public import B.B2{{$}}
// CHECK-7-NEXT: {{^}}public import B.B3{{$}}
// CHECK-7-NEXT: {{^}}public import C/*.c*/{{$}}
// CHECK-7-NEXT: {{^}}public import D{{$}}
// CHECK-7-NEXT: {{^}}public import NotSoSecret{{$}}
// CHECK-7-NEXT: {{^}}public import NotSoSecret2{{$}}
// CHECK-7-NEXT: {{^}}public import Swift{{$}}
// CHECK-7-NEXT: {{^}}@_exported public import resilient{{$}}
// CHECK-7-NOT: import