mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
These tests identified a gap in type checking the exportability of case statements. Unfortunately this gap is not simple to close, since exportability is usually checked during availability checking but availability checking isn't appropriate for case statements and there isn't existing infrastructure to check exportability independently.
45 lines
1008 B
Swift
45 lines
1008 B
Swift
/// Check that SPI declarations can be exported from an SPI module.
|
|
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %target-typecheck-verify-swift -I %t -verify-ignore-unknown -enable-library-evolution -swift-version 5 -library-level spi
|
|
|
|
@_spi(S) public func spiFunc() {}
|
|
@_spi(S) public class SPIClass {
|
|
public init() {}
|
|
}
|
|
@_spi(S) public class SPIStruct {
|
|
public init() {}
|
|
}
|
|
@_spi(S) public protocol SPIProtocol {}
|
|
public enum PublicEnum {
|
|
case publicCase
|
|
@_spi(S) case spiCase
|
|
}
|
|
|
|
public func useOfSPITypeOk(_ p0: SPIProtocol, p1: SPIClass) -> SPIClass { fatalError() }
|
|
|
|
@inlinable
|
|
public func inlinable() -> SPIClass {
|
|
spiFunc()
|
|
_ = SPIClass()
|
|
}
|
|
|
|
@inlinable
|
|
public func inlinable(_ e: PublicEnum) {
|
|
switch e {
|
|
case .publicCase: break
|
|
case .spiCase: break
|
|
@unknown default: break
|
|
}
|
|
|
|
if case .spiCase = e {}
|
|
|
|
_ = PublicEnum.spiCase
|
|
}
|
|
|
|
@frozen public struct FrozenStruct {
|
|
public var spiInFrozen = SPIStruct()
|
|
var spiTypeInFrozen = SPIStruct()
|
|
private var spiTypeInFrozen1: SPIClass
|
|
}
|