|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | + |
| 3 | +// This test checks that conformances to _Copyable do not appear in swiftinterface files |
| 4 | + |
| 5 | +// Generate the parseable interface of the current file via the merge-modules step |
| 6 | +// RUN: %target-build-swift -emit-module -o %t/Test.swiftmodule -emit-module-interface-path %t/TestMerge.swiftinterface -module-name Test %s -enable-library-evolution -swift-version 5 |
| 7 | + |
| 8 | +// Generate the parseable interface of the current file via a single frontend invocation |
| 9 | +// RUN: %target-swift-frontend -enable-library-evolution -typecheck -emit-module-interface-path %t/TestSingle.swiftinterface -module-name Test %s -enable-library-evolution -swift-version 5 |
| 10 | + |
| 11 | +// Make sure Copyable doesn't appear anywhere in these files! |
| 12 | +// RUN: %FileCheck --implicit-check-not Copyable %s < %t/TestSingle.swiftinterface |
| 13 | +// RUN: %FileCheck --implicit-check-not Copyable %s < %t/TestMerge.swiftinterface |
| 14 | + |
| 15 | + |
| 16 | +// CHECK: forceGenericSubst |
| 17 | +public func forceGenericSubst<T>(_ t: T) { |
| 18 | + print(t) |
| 19 | +} |
| 20 | + |
| 21 | +public protocol ProtocolWithAssocType { |
| 22 | + associatedtype SomeType |
| 23 | + func get() -> SomeType |
| 24 | +} |
| 25 | + |
| 26 | +public class BestClass: ProtocolWithAssocType { |
| 27 | + public typealias SomeType = BestStruct |
| 28 | + public func get() -> SomeType { return BestStruct() } |
| 29 | +} |
| 30 | + |
| 31 | +public struct BestStruct { let c = BestClass() } |
| 32 | + |
| 33 | +public enum BestEnum<T> { |
| 34 | + case nothing |
| 35 | + case something(T) |
| 36 | +} |
| 37 | + |
| 38 | +public func caller(_ c: BestClass, _ s: BestStruct, _ e: BestEnum<BestStruct>) { |
| 39 | + forceGenericSubst(c) |
| 40 | + forceGenericSubst(s) |
| 41 | + forceGenericSubst(e) |
| 42 | +} |
| 43 | + |
| 44 | +public typealias TheTop = (Int, String) |
| 45 | + |
| 46 | +public struct S<T> { |
| 47 | + let t: T |
| 48 | + init(_ t: T) { self.t = t } |
| 49 | +} |
| 50 | + |
| 51 | +public typealias Handler = () -> () |
| 52 | + |
| 53 | +public func genericFn<T>(_ t: T) -> S<T> { |
| 54 | + return S(t) |
| 55 | +} |
| 56 | + |
| 57 | +public func maker(_ top: TheTop, withCompletion comp: @escaping Handler) -> S<TheTop> { |
| 58 | + _ = genericFn(top) |
| 59 | + _ = genericFn(comp) |
| 60 | + return S(top) |
| 61 | +} |
0 commit comments