mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
If something that we are trying to contextually bind is a nested type inside protocol or protocol extension, let's try to find the innermost conforming type from the current declaration context and map Self parameter of the protocol to that nominal type. Since nested types in protocols aren't yet implemented this is going to result in failure, but that's better than crashing. Resolves: rdar://problem/36449760
42 lines
533 B
Swift
42 lines
533 B
Swift
// RUN: not %target-swift-frontend %s -typecheck
|
|
|
|
protocol A {
|
|
var question: String { get }
|
|
|
|
struct B {
|
|
var answer: Int = 42
|
|
|
|
func foo(a: A) {
|
|
_ = a.question
|
|
}
|
|
}
|
|
}
|
|
|
|
class C : A {
|
|
var question: String = "ultimate question"
|
|
|
|
func foo() -> B {}
|
|
func bar() -> A.B {}
|
|
func baz(b: B) {
|
|
_ = b.answer
|
|
}
|
|
}
|
|
|
|
class D : A {
|
|
var question: String = ""
|
|
|
|
struct E {
|
|
func baz(b: B) {
|
|
_ = b.answer
|
|
}
|
|
}
|
|
}
|
|
|
|
class F<T> : A {
|
|
var question: String = ""
|
|
|
|
func foo(b: B) {
|
|
_ = b.answer
|
|
}
|
|
}
|