Files
swift-mirror/test/attr/has_attribute.swift
Allan Shortlidge ed77b8ff32 AST: #if hasAttribute(retroactive) should evaluate true.
The implementation of `#if hasAttribute(...)` only accepted declaration
attributes. It should also accept type attributes, like `@retroactive`.

Resolves rdar://125195051
2024-03-25 14:03:00 -07:00

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