Files
swift-mirror/test/RemoteAST/objc_classes.swift
John McCall 3d9ac50e2c Teach MetadataReader how to skip artificial subclasses,
and improve RemoteAST to provide corresponding APIs.
2017-02-16 15:41:50 -05:00

29 lines
611 B
Swift

// RUN: %target-swift-remoteast-test-with-sdk %s | %FileCheck %s
// REQUIRES: swift-remoteast-test
// REQUIRES: objc_interop
import Foundation
@_silgen_name("printMetadataType")
func printType(_: Any.Type)
@_silgen_name("printHeapMetadataType")
func printDynamicType(_: AnyObject)
printType(NSString.self)
// CHECK: NSString
class A<T> : NSObject {
@objc var property: Int
override init() { property = 0 }
}
let a = A<Int>()
printDynamicType(a)
// CHECK: A<Int>
let observer = NSObject()
a.addObserver(observer, forKeyPath: "property", options: [], context: nil)
printDynamicType(a)
// CHECK: A<Int>