You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The diagnostics are showing a faulty source location, indicating that we have a type error an after synthesizing the decls. Instead, we should be erroring earlier like we do for [T]?.
/Users/rwidmann/test.swift:1:8: error: type 'S' does not conform to protocol 'Decodable'
struct S<T>: Codable {
^
Swift.Decodable:2:5: note: protocol requires initializer 'init(from:)' with type 'Decodable'
init(from decoder: Decoder) throws
^
/Users/rwidmann/test.swift:2:7: note: cannot automatically synthesize 'Decodable' because 'T?' does not conform to 'Decodable'
var s: T!
^
/Users/rwidmann/test.swift:1:8: error: type 'S' does not conform to protocol 'Encodable'
struct S<T>: Codable {
^
Swift.Encodable:2:10: note: protocol requires function 'encode(to:)' with type 'Encodable'
func encode(to encoder: Encoder) throws
^
/Users/rwidmann/test.swift:2:7: note: cannot automatically synthesize 'Encodable' because 'T?' does not conform to 'Encodable'
var s: T!
^
Additional Detail from JIRA
md5: bed0ffeb25a388d30c6a04741f0aa9f6
Issue Description:
Consider the following code
This returns the following diagnostic for Xcode 12 beta 1:
The diagnostics are showing a faulty source location, indicating that we have a type error an after synthesizing the decls. Instead, we should be erroring earlier like we do for
[T]?
.This generates the appropriate diagnostics.
At the moment, the example with
[T]!
crashes with master, which is tracked in SR-13117.The text was updated successfully, but these errors were encountered: