Files
swift-mirror/test/Migrator/objc_inference.swift
David Farler 63776b507b When converting some of the old Migrator automation to the new Migrator,
I had set up the driver to invoke a separate frontend invocation with
the "update code" mode. We sort of did this last release, except we
forked to the swift-update binary instead. This is causing problems with
testing in Xcode.

Instead, let's perform a single compile and add the remap file as an
additional output during normal compiles. The driver, seeing
-update-code, will add -emit-remap-file-path $PATH to the -c frontend
invocation.

rdar://problem/31857580
2017-04-27 01:03:00 -07:00

38 lines
1.0 KiB
Swift

// RUN: rm -rf %t && mkdir -p %t && %target-swift-frontend -c -update-code -warn-swift3-objc-inference -primary-file %s -emit-migrated-file-path %t/migrated_objc_inference.swift -emit-remap-file-path %t/migrated_objc_inference.swift.remap
// RUN: not diff -u %s %t/migrated_objc_inference.swift > %t/objc_inference.diff
// RUN: %FileCheck %s < %t/objc_inference.diff
// REQUIRES: objc_interop
import Foundation
class MyClass : NSObject {
var property : NSObject? = nil
// CHECK: + @objc var property : NSObject? = nil
dynamic var member : Int { return 2 }
// CHECK: + @objc dynamic var member : Int { return 2 }
func foo() {}
// CHECK: + @objc func foo() {}
func baz() {}
// CHECK: + @objc func baz() {}
}
extension MyClass {
func bar() {}
// CHECK: + @objc func bar() {}
}
class MySubClass : MyClass {
override func foo() {}
override func bar() {}
}
func test(object: AnyObject, mine: MyClass) {
_ = #selector(MyClass.foo)
_ = #selector(getter: MyClass.member)
_ = #keyPath(MyClass.property)
_ = object.baz?()
}