"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/Constraints/casts.swift" between
swift-swift-5.8-RELEASE.tar.gz and swift-swift-5.8.1-RELEASE.tar.gz

About: Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns (developed by Apple).

casts.swift  (swift-swift-5.8-RELEASE):casts.swift  (swift-swift-5.8.1-RELEASE)
skipping to change at line 340 skipping to change at line 340
_ = ohno(ohno(ohno(["": ""]))) as [Int: String] // expected-warning {{coercion from '[String : String]???' to '[Int : String]' may fail; use 'as?' or 'as!' in stead}} _ = ohno(ohno(ohno(["": ""]))) as [Int: String] // expected-warning {{coercion from '[String : String]???' to '[Int : String]' may fail; use 'as?' or 'as!' in stead}}
_ = ohno(ohno(ohno(dict))) as [String: Int] // expected-warning {{coercion fro m '[String : Int]???' to '[String : Int]' may fail; use 'as?' or 'as!' instead}} _ = ohno(ohno(ohno(dict))) as [String: Int] // expected-warning {{coercion fro m '[String : Int]???' to '[String : Int]' may fail; use 'as?' or 'as!' instead}}
// In this case the array literal can be inferred to be [String], so totally // In this case the array literal can be inferred to be [String], so totally
// valid. // valid.
_ = ([] ?? []) as [String] // expected-warning {{left side of nil coalescing o perator '??' has non-optional type '[String]', so the right side is never used}} _ = ([] ?? []) as [String] // expected-warning {{left side of nil coalescing o perator '??' has non-optional type '[String]', so the right side is never used}}
_ = (([] as Optional) ?? []) as [String] _ = (([] as Optional) ?? []) as [String]
// The array can also be inferred to be [Any]. // The array can also be inferred to be [Any].
_ = ([] ?? []) as Array // expected-warning {{left side of nil coalescing oper ator '??' has non-optional type '[Any]', so the right side is never used}} _ = ([] ?? []) as Array // expected-warning {{left side of nil coalescing oper ator '??' has non-optional type '[Any]', so the right side is never used}}
// expected-warning@-1{{empty collection literal requires an explicit type}}
// rdar://88334481 – Don't apply the compatibility logic for collection litera ls. // rdar://88334481 – Don't apply the compatibility logic for collection litera ls.
typealias Magic<T> = T typealias Magic<T> = T
_ = [i] as [String] // expected-error {{cannot convert value of type 'Int' to expected element type 'String'}} _ = [i] as [String] // expected-error {{cannot convert value of type 'Int' to expected element type 'String'}}
_ = [i] as Magic as [String] // expected-error {{cannot convert value of type 'Int' to expected element type 'String'}} _ = [i] as Magic as [String] // expected-error {{cannot convert value of type 'Int' to expected element type 'String'}}
_ = ([i]) as Magic as [String] // expected-error {{cannot convert value of typ e 'Int' to expected element type 'String'}} _ = ([i]) as Magic as [String] // expected-error {{cannot convert value of typ e 'Int' to expected element type 'String'}}
_ = [i: i] as [String: Any] // expected-error {{cannot convert value of type 'Int' to expected dictionary key type 'String'}} _ = [i: i] as [String: Any] // expected-error {{cannot convert value of type 'Int' to expected dictionary key type 'String'}}
_ = ([i: i]) as [String: Any] // expected-error {{cannot convert value of typ e 'Int' to expected dictionary key type 'String'}} _ = ([i: i]) as [String: Any] // expected-error {{cannot convert value of typ e 'Int' to expected dictionary key type 'String'}}
_ = [i: stringAnyDict] as [String: Any] // expected-error {{cannot convert va lue of type 'Int' to expected dictionary key type 'String'}} _ = [i: stringAnyDict] as [String: Any] // expected-error {{cannot convert va lue of type 'Int' to expected dictionary key type 'String'}}
 End of changes. 1 change blocks. 
1 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)