Files
swift-mirror/test/ModuleInterface/sil-opt-availability.swift
Allan Shortlidge d8be24b395 Sema: Fix -disable-availability-checking.
Suppression of diagnostics about use of unavailable declarations in
equivalently unavailable contexts now relies on querying the
`TypeRefinementContext` hierarchy. Generation of the TypeRefinementContext tree
was suppressed when `-disable-availability-checking` was specified, though,
causing some unavailability diagnostics to be emitted when they ought to be
suppressed.

Instead of refusing to generate a `TypeRefinementContext` hierarchy, instead
just avoid populating nodes for `if #available` checks for OS versions since
these checks are meant to have no effect when `-disable-availability-checking`
is specified.

Resolves rdar://138987918.
2024-11-06 17:20:31 -08:00

14 lines
609 B
Swift

// RUN: %target-swift-frontend -emit-module %s -enable-library-evolution -swift-version 5 -module-name Library -emit-module-interface-path %t/Library.swiftinterface -o %t/Library.swiftmodule
// RUN: echo "import Library" > %t/Client.swift
// RUN: %target-swift-frontend -emit-module %t/Client.swift -module-name Client -o %t/Client.swiftmodule -I %t
// RUN: rm %t/Library.swiftmodule
// RUN: %target-sil-opt -enable-sil-verify-all %t/Client.swiftmodule -module-name Client
@available(*, unavailable)
public struct Unavailable {}
@available(*, unavailable)
public func usesUnavailable(_ u: Unavailable) {}