|
| 1 | +// RUN: %target-swift-emit-silgen -disable-availability-checking -enable-upcoming-feature RegionBasedIsolation -enable-experimental-feature TransferringArgsAndResults -strict-concurrency=complete %s | %FileCheck %s |
| 2 | + |
| 3 | +class NonSendable {} |
| 4 | + |
| 5 | +// CHECK-LABEL: sil hidden [ossa] @$s12transferring15returnsSendableSSyYTF : $@convention(thin) () -> transferring @owned String { |
| 6 | +func returnsSendable() -> transferring String { fatalError() } |
| 7 | +// CHECK-LABEL: sil hidden [ossa] @$s12transferring18returnsNonSendableAA0cD0CyYTF : $@convention(thin) () -> transferring @owned NonSendable { |
| 8 | +func returnsNonSendable() -> transferring NonSendable { fatalError() } |
| 9 | +// CHECK-LABEL: sil hidden [ossa] @$s12transferring25genericReturnsNonSendablexyYTlF : $@convention(thin) <T> () -> transferring @out T { |
| 10 | +func genericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 11 | + |
| 12 | +actor MyActor { |
| 13 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring7MyActorC15returnsSendableSSyYTF : $@convention(method) (@sil_isolated @guaranteed MyActor) -> transferring @owned String { |
| 14 | + func returnsSendable() -> transferring String { fatalError() } |
| 15 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring7MyActorC18returnsNonSendableAA0eF0CyYTF : $@convention(method) (@sil_isolated @guaranteed MyActor) -> transferring @owned NonSendable { |
| 16 | + func returnsNonSendable() -> transferring NonSendable { fatalError() } |
| 17 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring7MyActorC25genericReturnsNonSendablexyYTlF : $@convention(method) <T> (@sil_isolated @guaranteed MyActor) -> transferring @out T { |
| 18 | + func genericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 19 | +} |
| 20 | + |
| 21 | +struct Struct { |
| 22 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring6StructV15returnsSendableSSyYTF : $@convention(method) (Struct) -> transferring @owned String { |
| 23 | + func returnsSendable() -> transferring String { fatalError() } |
| 24 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring6StructV18returnsNonSendableAA0dE0CyYTF : $@convention(method) (Struct) -> transferring @owned NonSendable { |
| 25 | + func returnsNonSendable() -> transferring NonSendable { fatalError() } |
| 26 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring6StructV25genericReturnsNonSendablexyYTlF : $@convention(method) <T> (Struct) -> transferring @out T { |
| 27 | + func genericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 28 | +} |
| 29 | + |
| 30 | +@MainActor |
| 31 | +struct MainActorStruct { |
| 32 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring15MainActorStructV15returnsSendableSSyYTF : $@convention(method) (MainActorStruct) -> transferring @owned String { |
| 33 | + func returnsSendable() -> transferring String { fatalError() } |
| 34 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring15MainActorStructV18returnsNonSendableAA0fG0CyYTF : $@convention(method) (MainActorStruct) -> transferring @owned NonSendable { |
| 35 | + func returnsNonSendable() -> transferring NonSendable { fatalError() } |
| 36 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring15MainActorStructV25genericReturnsNonSendablexyYTlF : $@convention(method) <T> (MainActorStruct) -> transferring @out T { |
| 37 | + func genericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 38 | +} |
| 39 | + |
| 40 | +class Class { |
| 41 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring5ClassC15returnsSendableSSyYTF : $@convention(method) (@guaranteed Class) -> transferring @owned String { |
| 42 | + func returnsSendable() -> transferring String { fatalError() } |
| 43 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring5ClassC18returnsNonSendableAA0dE0CyYTF : $@convention(method) (@guaranteed Class) -> transferring @owned NonSendable { |
| 44 | + func returnsNonSendable() -> transferring NonSendable { fatalError() } |
| 45 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring5ClassC25genericReturnsNonSendablexyYTlF : $@convention(method) <T> (@guaranteed Class) -> transferring @out T { |
| 46 | + func genericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 47 | +} |
| 48 | + |
| 49 | +final class FinalClass { |
| 50 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring10FinalClassC15returnsSendableSSyYTF : $@convention(method) (@guaranteed FinalClass) -> transferring @owned String { |
| 51 | + func returnsSendable() -> transferring String { fatalError() } |
| 52 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring10FinalClassC18returnsNonSendableAA0eF0CyYTF : $@convention(method) (@guaranteed FinalClass) -> transferring @owned NonSendable { |
| 53 | + func returnsNonSendable() -> transferring NonSendable { fatalError() } |
| 54 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring10FinalClassC25genericReturnsNonSendablexyYTlF : $@convention(method) <T> (@guaranteed FinalClass) -> transferring @out T { |
| 55 | + func genericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 56 | +} |
| 57 | + |
| 58 | +@MainActor |
| 59 | +class MainActorClass { |
| 60 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring14MainActorClassC15returnsSendableSSyYTF : $@convention(method) (@guaranteed MainActorClass) -> transferring @owned String { |
| 61 | + func returnsSendable() -> transferring String { fatalError() } |
| 62 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring14MainActorClassC18returnsNonSendableAA0fG0CyYTF : $@convention(method) (@guaranteed MainActorClass) -> transferring @owned NonSendable { |
| 63 | + func returnsNonSendable() -> transferring NonSendable { fatalError() } |
| 64 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring14MainActorClassC25genericReturnsNonSendablexyYTlF : $@convention(method) <T> (@guaranteed MainActorClass) -> transferring @out T { |
| 65 | + func genericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 66 | +} |
| 67 | + |
| 68 | +@MainActor |
| 69 | +final class FinalMainActorClass { |
| 70 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring19FinalMainActorClassC15returnsSendableSSyYTF : $@convention(method) (@guaranteed FinalMainActorClass) -> transferring @owned String { |
| 71 | + func returnsSendable() -> transferring String { fatalError() } |
| 72 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring19FinalMainActorClassC18returnsNonSendableAA0gH0CyYTF : $@convention(method) (@guaranteed FinalMainActorClass) -> transferring @owned NonSendable { |
| 73 | + func returnsNonSendable() -> transferring NonSendable { fatalError() } |
| 74 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring19FinalMainActorClassC25genericReturnsNonSendablexyYTlF : $@convention(method) <T> (@guaranteed FinalMainActorClass) -> transferring @out T { |
| 75 | + func genericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 76 | +} |
| 77 | + |
| 78 | +enum Enum { |
| 79 | + case myCase |
| 80 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring4EnumO15returnsSendableSSyYTF : $@convention(method) (Enum) -> transferring @owned String { |
| 81 | + func returnsSendable() -> transferring String { fatalError() } |
| 82 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring4EnumO18returnsNonSendableAA0dE0CyYTF : $@convention(method) (Enum) -> transferring @owned NonSendable { |
| 83 | + func returnsNonSendable() -> transferring NonSendable { fatalError() } |
| 84 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring4EnumO25genericReturnsNonSendablexyYTlF : $@convention(method) <T> (Enum) -> transferring @out T { |
| 85 | + func genericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 86 | +} |
| 87 | + |
| 88 | +@MainActor |
| 89 | +enum MainActorEnum { |
| 90 | + case myCase |
| 91 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring13MainActorEnumO15returnsSendableSSyYTF : $@convention(method) (MainActorEnum) -> transferring @owned String { |
| 92 | + func returnsSendable() -> transferring String { fatalError() } |
| 93 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring13MainActorEnumO18returnsNonSendableAA0fG0CyYTF : $@convention(method) (MainActorEnum) -> transferring @owned NonSendable { |
| 94 | + func returnsNonSendable() -> transferring NonSendable { fatalError() } |
| 95 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring13MainActorEnumO25genericReturnsNonSendablexyYTlF : $@convention(method) <T> (MainActorEnum) -> transferring @out T { |
| 96 | + func genericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 97 | +} |
| 98 | + |
| 99 | +protocol P { |
| 100 | + func protReturnsSendable() -> transferring String |
| 101 | + func protReturnsNonSendable() -> transferring NonSendable |
| 102 | + func protGenericReturnsNonSendable<T>() -> transferring T |
| 103 | +} |
| 104 | + |
| 105 | +extension P { |
| 106 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring1PPAAE19protReturnsSendableSSyYTF : $@convention(method) <Self where Self : P> (@in_guaranteed Self) -> transferring @owned String { |
| 107 | + func protReturnsSendable() -> transferring String { fatalError() } |
| 108 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring1PPAAE22protReturnsNonSendableAA0dE0CyYTF : $@convention(method) <Self where Self : P> (@in_guaranteed Self) -> transferring @owned NonSendable { |
| 109 | + func protReturnsNonSendable() -> transferring NonSendable { fatalError() } |
| 110 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring1PPAAE29protGenericReturnsNonSendableqd__yYTlF : $@convention(method) <Self where Self : P><T> (@in_guaranteed Self) -> transferring @out T { |
| 111 | + func protGenericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 112 | +} |
| 113 | + |
| 114 | +extension Struct : P { |
| 115 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring6StructV19protReturnsSendableSSyYTF : $@convention(method) (Struct) -> transferring @owned String { |
| 116 | + func protReturnsSendable() -> transferring String { fatalError() } |
| 117 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring6StructV22protReturnsNonSendableAA0eF0CyYTF : $@convention(method) (Struct) -> transferring @owned NonSendable { |
| 118 | + func protReturnsNonSendable() -> transferring NonSendable { fatalError() } |
| 119 | + // CHECK-LABEL: sil hidden [ossa] @$s12transferring6StructV29protGenericReturnsNonSendablexyYTlF : $@convention(method) <T> (Struct) -> transferring @out T { |
| 120 | + func protGenericReturnsNonSendable<T>() -> transferring T { fatalError() } |
| 121 | +} |
0 commit comments