Skip to content

[SR-9501] Subclass existential with predefined associated type witness should be supported as existential #51955

@AnthonyLatsis

Description

@AnthonyLatsis
Previous ID SR-9501
Radar None
Original Reporter @AnthonyLatsis
Type Bug
Status Resolved
Resolution Duplicate
Environment

Xcode 10.1 (10B61) & master

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 075e0f26634a1fe1f91a9305b41c2dac

duplicates:

Issue Description:

This is a variation of SR-4758 that I believe should be faced separately. Here, the associated type is known to be concrete through a type alias in the class component of a subclass existential (rather than through where clauses on protocol declarations that directly constraint an assoc. type).

class Class {
  typealias Assoc = Int
}
protocol Proto {
    associatedtype Assoc
}

func foo(arg: Class & Proto) {} // protocol 'Proto' can only be used as a generic constraint because it has Self or associated type requirements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compilerThe Swift compiler itselfexistentialsFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuestype checkerArea → compiler: Semantic analysistypesFeature: types

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions