mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
All symbols are private (as in the API descriptor) if the library level is more restricted than `LibraryLevel::API`. Resolves rdar://164901718 <!-- If this pull request is targeting a release branch, please fill out the following form: https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1 Otherwise, replace this comment with a description of your changes and rationale. Provide links to external references/discussions if appropriate. If this pull request resolves any GitHub issues, link them like so: Resolves <link to issue>, resolves <link to another issue>. For more information about linking a pull request to an issue, see: https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue --> <!-- Before merging this pull request, you must run the Swift continuous integration tests. For information about triggering CI builds via @swift-ci, see: https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci Thank you for your contribution to Swift! -->
98 lines
3.6 KiB
Swift
98 lines
3.6 KiB
Swift
// REQUIRES: objc_interop, OS=macosx
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %empty-directory(%t/ModuleCache)
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) %s -typecheck -parse-as-library -emit-module-interface-path %t/MyModule.swiftinterface -enable-library-evolution -module-name MyModule -swift-version 5 -library-level api
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) %s -typecheck -parse-as-library -emit-module-interface-path %t/MyModule.swiftinterface -enable-library-evolution -module-name MyModule -swift-version 5 -emit-api-descriptor-path %t/api.json -library-level api
|
|
// RUN: %validate-json %t/api.json | %FileCheck %s
|
|
|
|
import Foundation
|
|
|
|
// Need objc data for objc compatible methods.
|
|
public class NonObjC {
|
|
@objc public init() {}
|
|
@objc public func testMethod() {}
|
|
}
|
|
|
|
public class NonObjC1 {
|
|
@objc public func testMethod() {}
|
|
}
|
|
|
|
public class NonObjC2 {
|
|
@objc public func testMethod() {}
|
|
public init() {}
|
|
}
|
|
|
|
public class NonObjC3 {
|
|
@objc public init() {}
|
|
public init(fromInt: Int) {}
|
|
}
|
|
|
|
// CHECK: "interfaces": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "name": "_TtC8MyModule7NonObjC",
|
|
// CHECK-NEXT: "access": "public",
|
|
// CHECK-NEXT: "file": "SOURCE_DIR/test/APIJSON/non-objc-class.swift",
|
|
// CHECK-NEXT: "linkage": "internal",
|
|
// CHECK-NEXT: "super": "",
|
|
// CHECK-NEXT: "instanceMethods": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "name": "init",
|
|
// CHECK-NEXT: "access": "public",
|
|
// CHECK-NEXT: "file": "SOURCE_DIR/test/APIJSON/non-objc-class.swift"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "name": "testMethod",
|
|
// CHECK-NEXT: "access": "public",
|
|
// CHECK-NEXT: "file": "SOURCE_DIR/test/APIJSON/non-objc-class.swift"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ],
|
|
// CHECK-NEXT: "classMethods": []
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "name": "_TtC8MyModule8NonObjC1",
|
|
// CHECK-NEXT: "access": "public",
|
|
// CHECK-NEXT: "file": "SOURCE_DIR/test/APIJSON/non-objc-class.swift",
|
|
// CHECK-NEXT: "linkage": "internal",
|
|
// CHECK-NEXT: "super": "",
|
|
// CHECK-NEXT: "instanceMethods": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "name": "testMethod",
|
|
// CHECK-NEXT: "access": "public",
|
|
// CHECK-NEXT: "file": "SOURCE_DIR/test/APIJSON/non-objc-class.swift"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ],
|
|
// CHECK-NEXT: "classMethods": []
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "name": "_TtC8MyModule8NonObjC2",
|
|
// CHECK-NEXT: "access": "public",
|
|
// CHECK-NEXT: "file": "SOURCE_DIR/test/APIJSON/non-objc-class.swift",
|
|
// CHECK-NEXT: "linkage": "internal",
|
|
// CHECK-NEXT: "super": "",
|
|
// CHECK-NEXT: "instanceMethods": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "name": "testMethod",
|
|
// CHECK-NEXT: "access": "public",
|
|
// CHECK-NEXT: "file": "SOURCE_DIR/test/APIJSON/non-objc-class.swift"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ],
|
|
// CHECK-NEXT: "classMethods": []
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "name": "_TtC8MyModule8NonObjC3",
|
|
// CHECK-NEXT: "access": "public",
|
|
// CHECK-NEXT: "file": "SOURCE_DIR/test/APIJSON/non-objc-class.swift",
|
|
// CHECK-NEXT: "linkage": "internal",
|
|
// CHECK-NEXT: "super": "",
|
|
// CHECK-NEXT: "instanceMethods": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "name": "init",
|
|
// CHECK-NEXT: "access": "public",
|
|
// CHECK-NEXT: "file": "SOURCE_DIR/test/APIJSON/non-objc-class.swift"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ],
|
|
// CHECK-NEXT: "classMethods": []
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
|