Files
swift-mirror/test/expr/cast/array_iteration.swift
Doug Gregor 9e68a5761a Revert "Implicitly create type declarations for inferred associated type witnesses."
This reverts r27487; it's breaking one of the bots.

Swift SVN r27505
2015-04-20 22:56:50 +00:00

47 lines
767 B
Swift

// RUN: %target-parse-verify-swift
class View {
var subviews: Array<AnyObject>! = []
}
var rootView = View()
var v = [View(), View()]
rootView.subviews = v
rootView.subviews as! [View]
for view in rootView.subviews as! [View] {
println("found subview")
}
// FIXME: Unhelpful diagnostic here.
for view:View in rootView.subviews { // expected-error{{'Array<AnyObject>!' is not convertible to 'SequenceType'}}
println("found subview")
}
(rootView.subviews!) as! [View]
(rootView.subviews) as! [View]
var ao: [AnyObject] = []
ao as! [View] // works
var b = Array<(String, Int)>()
for x in b {
println("hi")
}
var c : Array<(String, Int)>! = Array()
for x in c {
println("hi")
}
var d : Array<(String, Int)>? = Array()
for x in d! {
println("hi")
}