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-7605] Overly-exuberant associatedtype deduction? #50147
Comments
Here's a reduction against github/master 63856d4: protocol P {
associatedtype A
var a: A { get }
}
extension P where A == Int {
var a: Int { return 0 }
}
struct X : P { } // Compiles? If this is working as intended, I think we made a mistake in the semantics of the generics system. It certainly doesn't match my mental model for how things are supposed to work. I would expect it if I had written extension P { typealias A = Int } (which incidentally doesn't compile). To put it in English, I expect |
I agree with Dave that we shouldn't default anything in order to match a conditional conformance. |
@swift-ci create |
This is related to SR-7610 |
I linked as related to SR-5440, because it seems so similar to eg the following (even though it's not involving protocols, only constrained extensions): This (invalid) program compiles successfully, because the compiler misinterprets the where clause:
|
Note that this isn't a conditional conformance. cc @DougGregor since it's an associated type inference thing. |
Additional Detail from JIRA
md5: 7a30a5414b3549776db0a34b5c14e882
relates to:
Issue Description:
It pains me to say it, but I think the code at https://github.com/dabrahams/WhitherSequence/blob/26ebb7d284c825b08b09b8cc6921d82600265ed5/Sequence.swift shouldn't actually compile, because there's nothing driving it to deduce the `Index` type of `Fibonacci`.
The text was updated successfully, but these errors were encountered: