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-6265] Remove "redundant layout constraint" warning #48815
Comments
cc @DougGregor |
Comment by Matthew Rips (JIRA) On the off chance this regression is intended, I offer the following example in which the "redundancy" seems unavoidable. protocol A: class {} If this warning is to continue, then let's please revise the content of the message. Use of the term "layout constraint" is very confusing. Thank you! |
👍 |
Comment by Rob Nash (JIRA) Also note public protocol CardableScene: class where Self: UIViewController {
associatedtype Model: Equatable
var showsNavigationBar: Bool { get }
init(model: Model)
var model: Model { get }
}
public extension CardableScene {
var showsNavigationBar: Bool {
return navigationItem.title != nil
}
} At runtime (lldb) po scene.showsNavigationBar |
That has nothing to do with this issue; please file a separate bug. |
Does "layout constraint" mean something in the context of Swift? Or was this written by someone who has muscle memory from using Auto Layout? |
It does; it refers to how the value is laid out in memory. I'm not sure we really want to be using this term for |
"Layout" is a poor term to use here, because the layout aspects are compiler-centric, not user-focused. |
Comment by Ky (JIRA) I'm getting this without any redundancy at all: // A protocol where each instance is guaranteed to be a NSViewController
protocol Foo where Self : NSViewController {} |
Comment by Joseph Gentry (JIRA) If I remove the class descriptor to remove redundancy I will get a crash at runtime when calling the protocol method. |
Redundant requirement warnings are now disabled by default. |
Environment
Swift version 4.0.2 (swiftlang-900.0.69.1 clang-900.0.38)
Additional Detail from JIRA
md5: 6696c6112b38ed2330b27fc56449fc4b
relates to:
Issue Description:
This is basically the same as SR-5753.
This was my code (see Twitter conversation too):
Starting from Swift 4.0.2 (Xcode 9.1), I started getting this warning:
Which, for starters, is not user friendly at all. The `'Self' : 'AnyObject'` part is totally a Swift implementation detail. But most importantly, I don't think this warning carries its weight. In my case, I don't want to rely on A enforcing reference semantics. What if A drops that constraint? I want B to always have them.
So like I said in SR-5753, without a way to turn these warnings off either globally or for a particular declaration, I think they're more annoying than anything.
The text was updated successfully, but these errors were encountered: