 // CHECK: ]
 testAnyObjectDowncast(["hello" : 1, "world" : 2])
 
-// CHECK: Did not match
+// CHECK-NEXT: Did not match
 testAnyObjectDowncast(nil)
 
 func testNSArrayDowncast(nsArr: NSArray?) {

  }
}

// CHECK: MATCH
testNSMutableStringMatch("foobar")

// CHECK: nomatch
testNSMutableStringMatch("nope")

func testAnyObjectDowncast(obj: AnyObject!) {

import Foundation

func testAnyObjectIsa(obj: AnyObject) {
  print("(")
  if obj is String {
    print("String")
  }
  if obj is Int {
    print("Int")
  }
  if obj is [NSString] {
    print("[NSString]")
  }
  if obj is [Int] {
    print("[Int]")
  }
  if obj is Dictionary<String, Int> {
    print("Dictionary<String, Int>")
  }
  println(")")
}

// CHECK: testing...
println("testing...")


// CHECK-NEXT: (String)
testAnyObjectIsa("hello")

// CHECK-NEXT: (Int)
testAnyObjectIsa(5)

// CHECK-NEXT: ([NSString])
testAnyObjectIsa(["hello", "swift", "world"])

// CHECK-NEXT: ([Int])
testAnyObjectIsa([1, 2, 3, 4, 5])

// CHECK-NEXT: (Dictionary<String, Int>)
testAnyObjectIsa(["hello" : 1, "world" : 2])

func testNSArrayIsa(nsArr: NSArray) {
  print("(")
  if nsArr is [String] {
    print("[String]")
  }
  if nsArr is [Int] {
    print("[Int]")
  }
  println(")")
}

// CHECK-NEXT: ([String])
testNSArrayIsa(["a", "b", "c"])

// CHECK-NEXT: ([Int])
testNSArrayIsa([1, 2, 3])

// CHECK-NEXT: ()
testNSArrayIsa([[1, 2], [3, 4], [5, 6]])

func testArrayIsa(arr: Array<AnyObject>) {
  print("(")
  if arr is [NSString] {
    print("[NSString]")
  }
  if arr is [NSNumber] {
    print("[NSNumber]")
  }
  println(")")
}

// CHECK-NEXT: ([NSString])
testArrayIsa(["a", "b", "c"])

// CHECK-NEXT: ([NSNumber])
testArrayIsa([1, 2, 3])

// CHECK-NEXT: ()
testArrayIsa([[1, 2], [3, 4], [5, 6]])

func testArrayIsaBridged(arr: Array<AnyObject>) {
  print("(")
  if arr is [String] {
    print("[String]")
  }
  if arr is [Int] {
    print("[Int]")
  }
  println(")")
}

// CHECK-NEXT: ([String])
testArrayIsaBridged(["a", "b", "c"])

// CHECK-NEXT: ([Int])
testArrayIsaBridged([1, 2, 3])

// CHECK-NEXT: ()
testArrayIsaBridged([[1, 2], [3, 4], [5, 6]])

func testNSMutableStringMatch(sa: NSMutableString) {
