Files
swift-mirror/test/expr/cast/objc_coerce_array.swift
Joe Groff 64c1737211 Sema: Clear the types of exprs changed by collection upcast peepholes.
`finish{Array,Dictionary}Expr` currently invoke `cs.cacheExprTypes` after building their semantic exprs, which in a nested collection expression, immediately undoes the type changes done by this peephole, leading to crashes due to inconsistencies in the AST later. rdar://problem/41040820
2018-07-02 15:00:30 -07:00

21 lines
551 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen -verify %s
// REQUIRES: objc_interop
import Foundation
var x = 1
_ = [x] as [NSNumber]
_ = ["x":["y":"z","a":1]] as [String : [String : AnyObject]]
_ = ["x":["z",1]] as [String : [AnyObject]]
_ = [["y":"z","a":1]] as [[String : AnyObject]]
_ = [["z",1]] as [[AnyObject]]
var y: Any = 1
_ = ["x":["y":"z","a":y]] as [String : [String : AnyObject]]
_ = ["x":["z",y]] as [String : [AnyObject]]
_ = [["y":"z","a":y]] as [[String : AnyObject]]
_ = [["z",y]] as [[AnyObject]]