Skip to content

@Table macro misbehaves on nested Types #172

@dirk68-work

Description

@dirk68-work

Description

The following

struct Outer{
    @Table struct Inner1:Identifiable{
        let id:Int
    }
    
    @Table struct Inner2:Identifiable{
        let id:Int
        let inner1ID:Inner1.ID
    }
}

results in an error: 'Inner1' in scope inside the macro expansion.

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • I have determined whether this bug is also reproducible in a vanilla GRDB project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

The Swift compiles has no problem with Inner1.ID but the macro does. You have to revert to Outer.Inner1.ID to make it work.
Unfortunately swifts error message is not very helpful.

Actual behavior

No response

Reproducing project

No response

SharingGRDB version information

No response

Sharing version information

No response

GRDB version information

No response

Destination operating system

No response

Xcode version information

No response

Swift Compiler version information

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions