Skip to content

[SR-7315] Decodable conformance of classes in different files yields bogus "Class ... has no initializers" error #49863

@hamishknight

Description

@hamishknight
Previous ID SR-7315
Radar rdar://problem/39102390
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Done
Environment

Swift version 4.2-dev (LLVM 95345677bd, Clang daefc772c1, Swift 76c264e)
Target: x86_64-apple-darwin17.4.0

Additional Detail from JIRA
Votes 18
Component/s Compiler
Labels Bug, Codable
Assignee @slavapestov
Priority Medium

md5: 041c433776ada41d9784d150b3a3cc07

Issue Description:

The following Swift files fail to compile:

class C1 : Decodable { // error: Class 'C1' has no initializers
  let str: String
}
class C : Decodable {
  let c1: C1
}

But they really should as we should be synthesising an init(from:) for C1. Note that the above example does compile with whole module optimisation enabled if the file a.swift comes before b.swift.

Metadata

Metadata

Assignees

Labels

CodableArea → standard library: `Codable` and co.bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions