Files
swift-mirror/test/Interpreter/SDK/Cocoa_repl.swift
2016-08-10 23:52:02 -07:00

32 lines
647 B
Swift

// RUN: %target-repl-run-simple-swift | %FileCheck %s
// REQUIRES: objc_interop
// REQUIRES: swift_repl
import Cocoa
// CHECK: 0{{$}}
print(NSNumber(value: 0).description)
protocol Q { func foo() }
extension CGRect: Q {
func foo() {
print(self)
}
}
(CGRect() as Any as! Q).foo()
// CHECK: (0.0, 0.0, 0.0, 0.0)
// Test the "mayLieAboutNonOptionalReturn" hack for both imported and
// non-imported types.
struct Empty {}
let _: Optional = Empty()
// CHECK: Optional(REPL.Empty())
let _: Optional = CGPoint.zero
// CHECK: Optional((0.0, 0.0))
let _: Optional = NSString.availableStringEncodings
// CHECK: Optional(0x{{[0-9a-fA-F]+}})