mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The implementation of `#if hasAttribute(...)` only accepted declaration attributes. It should also accept type attributes, like `@retroactive`. Resolves rdar://125195051
46 lines
892 B
Swift
46 lines
892 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
#if !hasAttribute(dynamicCallable)
|
|
BOOM
|
|
#endif
|
|
|
|
#if hasAttribute(fortran)
|
|
BOOM
|
|
#endif
|
|
|
|
#if hasAttribute(cobol)
|
|
this is unparsed junk // expected-error{{consecutive statements on a line must be separated by}}
|
|
#endif
|
|
|
|
#if hasAttribute(optional)
|
|
ModifiersAreNotAttributes
|
|
#endif
|
|
|
|
#if hasAttribute(__raw_doc_comment)
|
|
UserInaccessibleAreNotAttributes
|
|
#endif
|
|
|
|
#if hasAttribute(17)
|
|
// expected-error@-1:18 {{unexpected platform condition argument: expected attribute name}}
|
|
#endif
|
|
|
|
#if !hasAttribute(escaping)
|
|
#error("type attributes are valid")
|
|
#endif
|
|
|
|
#if !hasAttribute(convention)
|
|
#error("type attributes are valid")
|
|
#endif
|
|
|
|
#if !hasAttribute(retroactive)
|
|
#error("type attributes are valid")
|
|
#endif
|
|
|
|
#if hasAttribute(in_guaranteed)
|
|
#error("SIL type attributes are invalid")
|
|
#endif
|
|
|
|
#if hasAttribute(opened)
|
|
#error("SIL type attributes are invalid")
|
|
#endif
|