Files
swift-mirror/validation-test/Reflection/existentials_objc.swift
Adrian Prantl ea2b5eced9 Reflection: Implement a TypeRef -> Demangle tree adapter.
To allow more pervasive use of TypeRefs in LLDB, we need a way to build mangled
names from TypeRef pointers to allow round-tripping between TypeRefs and AST
types. The goal is to experiment with making lldb::CompilerType backed by
TypeRefs instead of AST types.

<rdar://problem/55412775>
2020-01-14 17:50:01 -08:00

42 lines
1.1 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/existentials_objc
// RUN: %target-codesign %t/existentials_objc
// RUN: %target-run %target-swift-reflection-test %t/existentials_objc > %t.txt
// RUN: grep SkipTheTest %t.txt || %FileCheck %s < %t.txt
// REQUIRES: objc_interop
// REQUIRES: executable_test
import Foundation
/*
This file pokes at the swift_reflection_projectExistential API
of the SwiftRemoteMirror library.
*/
import SwiftReflectionTest
if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) {
// Imported class wrapped in AnyObject
// CHECK: Type reference:
// CHECK: (objective_c_class name=NSObject)
reflect(object: NSObject())
// Tagged pointer wrapped in AnyObject
// CHECK: Type reference:
// CHECK: (objective_c_class name=__NSCFNumber)
reflect(object: NSNumber(123))
// Objective-C protocol:
// CHECK: Type info:
// CHECK: $sSo9NSCopying_Xl
reflect(any: { () -> NSCopying in NSString("abc") }())
} else {
// The Swift 5.0 libraries don't support this test.
class SkipTheTest {}
reflect(object: SkipTheTest())
}
doneReflecting()