mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
getContextSubstitutionMap() didn't handle the case where getAnyNominal() returns a ProtocolDecl. This should not take the "fast path", which is only suitable for concrete nominals. This manifested as a crash-on-invalid -- the user probably meant to write "T.Value: Collection" rather than "T.Value == Collection". Fixes rdar://151479861.
14 lines
332 B
Swift
14 lines
332 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
protocol P1 {
|
|
associatedtype Value
|
|
}
|
|
|
|
protocol P2 {
|
|
typealias A = Int
|
|
}
|
|
|
|
struct G<T: P1> where T.Value == any Collection, T.Value.Element: P2 {}
|
|
// expected-error@-1 {{cannot access associated type 'Element' from 'any Collection'; use a concrete type or generic parameter base instead}}
|
|
|