subscript.swift (swift-swift-5.8-RELEASE) | : | subscript.swift (swift-swift-5.8.1-RELEASE) | ||
---|---|---|---|---|
skipping to change at line 104 | skipping to change at line 104 | |||
let _ = "a".number // expected-error {{ambiguous use of 'number()'}} | let _ = "a".number // expected-error {{ambiguous use of 'number()'}} | |||
extension Int { | extension Int { | |||
subscript(key: String) -> Int { get {} } // expected-note {{found this ca ndidate}} | subscript(key: String) -> Int { get {} } // expected-note {{found this ca ndidate}} | |||
subscript(key: String) -> Double { get {} } // expected-note {{found this c andidate}} | subscript(key: String) -> Double { get {} } // expected-note {{found this c andidate}} | |||
} | } | |||
let _ = 1["1"] // expected-error {{ambiguous use of 'subscript(_:)'}} | let _ = 1["1"] // expected-error {{ambiguous use of 'subscript(_:)'}} | |||
let squares = [ 1, 2, 3 ].reduce([:]) { (dict, n) in | let squares = [ 1, 2, 3 ].reduce([:]) { (dict, n) in | |||
// expected-warning@-1 {{empty collection literal requires an explicit type}} | ||||
var dict = dict | var dict = dict | |||
dict[n] = n * n | dict[n] = n * n | |||
return dict | return dict | |||
} | } | |||
// <rdar://problem/23670252> QoI: Misleading error message when assigning a valu e from [String : AnyObject] | // <rdar://problem/23670252> QoI: Misleading error message when assigning a valu e from [String : AnyObject] | |||
func r23670252(_ dictionary: [String : AnyObject], someObject: AnyObject) { | func r23670252(_ dictionary: [String : AnyObject], someObject: AnyObject) { | |||
let color : String? | let color : String? | |||
color = dictionary["color"] // expected-error {{cannot assign value of type ' AnyObject?' to type 'String?'}} | color = dictionary["color"] // expected-error {{cannot assign value of type ' AnyObject?' to type 'String?'}} | |||
_ = color | _ = color | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 0 lines changed or added |