Skip to content

[SR-9260] Allow protocol types with fully specified associated types in all type positions (function arguments etc.) #51737

@swift-ci

Description

@swift-ci
Previous ID SR-9260
Radar rdar://problem/56835024
Original Reporter schwarja (JIRA User)
Type New Feature
Status Resolved
Resolution Duplicate
Environment

Xcode Version 10.1 (10B61)

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

md5: 6965b9b1f82b44fc4710d6389a544fac

duplicates:

Issue Description:

I created a following snippet:

protocol ViewModel {
    associatedtype Input
    associatedtype Output
    func transform(input: Input) -> Output
}
protocol Injectable {
    associatedtype VM
    var viewModel: VM? { get set }
}
struct RootInput {}
struct RootOutput {}
protocol RootViewModelProtocol: ViewModel where Input == RootInput, Output == RootOutput {}
 
class RootVC: Injectable {
    var viewModel: RootViewModelProtocol?
}

Observed: The snippet is not compiled. An error is detected on this line:

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