Skip to content

Commit 4da5b64

Browse files
committed
[DistributedResolvableMacro] cannot use if expressions
1 parent 7189ade commit 4da5b64

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

lib/Macros/Sources/SwiftMacros/DistributedResolvableMacro.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,14 @@ extension DistributedResolvableMacro {
180180
// Don't duplicate the ActorSystem type parameter if it already was declared
181181
// on the protocol as a primary associated type;
182182
// otherwise, add it as first primary associated type.
183-
let actorSystemTypeParam: [String] =
184-
if primaryTypeParams.contains("ActorSystem") {
185-
[]
186-
} else if isGenericOverActorSystem {
187-
["ActorSystem"]
188-
} else {
189-
[]
190-
}
183+
let actorSystemTypeParam: [String]
184+
if primaryTypeParams.contains("ActorSystem") {
185+
actorSystemTypeParam = []
186+
} else if isGenericOverActorSystem {
187+
actorSystemTypeParam = ["ActorSystem"]
188+
} else {
189+
actorSystemTypeParam = []
190+
}
191191

192192
// Prepend the actor system type parameter, as we want it to be the first one
193193
primaryTypeParams = actorSystemTypeParam + primaryTypeParams
@@ -215,20 +215,20 @@ extension DistributedResolvableMacro {
215215
}
216216
}
217217

218-
let stubActorBody: String =
219-
if isGenericOverActorSystem {
220-
// there may be no `where` clause specifying an actor system,
221-
// but perhaps there is a typealias (or extension with a typealias),
222-
// specifying a concrete actor system so we let this synthesize
223-
// an empty `$Greeter` -- this may fail, or succeed depending on
224-
// surrounding code using a default distributed actor system,
225-
// or extensions providing it.
226-
""
227-
} else if let specificActorSystemRequirement {
228-
"\(typealiasActorSystem(access: accessModifiers, proto, specificActorSystemRequirement))"
229-
} else {
230-
""
231-
}
218+
let stubActorBody: String
219+
if isGenericOverActorSystem {
220+
// there may be no `where` clause specifying an actor system,
221+
// but perhaps there is a typealias (or extension with a typealias),
222+
// specifying a concrete actor system so we let this synthesize
223+
// an empty `$Greeter` -- this may fail, or succeed depending on
224+
// surrounding code using a default distributed actor system,
225+
// or extensions providing it.
226+
stubActorBody = ""
227+
} else if let specificActorSystemRequirement {
228+
stubActorBody = "\(typealiasActorSystem(access: accessModifiers, proto, specificActorSystemRequirement))"
229+
} else {
230+
stubActorBody = ""
231+
}
232232

233233
return [
234234
"""

0 commit comments

Comments
 (0)