mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
These classes don't show up well in generated headers (rdar://problem/20855568), can't actually be allocated from Objective-C (rdar://problem/17184317), and make the story of "what is exposed to Objective-C" more complicated. Better to just disallow them. All classes are still "id-compatible" in that they can be converted to AnyObject and passed to Objective-C, they secretly implement NSObjectProtocol (via our SwiftObject root class), and their members can still be individually exposed to Objective-C. The frontend flag -disable-objc-attr-requires-foundation-module will disable this requirement as well, which is still necessary for both the standard library and a variety of tests I didn't feel like transforming. Swift SVN r29760
46 lines
1.4 KiB
Swift
46 lines
1.4 KiB
Swift
// Please keep this file in alphabetical order!
|
|
|
|
// RUN: rm -rf %t
|
|
// RUN: mkdir %t
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules/ -emit-module -o %t %s -disable-objc-attr-requires-foundation-module
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules/ -parse-as-library %t/imports.swiftmodule -parse -emit-objc-header-path %t/imports.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
|
|
// RUN: FileCheck %s < %t/imports.h
|
|
// RUN: FileCheck -check-prefix=NEGATIVE %s < %t/imports.h
|
|
// RUN: %check-in-clang %t/imports.h -I %S/Inputs/custom-modules/
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
// CHECK-DAG: @import ctypes.bits;
|
|
// CHECK-DAG: @import Foundation;
|
|
// CHECK-DAG: @import Base;
|
|
// CHECK-DAG: @import Base.ImplicitSub.ExSub;
|
|
// CHECK-DAG: @import Base.ExplicitSub;
|
|
// CHECK-DAG: @import Base.ExplicitSub.ExSub;
|
|
|
|
// NEGATIVE-NOT: ctypes;
|
|
// NEGATIVE-NOT: ImSub;
|
|
// NEGATIVE-NOT: ImplicitSub;
|
|
|
|
import ctypes.bits
|
|
import Foundation
|
|
|
|
import Base
|
|
import Base.ImplicitSub;
|
|
import Base.ImplicitSub.ImSub;
|
|
import Base.ImplicitSub.ExSub;
|
|
import Base.ExplicitSub;
|
|
import Base.ExplicitSub.ImSub;
|
|
import Base.ExplicitSub.ExSub;
|
|
|
|
@objc class Test {
|
|
let word: DWORD = 0
|
|
let number: NSTimeInterval = 0.0
|
|
|
|
let baseI: BaseI = 0
|
|
let baseII: BaseII = 0
|
|
let baseIE: BaseIE = 0
|
|
let baseE: BaseE = 0
|
|
let baseEI: BaseEI = 0
|
|
let baseEE: BaseEE = 0
|
|
}
|