Files
swift-mirror/test/PrintAsObjC/pragma-clang.swift
Jordan Rose 8106a11dac Disallow @objc on non-ObjC-rooted classes.
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
2015-06-27 16:27:56 +00:00

18 lines
635 B
Swift

// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -import-objc-header %S/Inputs/bridging-header.h -parse -emit-objc-header-path %t/pragma-clang.h
// RUN: %check-in-clang -fsyntax-only -Werror %t/pragma-clang.h
// RUN: FileCheck %s < %t/pragma-clang.h
// REQUIRES: objc_interop
// CHECK: #pragma clang diagnostic push
// CHECK: #pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
// CHECK: @interface Test
@objc class Test : NSObject, TestProto {
var str: String = ""
var strongProp: AnyObject?
}
// CHECK: #pragma clang diagnostic pop
// CHECK-NOT: clang diagnostic