Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0138-rdar36449760.swift
Pavel Yaskevich a11263b156 [ConstraintSystem] Bind Self to correct contextual type for nested types in protocol
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
2018-01-24 18:21:26 -08:00

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
}
}