|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: split-file %s %t |
| 3 | + |
| 4 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(Utils)) %t/Utils.swift \ |
| 5 | +// RUN: -module-name Utils -package-name mypkg \ |
| 6 | +// RUN: -emit-module -emit-module-path %t/Utils.swiftmodule \ |
| 7 | +// RUN: -emit-tbd -emit-tbd-path %t/libUtils.tbd -Xfrontend -tbd-install_name=%t/libUtils.dylib -Xfrontend -validate-tbd-against-ir=all |
| 8 | + |
| 9 | +// RUN: %FileCheck %s --check-prefix CHECK-TBD < %t/libUtils.tbd |
| 10 | +// CHECK-TBD-NOT: $s5Utils6pubBar3argS2i_tFfA_ |
| 11 | +// CHECK-TBD-NOT: $s5Utils11internalBar3argS2i_tF |
| 12 | +// CHECK-TBD-NOT: $s5Utils11internalBar3argS2i_tFfA_ |
| 13 | +// CHECK-TBD-NOT: $s5Utils11internalFoo3argS2i_tF |
| 14 | +// CHECK-TBD: $s5Utils6pkgBar3argS2i_tF |
| 15 | +// CHECK-TBD: $s5Utils6pkgBar3argS2i_tFfA_ |
| 16 | +// CHECK-TBD: $s5Utils6pkgFoo3argS2i_tF |
| 17 | +// CHECK-TBD: $s5Utils6pubBar3argS2i_tF |
| 18 | +// CHECK-TBD: $s5Utils6pubFoo3argS2i_tF |
| 19 | + |
| 20 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(UtilsForTesting)) %t/Utils.swift \ |
| 21 | +// RUN: -module-name UtilsForTesting -package-name testpkg \ |
| 22 | +// RUN: -emit-module -emit-module-path %t/UtilsForTesting.swiftmodule \ |
| 23 | +// RUN: -emit-tbd -emit-tbd-path %t/libUtilsForTesting.tbd -Xfrontend -tbd-install_name=%t/libUtilsForTesting.dylib \ |
| 24 | +// RUN: -enable-testing -Xfrontend -validate-tbd-against-ir=all |
| 25 | + |
| 26 | + |
| 27 | +// RUN: %FileCheck %s --check-prefix CHECK-TEST < %t/libUtilsForTesting.tbd |
| 28 | +// CHECK-TEST-NOT: $s15UtilsForTesting6pubBar3argS2i_tFfA_ |
| 29 | +// CHECK-TEST: $s15UtilsForTesting11internalBar3argS2i_tF |
| 30 | +// CHECK-TEST: $s15UtilsForTesting11internalBar3argS2i_tFfA_ |
| 31 | +// CHECK-TEST: $s15UtilsForTesting11internalFoo3argS2i_tF |
| 32 | +// CHECK-TEST: $s15UtilsForTesting6pkgBar3argS2i_tF |
| 33 | +// CHECK-TEST: $s15UtilsForTesting6pkgBar3argS2i_tFfA_ |
| 34 | +// CHECK-TEST: $s15UtilsForTesting6pkgFoo3argS2i_tF |
| 35 | +// CHECK-TEST: $s15UtilsForTesting6pubBar3argS2i_tF |
| 36 | +// CHECK-TEST: $s15UtilsForTesting6pubFoo3argS2i_tF |
| 37 | + |
| 38 | +// RUN: %target-swift-frontend -typecheck %t/main.swift -I %t -L %t -lUtils -package-name mypkg -verify |
| 39 | + |
| 40 | + |
| 41 | +//--- Utils.swift |
| 42 | +public func pubBar(arg: Int = 1) -> Int { return arg + 11 } |
| 43 | +package func pkgBar(arg: Int = 1) -> Int { return arg + 12 } |
| 44 | +func internalBar(arg: Int = 1) -> Int { return arg + 13 } |
| 45 | + |
| 46 | +public func pubFoo(arg: Int) -> Int { return arg + 1 } |
| 47 | +package func pkgFoo(arg: Int) -> Int { return arg + 2 } |
| 48 | +func internalFoo(arg: Int) -> Int { return arg + 3 } |
| 49 | + |
| 50 | +//--- main.swift |
| 51 | +import Utils |
| 52 | + |
| 53 | +let a = pubBar() |
| 54 | +let b = pkgBar() |
| 55 | + |
| 56 | +let c = pubFoo(arg: 3) |
| 57 | +let d = pkgFoo(arg: 5) |
| 58 | + |
| 59 | +print(a, b, c, d) |
0 commit comments