mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
For the most part, the differences between the diagnostics introduced
by the C++ implementation and the new SwiftIfConfig implementation are
cosmetic, so these are only wording changes.
The one major difference is that we've dropped the warnings about
potential typos in os/arch checks. For example, if one writes:
#if os(bisionos)
// ...
#endif
The C++ implementation will produce a warning "unknown operating system
for build configuration 'os'" with a note asking "did you mean
'visionOS'"? These warnings rely on a static list of known operating
systems and architectures, which is somewhat unfortunate: the whole
point of these checks is that the Swift you're dealing with might not
have support for those operating systems/architectures, so while these
warnings can be helpful in a few cases, they also cause false
positives when porting. Therefore, I chose not to bring them forward.
46 lines
871 B
Swift
46 lines
871 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:5 {{single unlabeled argument for the attribute}}
|
|
#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
|