|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: split-file --leading-lines %s %t |
| 3 | + |
| 4 | +/// Build the libraries. |
| 5 | +// RUN: %target-swift-frontend %t/LibCore.swift \ |
| 6 | +// RUN: -emit-module-path %t/LibCore.swiftmodule \ |
| 7 | +// RUN: -emit-module-interface-path %t/LibCore.swiftinterface \ |
| 8 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 9 | +// RUN: -public-module-name Lib |
| 10 | +// RUN: %target-swift-typecheck-module-from-interface(%t/LibCore.swiftinterface) |
| 11 | + |
| 12 | +// RUN: %target-swift-frontend %t/LibMiddle.swift -I %t \ |
| 13 | +// RUN: -emit-module-path %t/LibMiddle.swiftmodule \ |
| 14 | +// RUN: -emit-module-interface-path %t/LibMiddle.swiftinterface \ |
| 15 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 16 | +// RUN: -public-module-name Lib |
| 17 | +// RUN: %target-swift-typecheck-module-from-interface(%t/LibMiddle.swiftinterface) -I %t |
| 18 | + |
| 19 | +// RUN: %target-swift-frontend %t/Lib.swift -I %t \ |
| 20 | +// RUN: -emit-module-path %t/Lib.swiftmodule \ |
| 21 | +// RUN: -emit-module-interface-path %t/Lib.swiftinterface \ |
| 22 | +// RUN: -enable-library-evolution -swift-version 6 |
| 23 | +// RUN: %target-swift-typecheck-module-from-interface(%t/Lib.swiftinterface) -I %t |
| 24 | + |
| 25 | +// RUN: %target-swift-frontend %t/LibUnrelated.swift -I %t \ |
| 26 | +// RUN: -emit-module-path %t/LibUnrelated.swiftmodule \ |
| 27 | +// RUN: -enable-library-evolution -swift-version 6 |
| 28 | + |
| 29 | +/// Check flag in swiftinterface |
| 30 | +// RUN: cat %t/LibCore.swiftinterface | %FileCheck --check-prefix=CHECK-FLAG %s |
| 31 | +// RUN: cat %t/LibMiddle.swiftinterface | %FileCheck --check-prefix=CHECK-FLAG %s |
| 32 | +// CHECK-FLAG: swift-module-flags-ignorable: |
| 33 | +// CHECK-SAME-FLAG: -public-module-name Lib |
| 34 | + |
| 35 | +/// Build clients against binary swiftmodules. |
| 36 | +/// First errors in files, then diagnostics in other files. |
| 37 | +// RUN: %target-swift-frontend -typecheck %t/ClientPublic.swift -o %t -I %t \ |
| 38 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 39 | +// RUN: -verify |
| 40 | +// RUN: not %target-swift-frontend -typecheck %t/ClientPublic.swift -o %t -I %t \ |
| 41 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 42 | +// RUN: -diagnostic-style llvm \ |
| 43 | +// RUN: 2>&1 | %FileCheck %t/ClientPublic.swift |
| 44 | + |
| 45 | +// RUN: %target-swift-frontend -typecheck %t/ClientMiddle.swift -o %t -I %t \ |
| 46 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 47 | +// RUN: -verify |
| 48 | +// RUN: not %target-swift-frontend -typecheck %t/ClientMiddle.swift -o %t -I %t \ |
| 49 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 50 | +// RUN: 2>&1 | %FileCheck %t/ClientMiddle.swift |
| 51 | + |
| 52 | +/// Test more diagnostics referencing modules. |
| 53 | +// RUN: %target-swift-frontend -typecheck %t/ClientAccessLevelOnImports.swift -o %t -I %t \ |
| 54 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 55 | +// RUN: -verify |
| 56 | + |
| 57 | +/// Build client against textual swiftinterfaces. |
| 58 | +// RUN: rm %t/LibCore.swiftmodule %t/LibMiddle.swiftmodule %t/Lib.swiftmodule |
| 59 | +// RUN: %target-swift-frontend -typecheck %t/ClientPublic.swift -I %t \ |
| 60 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 61 | +// RUN: -verify |
| 62 | +// RUN: not %target-swift-frontend -typecheck %t/ClientPublic.swift -o %t -I %t \ |
| 63 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 64 | +// RUN: -diagnostic-style llvm \ |
| 65 | +// RUN: 2>&1 | %FileCheck %t/ClientPublic.swift |
| 66 | + |
| 67 | +// RUN: %target-swift-frontend -typecheck %t/ClientMiddle.swift -o %t -I %t \ |
| 68 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 69 | +// RUN: -verify |
| 70 | +// RUN: not %target-swift-frontend -typecheck %t/ClientMiddle.swift -o %t -I %t \ |
| 71 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 72 | +// RUN: 2>&1 | %FileCheck %t/ClientMiddle.swift |
| 73 | + |
| 74 | +// RUN: %target-swift-frontend -typecheck %t/ClientAccessLevelOnImports.swift -o %t -I %t \ |
| 75 | +// RUN: -enable-library-evolution -swift-version 6 \ |
| 76 | +// RUN: -verify |
| 77 | + |
| 78 | +//--- LibCore.swift |
| 79 | +public func ambiguous() {} |
| 80 | +public func coreFunc() {} |
| 81 | + |
| 82 | +//--- LibMiddle.swift |
| 83 | +import LibCore |
| 84 | +public func ambiguous() {} |
| 85 | + |
| 86 | +//--- Lib.swift |
| 87 | +@_exported import LibCore |
| 88 | +@_exported import LibMiddle |
| 89 | + |
| 90 | +//--- LibUnrelated.swift |
| 91 | +public func ambiguous() {} |
| 92 | + |
| 93 | +//--- ClientPublic.swift |
| 94 | +import Lib |
| 95 | +import LibUnrelated |
| 96 | + |
| 97 | +ambiguous() // expected-error {{ambiguous use of 'ambiguous()'}} |
| 98 | +// CHECK-NOT: LibCore |
| 99 | +// CHECK-NOT: LibMiddle |
| 100 | +// CHECK: LibUnrelated.ambiguous:1:13: note: found this candidate in module 'LibUnrelated' |
| 101 | +// CHECK: Lib.ambiguous:1:13: note: found this candidate in module 'Lib' |
| 102 | +// CHECK: Lib.ambiguous:1:13: note: found this candidate in module 'Lib' |
| 103 | + |
| 104 | +//--- ClientMiddle.swift |
| 105 | +import LibCore |
| 106 | +import LibMiddle |
| 107 | + |
| 108 | +ambiguous() // expected-error {{ambiguous use of 'ambiguous()'}} |
| 109 | +// CHECK: LibCore.ambiguous:1:13: note: found this candidate in module 'LibCore' |
| 110 | +// CHECK: LibMiddle.ambiguous:1:13: note: found this candidate in module 'LibMiddle' |
| 111 | + |
| 112 | +//--- ClientAccessLevelOnImports.swift |
| 113 | +internal import Lib // expected-note {{global function 'coreFunc()' imported as 'internal' from 'Lib' here}} |
| 114 | + |
| 115 | +@inlinable |
| 116 | +public func foo() { |
| 117 | + coreFunc() // expected-error {{global function 'coreFunc()' is internal and cannot be referenced from an '@inlinable' function}} |
| 118 | +} |
0 commit comments