Skip to content

[SR-12736] cannot add constraint 'Self.Model.Float32Components == Self.Model.Float32Components.Model.Float32Components' on 'Self' #55182

@SusanDoggie

Description

@SusanDoggie
Previous ID SR-12736
Radar rdar://problem/62894047
Original Reporter @SusanDoggie
Type Bug
Status Resolved
Resolution Done
Environment

swift 5.1
swift 5.2.3
Xcode 11.4.1

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

md5: 81036c9f59b1c54443089757184cc9ce

Issue Description:

The following code will produce a compilation error, but it should not happen.

public protocol ColorModel {
    
    associatedtype Float32Components: ColorComponents where Float32Components.Model == Self, Float32Components.Scalar == Float
    
    init<T: ColorComponents>(_ components: T) where T.Model == Self
    
    var float32Components: Float32Components { get set }
}

public protocol ColorComponents {
    
    associatedtype Model: ColorModel
    
    associatedtype Scalar
    
}

public protocol ColorPixel {
    
    associatedtype Model: ColorModel
    
    init(color: Model, opacity: Double)
    
    init<C: ColorPixel>(_ color: C) where C.Model == Model
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselftype checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions