Files
swift-mirror/test/Generics/inverse_extensions.swift
Kavon Farvardin fe50668d0e SuppAssocTypes: add deprecation warning of legacy version
We need to start moving people over to using the version of
suppressed associated types that has the officially accepted
behavior according to SE-503, and that is via
`SuppressedAssociatedTypesWithDefaults`.

To allow for time to migrate to the new version, I'm introducing
the deprecation message as a warning for now.

This set of changes also moves most of the test suite over to using
the officially accepted version.

rdar://172231663
2026-03-10 17:08:10 -07:00

23 lines
876 B
Swift

// RUN: %target-typecheck-verify-swift \
// RUN: -enable-experimental-feature SuppressedAssociatedTypesWithDefaults
// REQUIRES: swift_feature_SuppressedAssociatedTypesWithDefaults
struct Turtle<T> {}
extension Turtle where T: ~Copyable {} // expected-error {{'T' required to be 'Copyable' but is marked with '~Copyable'}}
struct Rabbit<T> where T: ~Copyable {}
extension Rabbit where T: ~Escapable {} // expected-error {{'T' required to be 'Escapable' but is marked with '~Escapable'}}
protocol P {}
extension P where Self: ~Escapable {} // expected-error {{'Self' required to be 'Escapable' but is marked with '~Escapable'}}
protocol HasAssoc {
associatedtype A
}
extension HasAssoc where Self.A: ~Copyable {}
// expected-error@-1 {{'Self.A' required to be 'Copyable' but is marked with '~Copyable'}}
class Box<T: ~Copyable> {}
extension Box where T: ~Copyable {}