Files
swift-mirror/test/Constraints/sr10595.swift
Slava Pestov d80b554866 AST: Fix crash when calling subst() on types involving member types of UnresolvedType
UnresolvedType needs to go away, but for now, don't crash.

Fixes <rdar://problem/50370326>, <https://bugs.swift.org/browse/SR-10595>.
2019-05-17 23:09:15 -04:00

21 lines
660 B
Swift

// RUN: %target-swift-frontend -typecheck -verify %s
protocol Nested {
associatedtype U // expected-note {{protocol requires nested type 'U'; do you want to add it?}}
}
class A<M> {
func f<T : Nested>(_ t: T, _ keyPath: WritableKeyPath<M, T.U>) {}
}
class B<Y> : Nested { // expected-error {{type 'B<Y>' does not conform to protocol 'Nested'}}
var i: Y?
}
class C<M> {
func cFunc(_ a: A<M>) {
let function: (B<Int>, ReferenceWritableKeyPath<M, Int>) -> Void = a.f // expected-error {{cannot convert value of type '(_, WritableKeyPath<M, _.U>) -> ()' to specified type '(B<Int>, ReferenceWritableKeyPath<M, Int>) -> Void'}}
}
}