"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/Constraints/casts_swift6.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_swift6.swift  (swift-swift-5.8-RELEASE):casts_swift6.swift  (swift-swift-5.8.1-RELEASE)
skipping to change at line 60 skipping to change at line 60
_ = ohno(ohno(ohno(["": ""]))) as [Int: String] // expected-error {{cannot con vert value of type '[String : String]???' to type '[Int : String]' in coercion}} _ = ohno(ohno(ohno(["": ""]))) as [Int: String] // expected-error {{cannot con vert value of type '[String : String]???' to type '[Int : String]' in coercion}}
_ = ohno(ohno(ohno(dict))) as [String: Int] // expected-error {{cannot convert value of type '[String : Int]???' to type '[String : Int]' in coercion}} _ = ohno(ohno(ohno(dict))) as [String: Int] // expected-error {{cannot convert value of type '[String : Int]???' to type '[String : Int]' in coercion}}
// 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}}
// Cases from rdar://88334481 // Cases from rdar://88334481
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)