Skip to content

[SR-5122] Codable conformance compilation error with required initializers #3849

@hartbit

Description

@hartbit
Previous ID SR-5122
Radar rdar://problem/32774777
Original Reporter @hartbit
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 4
Component/s Compiler, Foundation
Labels Bug
Assignee @itaiferber
Priority Medium

md5: c57b8fae77dfef6e627bfb9f5eb19530

relates to:

  • SR-6875 Codable codegen blocked by subclass with designated initializer

Issue Description:

The following piece of code results in a compilation error, most probably in the code generated by the Codable conformance. This seems to happen when the super class has a required initializer:

class Foo {
    var a: Int

    init() {
        self.a = 0
    }

    required init(a: Int) {
        self.a = a
    }
}

class Bar: Foo, Codable {
    var b: Int

    required init(a: Int) {
        b = 0
        super.init(a: a)
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions