mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
-check-api-availability-only limits availability checking to the API only, ensuring that was will appear in the swiftinterface is sound but without raising issues about implementation details. This patch ensures it correctly ignore non-public async functions as they wouldn't appear in the API. rdar://86174644
112 lines
2.3 KiB
Swift
112 lines
2.3 KiB
Swift
/// Derived from api-availability-only with the errors fixed to check that the
|
|
/// generated module interface can be built.
|
|
|
|
// RUN: %empty-directory(%t)
|
|
|
|
// RUN: %swiftc_driver -emit-module %s -target %target-cpu-apple-macosx10.14 -emit-module-interface -emit-module-interface-path %t/main.swiftinterface -enable-library-evolution -check-api-availability-only -verify-emitted-module-interface
|
|
// RUN: %target-swift-frontend -typecheck-module-from-interface %t/main.swiftinterface
|
|
|
|
// REQUIRES: OS=macosx
|
|
|
|
@available(macOS 11.0, *)
|
|
public protocol NewProto {}
|
|
|
|
@available(macOS 11.0, *)
|
|
public struct NewStruct {}
|
|
|
|
@available(macOS 11.0, *)
|
|
public func newFunc() {}
|
|
|
|
@available(macOS 11.0, *)
|
|
public func apiFunc(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
@available(macOS 11.0, *)
|
|
@usableFromInline func usableFromInline(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
@available(macOS 11.0, *)
|
|
@inlinable func inlinable(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
@available(macOS 11.0, *)
|
|
@_spi(SomeSPI) public func spiFunc(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
func internalFunc(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
private func privateFunc(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
fileprivate func fileprivateFunc(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
public struct Struct {
|
|
internal var internalVar: NewProto
|
|
private var privateVar: NewProto
|
|
fileprivate var fileprivateVar: NewProto
|
|
|
|
internal var internalAssigned = NewStruct()
|
|
private var privateAssigned = NewStruct()
|
|
fileprivate var fileprivateAssigned = NewStruct()
|
|
|
|
@available(macOS 11.0, *)
|
|
public typealias PubTA = NewProto
|
|
private typealias PrivateTA = NewProto
|
|
|
|
@available(macOS 11.0, *)
|
|
public func apiFunc(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
@available(macOS 11.0, *)
|
|
@usableFromInline func usableFromInline(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
@available(macOS 11.0, *)
|
|
@inlinable func inlinable(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
func internalFunc(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
private func privateFunc(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
|
|
fileprivate func fileprivateFunc(s : NewProto) {
|
|
let _: NewProto
|
|
newFunc()
|
|
}
|
|
}
|
|
|
|
internal func asyncFunc() async -> InternalActor {
|
|
fatalError()
|
|
}
|
|
|
|
actor InternalActor {
|
|
}
|