Files
swift-mirror/test/Generics/concrete_contraction_existential.swift
Slava Pestov d8e418a0f9 AST: Fix crash when type parameter is substituted with an existential
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.
2025-06-02 19:17:21 -04:00

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