Skip to content

[SR-11997] Compiler creates warning 'Redundant conformance constraint' for constraint that is necessary and removes this constraint from code in compilation. This causes wrong compilation errors. #54431

@swift-ci

Description

@swift-ci
Previous ID SR-11997
Radar rdar://problem/58455439
Original Reporter vzakh (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Xcode 11.3 (11C29), Swift 5

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

md5: 83907b1c17778ddab16f3d29a9926153

Issue Description:

Pulling the code in from SO:

protocol Autumn {
  associatedtype WarmUp: Spring
    where WarmUp.CoolDown == Self
}

protocol Spring {
  associatedtype CoolDown: Autumn
    where CoolDown.WarmUp == Self
}

protocol Winter: Autumn where WarmUp: Summer { //warning: Redundant conformance constraint 'Self': 'Autumn'
}

protocol Summer: Spring where CoolDown: Winter {
  associatedtype Bike: Harley
    where Bike.Season == Self
}

protocol Harley {
  associatedtype Season: Summer
    where Season.Bike == Self
}

The redundant constraint is implied by itself according to its own note:

> Conformance constraint 'Self': 'Autumn' implied here.

We shouldn't be emitting this diagnostic at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions