mirror of
https://github.com/apple/swift.git
synced 2026-10-02 10:58:03 +02:00
The suppression can help us avoid a typechecking condfail, though the mangled names of any symbols will be wrong as we simply omit the attribute in this simplistic suppression strategy. related to rdar://176395527
19 lines
1.2 KiB
Swift
19 lines
1.2 KiB
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// The bare @_preInverseGenerics does NOT require the experimental feature.
|
|
@_preInverseGenerics
|
|
func bare<T: ~Copyable>(_ t: borrowing T) {}
|
|
|
|
// The 'except:' form DOES require the experimental feature.
|
|
@_preInverseGenerics(except: ~Copyable) // expected-error {{'@_preInverseGenerics' is an experimental feature; use '-enable-experimental-feature PreInverseGenericsExcept'}}
|
|
func exceptCopyable<T: ~Copyable & ~Escapable>(_ t: borrowing T) {}
|
|
|
|
// An invalid attribute with 'except:' still DOES require the feature.
|
|
@_preInverseGenerics(except: Int) // expected-error {{'@_preInverseGenerics' is an experimental feature; use '-enable-experimental-feature PreInverseGenericsExcept'}}
|
|
// expected-error@-1 {{'except' argument to '@_preInverseGenerics' must consist only of inverse constraints such as '~Copyable' or '~Escapable'}}
|
|
func exceptInt<T: ~Copyable & ~Escapable>(_ t: borrowing T) {}
|
|
|
|
// The shorthand alias also requires the experimental feature.
|
|
@_preInverseGenericsExceptCopyable // expected-error {{'@_preInverseGenerics' is an experimental feature; use '-enable-experimental-feature PreInverseGenericsExcept'}}
|
|
func exceptCopyableShorthand<T: ~Copyable & ~Escapable>(_ t: borrowing T) {}
|