Skip to content

Codable requires a redundant constraint for nested generic types #63718

@JessyCatterwaul

Description

@JessyCatterwaul

This compiles:

enum Namespace<Outer> {
  struct Struct<Inner> where Outer == WhatThisIsDoesNotMatter {
    public var property: Inner
  }
}

typealias WhatThisIsDoesNotMatter = Never

extension Namespace<WhatThisIsDoesNotMatter>.Struct: Encodable where Inner: Encodable { }

Remove the redundant constraint, however, and it does not:

extension Namespace.Struct: Encodable where Inner: Encodable {}

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 itselfconformancesFeature → protocol: protocol conformancesderived conformancesFeature → protocol → conformances: derived conformances aka synthesized conformancesextensionFeature → declarations: `extension` declarationsgenericsFeature: generic declarations and typesnested typesFeature: nested typesswift 5.7type checkerArea → compiler: Semantic analysisunexpected errorBug: Unexpected error

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions