mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
...like LLDB does, instead of parsing into a single SourceFile. This does break some functionality: - no more :dump_ast - no redeclaration checking, but no shadowing either---redeclarations just become ambiguous - pretty much requires EnableAccessControl to be off, since we don't walk decls to promote them to 'public' ...but it allows us to remove a bit of longstanding support for type-checking / SILGen-ing / IRGen-ing only part of a SourceFile that was only used by the integrated REPL. ...which, need I remind everyone, is still /deprecated/...but sometimes convenient. So most of it still works.
32 lines
654 B
Swift
32 lines
654 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]+}})
|
|
|