Skip to content

Commit d5c9a4b

Browse files
committed
[Distributed] NFC: Add SerializationRequirement conformance to decoder in tests
1 parent 3a3f78b commit d5c9a4b

23 files changed

+132
-72
lines changed

test/Distributed/Inputs/FakeDistributedActorSystems.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
311311
return genericSubs
312312
}
313313

314-
public func decodeNextArgument<Argument>() throws -> Argument {
314+
public func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument {
315315
guard argumentIndex < arguments.count else {
316316
fatalError("Attempted to decode more arguments than stored! Index: \(argumentIndex), args: \(arguments)")
317317
}

test/Distributed/Inputs/dynamic_replacement_da_decl.swift

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ struct ActorAddress: Hashable, Sendable, Codable {
3636

3737
final class FakeActorSystem: DistributedActorSystem {
3838
typealias ActorID = ActorAddress
39-
typealias InvocationDecoder = FakeInvocation
40-
typealias InvocationEncoder = FakeInvocation
39+
typealias InvocationDecoder = FakeInvocationDecoder
40+
typealias InvocationEncoder = FakeInvocationEncoder
4141
typealias SerializationRequirement = Codable
4242

4343
func resolve<Act>(id: ActorID, as actorType: Act.Type) throws -> Act?
@@ -82,19 +82,23 @@ struct FakeDistributedSystemError: DistributedActorSystemError {
8282
let message: String
8383
}
8484

85-
class FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvocationDecoder {
85+
// === Sending / encoding -------------------------------------------------
86+
struct FakeInvocationEncoder: DistributedTargetInvocationEncoder {
8687
typealias SerializationRequirement = Codable
8788

88-
func recordGenericSubstitution<T>(_ type: T.Type) throws {}
89-
func recordArgument<Argument: SerializationRequirement>(_ argument: Argument) throws {}
90-
func recordReturnType<R: SerializationRequirement>(_ type: R.Type) throws {}
91-
func recordErrorType<E: Error>(_ type: E.Type) throws {}
92-
func doneRecording() throws {}
89+
mutating func recordGenericSubstitution<T>(_ type: T.Type) throws {}
90+
mutating func recordArgument<Argument: SerializationRequirement>(_ argument: Argument) throws {}
91+
mutating func recordReturnType<R: SerializationRequirement>(_ type: R.Type) throws {}
92+
mutating func recordErrorType<E: Error>(_ type: E.Type) throws {}
93+
mutating func doneRecording() throws {}
94+
}
9395

94-
// === Receiving / decoding -------------------------------------------------
96+
// === Receiving / decoding -------------------------------------------------
97+
class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
98+
typealias SerializationRequirement = Codable
9599

96100
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
97-
func decodeNextArgument<Argument>() throws -> Argument { fatalError() }
101+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
98102
func decodeReturnType() throws -> Any.Type? { nil }
99103
func decodeErrorType() throws -> Any.Type? { nil }
100104
}

test/Distributed/Runtime/distributed_actor_decode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvoc
113113
// === Receiving / decoding -------------------------------------------------
114114

115115
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
116-
func decodeNextArgument<Argument>() throws -> Argument { fatalError() }
116+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
117117
func decodeReturnType() throws -> Any.Type? { nil }
118118
func decodeErrorType() throws -> Any.Type? { nil }
119119
}

test/Distributed/Runtime/distributed_actor_deinit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class FakeDistributedInvocation: DistributedTargetInvocationEncoder, Distributed
133133
func decodeGenericSubstitutions() throws -> [Any.Type] {
134134
[]
135135
}
136-
func decodeNextArgument<Argument>() throws -> Argument {
136+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument {
137137
fatalError()
138138
}
139139
func decodeReturnType() throws -> Any.Type? {

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_generic.swift

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ struct ActorAddress: Sendable, Hashable, Codable {
4545
//final class FakeActorSystem: DistributedActorSystem {
4646
struct FakeActorSystem: DistributedActorSystem {
4747
typealias ActorID = ActorAddress
48-
typealias InvocationDecoder = FakeInvocation
49-
typealias InvocationEncoder = FakeInvocation
48+
typealias InvocationDecoder = FakeInvocationDecoder
49+
typealias InvocationEncoder = FakeInvocationEncoder
5050
typealias SerializationRequirement = Codable
5151

5252
init() {}
@@ -105,16 +105,17 @@ struct FakeActorSystem: DistributedActorSystem {
105105

106106
}
107107

108-
struct FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvocationDecoder {
108+
109+
struct FakeInvocationEncoder: DistributedTargetInvocationEncoder {
109110
typealias SerializationRequirement = Codable
110111

111-
var types: [Any.Type] = []
112+
var substitutions: [Any.Type] = []
112113
var arguments: [Any] = []
113114
var returnType: Any.Type? = nil
114115
var errorType: Any.Type? = nil
115116

116117
mutating func recordGenericSubstitution<T>(_ type: T.Type) throws {
117-
types.append(type)
118+
substitutions.append(type)
118119
}
119120
mutating func recordArgument<Argument: SerializationRequirement>(_ argument: Argument) throws {
120121
arguments.append(argument)
@@ -127,17 +128,45 @@ struct FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvo
127128
}
128129
mutating func doneRecording() throws {}
129130

130-
// === Receiving / decoding -------------------------------------------------
131+
// For testing only
132+
func makeDecoder() -> FakeInvocationDecoder {
133+
return .init(
134+
args: arguments,
135+
substitutions: substitutions,
136+
returnType: returnType,
137+
errorType: errorType
138+
)
139+
}
140+
}
141+
142+
143+
class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
144+
typealias SerializationRequirement = Codable
131145

146+
var arguments: [Any] = []
147+
var substitutions: [Any.Type] = []
148+
var returnType: Any.Type? = nil
149+
var errorType: Any.Type? = nil
150+
151+
init(
152+
args: [Any],
153+
substitutions: [Any.Type] = [],
154+
returnType: Any.Type? = nil,
155+
errorType: Any.Type? = nil
156+
) {
157+
self.arguments = args
158+
self.substitutions = substitutions
159+
self.returnType = returnType
160+
self.errorType = errorType
161+
}
162+
163+
// === Receiving / decoding -------------------------------------------------
132164
func decodeGenericSubstitutions() throws -> [Any.Type] {
133-
[]
165+
return substitutions
134166
}
135167

136168
var argumentIndex: Int = 0
137-
mutating func decodeNextArgument<Argument>(
138-
_ argumentType: Argument.Type,
139-
into pointer: UnsafeMutablePointer<Argument>
140-
) throws {
169+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument {
141170
guard argumentIndex < arguments.count else {
142171
fatalError("Attempted to decode more arguments than stored! Index: \(argumentIndex), args: \(arguments)")
143172
}
@@ -148,16 +177,18 @@ struct FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvo
148177
}
149178

150179
print(" > decode argument: \(argument)")
151-
pointer.pointee = argument
152180
argumentIndex += 1
181+
return argument
153182
}
154183

155-
func decodeErrorType() throws -> Any.Type? {
156-
self.errorType
184+
public func decodeErrorType() throws -> Any.Type? {
185+
print(" > decode return type: \(errorType.map { String(describing: $0) } ?? "nil")")
186+
return self.errorType
157187
}
158188

159-
func decodeReturnType() throws -> Any.Type? {
160-
self.returnType
189+
public func decodeReturnType() throws -> Any.Type? {
190+
print(" > decode return type: \(returnType.map { String(describing: $0) } ?? "nil")")
191+
return self.returnType
161192
}
162193
}
163194

test/Distributed/Runtime/distributed_actor_init_local.swift

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ var nextID: Int = 1
7070

7171
struct FakeActorSystem: DistributedActorSystem {
7272
public typealias ActorID = ActorAddress
73-
public typealias InvocationDecoder = FakeInvocation
74-
public typealias InvocationEncoder = FakeInvocation
73+
public typealias InvocationDecoder = FakeInvocationDecoder
74+
public typealias InvocationEncoder = FakeInvocationEncoder
7575
public typealias SerializationRequirement = Codable
7676

7777
init() {
@@ -121,24 +121,25 @@ struct FakeActorSystem: DistributedActorSystem {
121121

122122
}
123123

124-
public struct FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvocationDecoder {
125-
public typealias SerializationRequirement = Codable
124+
// === Sending / encoding -------------------------------------------------
125+
struct FakeInvocationEncoder: DistributedTargetInvocationEncoder {
126+
typealias SerializationRequirement = Codable
127+
128+
mutating func recordGenericSubstitution<T>(_ type: T.Type) throws {}
129+
mutating func recordArgument<Argument: SerializationRequirement>(_ argument: Argument) throws {}
130+
mutating func recordReturnType<R: SerializationRequirement>(_ type: R.Type) throws {}
131+
mutating func recordErrorType<E: Error>(_ type: E.Type) throws {}
132+
mutating func doneRecording() throws {}
133+
}
134+
135+
// === Receiving / decoding -------------------------------------------------
136+
class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
137+
typealias SerializationRequirement = Codable
126138

127-
public mutating func recordGenericSubstitution<T>(_ type: T.Type) throws {}
128-
public mutating func recordArgument<Argument: SerializationRequirement>(_ argument: Argument) throws {}
129-
public mutating func recordReturnType<R: SerializationRequirement>(_ type: R.Type) throws {}
130-
public mutating func recordErrorType<E: Error>(_ type: E.Type) throws {}
131-
public mutating func doneRecording() throws {}
132-
133-
// === Receiving / decoding -------------------------------------------------
134-
135-
public func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
136-
public mutating func decodeNextArgument<Argument>(
137-
_ argumentType: Argument.Type,
138-
into pointer: UnsafeMutablePointer<Argument> // pointer to our hbuffer
139-
) throws { /* ... */ }
140-
public func decodeReturnType() throws -> Any.Type? { nil }
141-
public func decodeErrorType() throws -> Any.Type? { nil }
139+
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
140+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
141+
func decodeReturnType() throws -> Any.Type? { nil }
142+
func decodeErrorType() throws -> Any.Type? { nil }
142143
}
143144

144145
typealias DefaultDistributedActorSystem = FakeActorSystem

test/Distributed/Runtime/distributed_actor_isRemote.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
109109
typealias SerializationRequirement = Codable
110110

111111
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
112-
func decodeNextArgument<Argument>() throws -> Argument { fatalError() }
112+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
113113
func decodeReturnType() throws -> Any.Type? { nil }
114114
func decodeErrorType() throws -> Any.Type? { nil }
115115
}

test/Distributed/Runtime/distributed_actor_local.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
113113
typealias SerializationRequirement = Codable
114114

115115
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
116-
func decodeNextArgument<Argument>() throws -> Argument { fatalError() }
116+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
117117
func decodeReturnType() throws -> Any.Type? { nil }
118118
func decodeErrorType() throws -> Any.Type? { nil }
119119
}

test/Distributed/Runtime/distributed_actor_remoteCall.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
227227
}
228228

229229
var argumentIndex: Int = 0
230-
func decodeNextArgument<Argument>() throws -> Argument {
230+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument {
231231
guard argumentIndex < arguments.count else {
232232
fatalError("Attempted to decode more arguments than stored! Index: \(argumentIndex), args: \(arguments)")
233233
}

test/Distributed/Runtime/distributed_actor_remote_fieldsDontCrashDeinit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
126126
typealias SerializationRequirement = Codable
127127

128128
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
129-
func decodeNextArgument<Argument>() throws -> Argument { fatalError() }
129+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
130130
func decodeReturnType() throws -> Any.Type? { nil }
131131
func decodeErrorType() throws -> Any.Type? { nil }
132132
}

test/Distributed/Runtime/distributed_actor_remote_functions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
217217
typealias SerializationRequirement = Codable
218218

219219
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
220-
func decodeNextArgument<Argument>() throws -> Argument { fatalError() }
220+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
221221
func decodeReturnType() throws -> Any.Type? { nil }
222222
func decodeErrorType() throws -> Any.Type? { nil }
223223
}

test/Distributed/Runtime/distributed_actor_remote_retains_system.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvoc
110110
// === Receiving / decoding -------------------------------------------------
111111

112112
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
113-
func decodeNextArgument<Argument>() throws -> Argument{ fatalError() }
113+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument{ fatalError() }
114114
func decodeReturnType() throws -> Any.Type? { nil }
115115
func decodeErrorType() throws -> Any.Type? { nil }
116116
}

test/Distributed/Runtime/distributed_actor_self_calls.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
111111
typealias SerializationRequirement = Codable
112112

113113
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
114-
func decodeNextArgument<Argument>() throws -> Argument { fatalError() }
114+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
115115
func decodeReturnType() throws -> Any.Type? { nil }
116116
func decodeErrorType() throws -> Any.Type? { nil }
117117
}

test/Distributed/Runtime/distributed_actor_whenLocal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvoc
9898
// === Receiving / decoding -------------------------------------------------
9999

100100
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
101-
func decodeNextArgument<Argument>() throws -> Argument { fatalError() }
101+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
102102
func decodeReturnType() throws -> Any.Type? { nil }
103103
func decodeErrorType() throws -> Any.Type? { nil }
104104
}

test/Distributed/Runtime/distributed_func_metadata.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
115115
typealias SerializationRequirement = Codable
116116

117117
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
118-
func decodeNextArgument<Argument>() throws -> Argument { fatalError() }
118+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
119119
func decodeReturnType() throws -> Any.Type? { nil }
120120
func decodeErrorType() throws -> Any.Type? { nil }
121121
}

test/Distributed/distributed_actor_accessor_thunks_32bit.swift

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,19 @@ public distributed actor MyOtherActor {
108108
// CHECK-NEXT: [[ARG_0_SIZE:%.*]] = and i32 [[ARG_0_SIZE_ADJ]], -16
109109
// CHECK-NEXT: [[ARG_0_VALUE_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_0_SIZE]])
110110
// CHECK-NEXT: [[ARG_0_RES_SLOT:%.*]] = bitcast i8* [[ARG_0_VALUE_BUF]] to %swift.opaque*
111-
// CHECK-NEXT: call swiftcc void {{.*}}(%swift.opaque* noalias nocapture sret(%swift.opaque) [[ARG_0_RES_SLOT]], %swift.type* %arg_type, %T27FakeDistributedActorSystems0A17InvocationDecoderC* swiftself %1, %swift.error** noalias nocapture dereferenceable(4) %swifterror)
111+
// CHECK-NEXT: [[ENCODABLE_WITNESS:%.*]] = call i8** @swift_conformsToProtocol(%swift.type* %arg_type, %swift.protocol* @"$sSeMp")
112+
// CHECK-NEXT: [[IS_NULL:%.*]] = icmp eq i8** [[ENCODABLE_WITNESS]], null
113+
// CHECK-NEXT: br i1 [[IS_NULL]], label %missing-witness, label [[CONT:%.*]]
114+
// CHECK: missing-witness:
115+
// CHECK-NEXT: call void @llvm.trap()
116+
// CHECK-NEXT: unreachable
117+
// CHECK: [[DECODABLE_WITNESS:%.*]] = call i8** @swift_conformsToProtocol(%swift.type* %arg_type, %swift.protocol* @"$sSEMp")
118+
// CHECK-NEXT: [[IS_NULL:%.*]] = icmp eq i8** [[DECODABLE_WITNESS]], null
119+
// CHECK-NEXT: br i1 [[IS_NULL]], label %missing-witness1, label [[CONT:%.*]]
120+
// CHECK: missing-witness1:
121+
// CHECK-NEXT: call void @llvm.trap()
122+
// CHECK-NEXT: unreachable
123+
// CHECK: call swiftcc void {{.*}}(%swift.opaque* noalias nocapture sret(%swift.opaque) [[ARG_0_RES_SLOT]], %swift.type* %arg_type, i8** [[ENCODABLE_WITNESS]], i8** [[DECODABLE_WITNESS]], %T27FakeDistributedActorSystems0A17InvocationDecoderC* swiftself %1, %swift.error** noalias nocapture dereferenceable(4) %swifterror)
112124

113125
// CHECK: store %swift.error* null, %swift.error** %swifterror
114126
// CHECK-NEXT: [[ARG_0_VAL_ADDR:%.*]] = bitcast i8* [[ARG_0_VALUE_BUF]] to %TSi*
@@ -163,10 +175,10 @@ public distributed actor MyOtherActor {
163175

164176
/// Initialize the result buffer with values produced by the thunk
165177

166-
// CHECK: %._guts1 = getelementptr inbounds %TSS, %TSS* [[COERCED_RESULT_SLOT]], i32 0, i32 0
167-
// CHECK: store i32 {{.*}}, i32* %._guts1._object._count._value
168-
// CHECK: store i8 {{.*}}, i8* %._guts1._object._discriminator._value
169-
// CHECK: store i16 {{.*}}, i16* %._guts1._object._flags._value, align 2
178+
// CHECK: %._guts2 = getelementptr inbounds %TSS, %TSS* [[COERCED_RESULT_SLOT]], i32 0, i32 0
179+
// CHECK: store i32 {{.*}}, i32* %._guts2._object._count._value
180+
// CHECK: store i8 {{.*}}, i8* %._guts2._object._discriminator._value
181+
// CHECK: store i16 {{.*}}, i16* %._guts2._object._flags._value, align 2
170182

171183
// CHECK: {{.*}} = call i1 (i8*, i1, ...) @llvm.coro.end.async({{.*}}, %swift.context* {{.*}}, %swift.error* {{.*}})
172184

@@ -195,10 +207,10 @@ public distributed actor MyOtherActor {
195207
// CHECK-NEXT: [[THUNK_ASYNC_CONTEXT:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[CONTEXT_SIZE]])
196208

197209
// CHECK: [[TMP_STR_ARG:%.*]] = bitcast { i32, i32, i32 }* %temp-coercion.coerced to %TSS*
198-
// CHECK-NEXT: %._guts1 = getelementptr inbounds %TSS, %TSS* [[TMP_STR_ARG]], i32 0, i32 0
210+
// CHECK-NEXT: %._guts2 = getelementptr inbounds %TSS, %TSS* [[TMP_STR_ARG]], i32 0, i32 0
199211

200-
// CHECK: store i32 {{.*}}, i32* %._guts1._object._count._value
201-
// CHECK: [[VARIANT:%.*]] = bitcast %Ts13_StringObjectV7VariantO* %._guts1._object._variant to i32*
212+
// CHECK: store i32 {{.*}}, i32* %._guts2._object._count._value
213+
// CHECK: [[VARIANT:%.*]] = bitcast %Ts13_StringObjectV7VariantO* %._guts2._object._variant to i32*
202214
// CHECK-NEXT: store i32 {{.*}}, i32* [[VARIANT]]
203215

204216
// CHECK: [[STR_ARG_SIZE_PTR:%.*]] = getelementptr inbounds { i32, i32, i32 }, { i32, i32, i32 }* %temp-coercion.coerced, i32 0, i32 0

test/Distributed/distributed_actor_accessor_thunks_64bit.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,19 @@ public distributed actor MyOtherActor {
108108
// CHECK-NEXT: [[ARG_0_SIZE:%.*]] = and i64 [[ARG_0_SIZE_ADJ]], -16
109109
// CHECK-NEXT: [[ARG_0_VALUE_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i64 [[ARG_0_SIZE]])
110110
// CHECK-NEXT: [[ARG_0_RES_SLOT:%.*]] = bitcast i8* [[ARG_0_VALUE_BUF]] to %swift.opaque*
111-
// CHECK-NEXT: call swiftcc void {{.*}}(%swift.opaque* noalias nocapture sret(%swift.opaque) [[ARG_0_RES_SLOT]], %swift.type* %arg_type, %T27FakeDistributedActorSystems0A17InvocationDecoderC* swiftself %1, %swift.error** noalias nocapture swifterror dereferenceable(8) %swifterror)
111+
// CHECK-NEXT: [[ENCODABLE_WITNESS:%.*]] = call i8** @swift_conformsToProtocol(%swift.type* %arg_type, %swift.protocol* @"$sSeMp")
112+
// CHECK-NEXT: [[IS_NULL:%.*]] = icmp eq i8** [[ENCODABLE_WITNESS]], null
113+
// CHECK-NEXT: br i1 [[IS_NULL]], label %missing-witness, label [[CONT:%.*]]
114+
// CHECK: missing-witness:
115+
// CHECK-NEXT: call void @llvm.trap()
116+
// CHECK-NEXT: unreachable
117+
// CHECK: [[DECODABLE_WITNESS:%.*]] = call i8** @swift_conformsToProtocol(%swift.type* %arg_type, %swift.protocol* @"$sSEMp")
118+
// CHECK-NEXT: [[IS_NULL:%.*]] = icmp eq i8** [[DECODABLE_WITNESS]], null
119+
// CHECK-NEXT: br i1 [[IS_NULL]], label %missing-witness1, label [[CONT:%.*]]
120+
// CHECK: missing-witness1:
121+
// CHECK-NEXT: call void @llvm.trap()
122+
// CHECK-NEXT: unreachable
123+
// CHECK: call swiftcc void {{.*}}(%swift.opaque* noalias nocapture sret(%swift.opaque) [[ARG_0_RES_SLOT]], %swift.type* %arg_type, i8** [[ENCODABLE_WITNESS]], i8** [[DECODABLE_WITNESS]], %T27FakeDistributedActorSystems0A17InvocationDecoderC* swiftself %1, %swift.error** noalias nocapture swifterror dereferenceable(8) %swifterror)
112124

113125
// CHECK: store %swift.error* null, %swift.error** %swifterror
114126
// CHECK-NEXT: [[ARG_0_VAL_ADDR:%.*]] = bitcast i8* [[ARG_0_VALUE_BUF]] to %TSi*

test/Distributed/distributed_actor_system_missing_adhoc_requirement_impls.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
6666
typealias SerializationRequirement = Codable
6767

6868
func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
69-
func decodeNextArgument<Argument>() throws -> Argument { fatalError() }
69+
func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
7070
func decodeReturnType() throws -> Any.Type? { nil }
7171
func decodeErrorType() throws -> Any.Type? { nil }
7272
}

0 commit comments

Comments
 (0)