Files
swift-mirror/test/attr/attr_weaklinked.swift
Becca Royal-Gordon 132f49108d Check attributes in @abi attr
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.
2025-03-26 10:47:57 -07:00

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() {}
}