diff --git a/Sources/DependenciesMacroPlugin/DependenciesMacro.swift b/Sources/DependenciesMacroPlugin/DependenciesMacro.swift index ec4ee9f..799530b 100644 --- a/Sources/DependenciesMacroPlugin/DependenciesMacro.swift +++ b/Sources/DependenciesMacroPlugin/DependenciesMacro.swift @@ -14,7 +14,9 @@ extension DependenciesMacro: ExtensionMacro { ) throws -> [ExtensionDeclSyntax] { let structDecl = try decodeExpansion(of: node, attachedTo: declaration, in: context) let storedPropertyBindings = structDecl.memberBlock.members - .compactMap { $0.decl.as(VariableDeclSyntax.self)?.bindings } + .compactMap { $0.decl.as(VariableDeclSyntax.self) } + .filter { !$0.modifiers.contains { $0.as(DeclModifierSyntax.self)?.name.text == "static" } } + .map(\.bindings) .flatMap { $0 } .filter { $0.accessorBlock == nil } let modifier = declaration.modifiers diff --git a/Tests/DependenciesMacroTests/DependenciesMacroTests.swift b/Tests/DependenciesMacroTests/DependenciesMacroTests.swift index 6637b54..b1bba72 100644 --- a/Tests/DependenciesMacroTests/DependenciesMacroTests.swift +++ b/Tests/DependenciesMacroTests/DependenciesMacroTests.swift @@ -59,6 +59,7 @@ final class DependenciesMacroTests: XCTestCase { """ @Dependencies public struct TestClient { + static let staticValue = 0 let a: String let b: () -> Void let c: @Sendable () -> Void @@ -73,6 +74,7 @@ final class DependenciesMacroTests: XCTestCase { } matches: { #""" public struct TestClient { + static let staticValue = 0 let a: String let b: () -> Void let c: @Sendable () -> Void