Files
swift-mirror/test/stdlib/UncheckedOptional.swift
John McCall 0224e93a2b Only look through UncheckedOptional<T> on explicit accesses.
Add .Some and .None members.

Swift SVN r12951
2014-01-25 03:07:30 +00:00

22 lines
403 B
Swift

// RUN: %swift -i %s | FileCheck %s
// REQUIRES: swift_interpreter
var x : @unchecked Int? = .None
if x {
println("x is non-empty!")
}
else {
println("an empty optional is logically false")
}
// CHECK: an empty optional is logically false
x = .Some(0)
if x {
println("a non-empty optional is logically true")
}
else {
println("x is empty!")
}
// CHECK: a non-empty optional is logically true