Skip to content

Compiler error when using @PolymorphicEnumCodable macro on enums defined inside nested types #19

@victorhenrion

Description

@victorhenrion

Similar to #15, you can't use @PolymorphicEnumCodable inside a nested type: it generates an incorrect extension.

Reproduction:

import Foundation
import KarrotCodableKit

enum SomeEnum {
    @PolymorphicEnumCodable(identifierCodingKey: "type")
    enum ViewItem {
        case image(ImageViewItem)
        case text(TextViewItem)
    }
    
    @PolymorphicCodable(identifier: "IMAGE_VIEW_ITEM")
    struct ImageViewItem {
        let id: String
        let imageURL: URL
    }
    
    @PolymorphicCodable(identifier: "TEXT_VIEW_ITEM")
    struct TextViewItem {
        let id: String
        let title: String
        let description: String
    }
}
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions