Files
swift-mirror/userdocs/diagnostics/availability-unrecognized-name.md
Allan Shortlidge f5bae411ca AST: Diagnose unrecognized platforms as errors with CustomAvailability enabled.
When the CustomAvailability experimental feature is enabled, make it an error
to specify an unrecognized availability domain name. Also, add these
diagnostics to a diagnostic group so that developers can control their behavior
when they are warnings.

Resolves rdar://152741624.
2025-06-06 22:44:12 -07:00

765 B

Unrecognized availability platforms (AvailabilityUnrecognizedName)

Warnings that identify unrecognized platform names in @available attributes and if #available statements.

Overview

The AvailabilityUnrecognizedName group covers warnings emitted when the platform name specified in an availability related construct is unrecognized by the compiler:

@available(NotAValidPlatform, introduced: 1.0) // warning: unrecognized platform name 'NotAValidPlatform'
public func function() {
  if #available(NotAValidPlatform 2.0, *) { // warning: unrecognized platform name 'NotAValidPlatform'
    // ...
  }
}

Availability specifications with unrecognized platform names in @available attributes and #available queries are ignored by the compiler.