Files
swift-mirror/test/ClangImporter/availability_spi_as_unavailable.swift
Henrik G. Olsson cbc0ec3b88 Add -verify-ignore-unrelated where necessary (NFC)
These are tests that fail in the next commit without this flag. This
does not add -verify-ignore-unrelated to all tests with -verify, only
the ones that would fail without it. This is NFC since this flag is
currently a no-op.
2025-10-04 14:19:52 -07:00

31 lines
1.4 KiB
Swift

// REQUIRES: OS=macosx
// RUN: %target-swift-frontend -typecheck %s -F %S/Inputs/frameworks -verify -verify-ignore-unrelated -DNOT_UNDERLYING -library-level api -parse-as-library -require-explicit-availability=ignore
// RUN: %target-swift-frontend -typecheck %s -F %S/Inputs/frameworks -module-name SPIContainer -import-underlying-module -verify -verify-ignore-unrelated -library-level api -parse-as-library -require-explicit-availability=ignore
#if NOT_UNDERLYING
import SPIContainer
#endif
@_spi(a) public let a: SPIInterface1 = .init()
@_spi(a) public let b: SPIInterface2 = .init()
public let c: SPIInterface1 = .init() // expected-error{{cannot use class 'SPIInterface1' here; it is an SPI imported from 'SPIContainer'}}
public let d: SPIInterface2 = .init() // expected-error{{cannot use class 'SPIInterface2' here; it is an SPI imported from 'SPIContainer'}}
@inlinable
public func inlinableUsingSPI() {
SharedInterface.foo() // expected-error{{class method 'foo()' cannot be used in an '@inlinable' function because it is an SPI imported from 'SPIContainer'}}
}
@available(macOS, unavailable)
public let e: SPIInterface2 = .init()
@available(iOS, unavailable)
public let f: SPIInterface2 = .init() // expected-error{{cannot use class 'SPIInterface2' here; it is an SPI imported from 'SPIContainer'}}
@inlinable
@available(macOS, unavailable)
public func inlinableUnavailableUsingSPI() {
SharedInterface.foo()
}