We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When defining a new type within a structure, the macro throws an error 'Circular reference resolving attached macro 'xxx'
@entity // ERROR: Circular reference resolving attached macro 'entity' struct NewDBTest { // ERROR: Circular reference let a: String } extension NewDBTest { struct Test { } } extension NewDBTest.Test { // ERROR: 'Test' is not a member type of struct 'IcarusClient.NewDBTest' }
@entity is a member macro of a generating constructor
public struct EntityMacro: MemberMacro { public static func expansion( of node: AttributeSyntax, providingMembersOf declaration: some DeclGroupSyntax, in context: some MacroExpansionContext ) throws -> [DeclSyntax] { guard let declaration = declaration.as(StructDeclSyntax.self) else { throw IcarusTrackerError.invalidInputType } let arguments = declaration.storedProperties() .filter { !$0.isStatic && !$0.isConstant } .compactMap { property -> (name: String, type: TypeSyntax)? in guard let name = property.name, let type = property.type else { return nil } return (name, type) } let initDecl = try InitializerDeclSyntax("public init(\(raw: arguments.map { "\($0.name): \($0.type)" }.joined(separator: ", ")))") { for argument in arguments { ExprSyntax(stringLiteral: "self.\(argument.name) = \(argument.name)") } } return [ DeclSyntax(initDecl) ] } }
No response
The text was updated successfully, but these errors were encountered:
This error occurs only when writing extensions for this new type
Sorry, something went wrong.
Tracked in Apple’s issue tracker as rdar://118929243
Related: #66450
This is fixed by #71365
No branches or pull requests
Description
When defining a new type within a structure, the macro throws an error 'Circular reference resolving attached macro 'xxx'
@entity is a member macro of a generating constructor
Steps to Reproduce
No response
The text was updated successfully, but these errors were encountered: