Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-13898] "redundant conformance constraint" warning shows up (again?) #56296

Closed
ffried opened this issue Nov 25, 2020 · 5 comments
Closed

[SR-13898] "redundant conformance constraint" warning shows up (again?) #56296

ffried opened this issue Nov 25, 2020 · 5 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis

Comments

@ffried
Copy link
Contributor

ffried commented Nov 25, 2020

Previous ID SR-13898
Radar rdar://problem/71914018
Original Reporter @ffried
Type Bug
Environment

Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)
Target: x86_64-apple-darwin20.1.0

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

md5: c4edde1e87bd6db408682d93071bb508

relates to:

  • SR-5753 Remove "redundant same-type constraints" warnings

Issue Description:

I'm not 100% sure, but I think this should have been removed by resolving SR-5753.

The following code triggers a warning on associcatedtype Y: P0 which can be inferred by the Z.X == Y requirement on associatedtype Z: P1 just beneath. While this is technically true, the warnings is not of much help, because it's hard to see this requirement of Y: P0, especially if P0 and P1 are defined in completely different modules.

protocol P0 {}

protocol P1 {
   associatedtype X: P0
}

protocol P2 {
   associatedtype Y: P0
   associatedtype Z: P1 where Z.X == Y
}

Output:

TooMuchWarning.swift:8:22: warning: redundant conformance constraint 'Self.Y': 'P0'
   associatedtype Y: P0
                     ^
TooMuchWarning.swift:9:22: note: conformance constraint 'Self.Y': 'P0' implied here
   associatedtype Z: P1 where Z.X == Y
                     ^
@swift-ci
Copy link
Collaborator

Comment by Danila Shikulin (JIRA)

Is there a workaround?

@ffried
Copy link
Contributor Author

ffried commented Nov 25, 2020

Yes and no.
To remove the warning, you can simply remove the : P0 requirement. But that’s not really solving the issue that then the requirement is no longer visible and hidden behind a same type requirement.
Otherwise you could ignore the warning, but that’s not really ideal either. And won’t work if you treat warnings as errors.

@typesanitizer
Copy link

@swift-ci create

@swift-ci
Copy link
Collaborator

swift-ci commented Jan 5, 2022

Comment by Galen Rhodes (JIRA)

Even if we could get an option or flag to turn this off. That would be nice.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@slavapestov
Copy link
Member

Redundant requirement warnings are now disabled by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants