Files
swift-mirror/test/Interpreter/array_of_optional.swift
Joe Groff 6dcb5b0047 IRGen: Correctly lower index_addr for types where size != stride.
If the LLVM size of a type doesn't match its stride, or a type's size is dynamic, we can't naively lower index_addr to a GEP of the LLVM pointer. We have to bitcast to i8* and GEP the strided distance in bytes. Fixes <rdar://problem/15609900>.

Swift SVN r10972
2013-12-07 02:45:28 +00:00

28 lines
402 B
Swift

// RUN: %swift -i %s | FileCheck %s
// REQUIRES: swift_interpreter
// <rdar://problem/15609900>
// CHECK: 10
// CHECK: None
// CHECK: 20
// CHECK: None
// CHECK: 30
// CHECK: hello world
func main() {
var arrOpt : (Int?)[] = [10,.None,20,.None,30]
for item in arrOpt {
switch item {
case .None:
println("None")
case .Some(var v):
println(v)
}
}
println("hello world")
}
main()