Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0161-issue-49119.swift
Slava Pestov e7d7f6f69f RequirementMachine: Add Copyable/Escapable requirements to 'placeholder' generic signatures
If we fail to build a generic signature (or requirement signature of a
protocol) because of a request cycle or because Knuth-Bendix completion
failed, we would create a placeholder signature with no requirements.

However in a move-only world, a completely unconstrained generic
parameter might generate spurious diagnostics when used in a copyable
way. For this reason, let's outfit these placeholder signatures with
a default set of conformance requirements to Copyable and Escapable.
2024-02-20 18:26:05 -05:00

18 lines
711 B
Swift

// RUN: %target-typecheck-verify-swift
// https://github.com/apple/swift/issues/49119
protocol P {
associatedtype A: P // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
struct Type<Param> {}
extension Type: P where Param: P, Param.A == Type<Param> {
// expected-error@-1 {{extension of generic struct 'Type' has self-referential generic requirements}}
// expected-note@-2 {{through reference here}}
// expected-error@-3 {{type 'Type<Param>' does not conform to protocol 'P'}}
typealias A = Param
// expected-note@-1 2{{through reference here}}
// expected-note@-2 {{possibly intended match 'Type<Param>.A' (aka 'Param') does not conform to 'P'}}
}