mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This commit compares the attributes on the decl inside the `@abi` attribute to those in the decl it’s attached to, diagnosing ABI-incompatible differences. It also rejects many attributes that don’t need to be specified in the `@abi` attribute, such as ObjC-ness, access control, or ABI-neutral traits like `@discardableResult`, so developers know to remove them.
19 lines
550 B
Swift
19 lines
550 B
Swift
// RUN: %target-typecheck-verify-swift -enable-experimental-feature ABIAttribute
|
|
|
|
// UNSUPPORTED: OS=windows-msvc
|
|
// REQUIRES: swift_feature_ABIAttribute
|
|
|
|
@_weakLinked public func f() { }
|
|
|
|
// @_weakLinked -- banned in @abi
|
|
struct WeakLinked {
|
|
@abi(@_weakLinked func fn1()) // expected-error {{unused '_weakLinked' attribute in '@abi'}} {{8-20=}}
|
|
@_weakLinked func fn1() {}
|
|
|
|
@abi(@_weakLinked func fn2()) // expected-error {{unused '_weakLinked' attribute in '@abi'}} {{8-20=}}
|
|
func fn2() {}
|
|
|
|
@abi(func fn3())
|
|
@_weakLinked func fn3() {}
|
|
}
|