Skip to content

Commit bfee080

Browse files
committed
Add workaround for double-call to macro extension method call
1 parent c6caad4 commit bfee080

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Macros/Sources/ObservationMacros/ObservableMacro.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ extension ObservableMacro: ExtensionMacro {
275275
conformingTo protocols: [TypeSyntax],
276276
in context: some MacroExpansionContext
277277
) throws -> [ExtensionDeclSyntax] {
278-
if protocols.isEmpty {
278+
// This method can be called twice - first with an empty `protocols` when
279+
// no conformance is needed, and second with a `MissingTypeSyntax` instance.
280+
if protocols.isEmpty || protocols.first!.is(MissingTypeSyntax.self) {
279281
return []
280282
}
281283

0 commit comments

Comments
 (0)