New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-8083] Inherited Codable initialiser behaviour appears broken in Swift 4.2 #50616
Comments
Yikes! Thanks for reporting. @swift-ci create |
4.2: #17732 |
marcpalmer (JIRA User), Could you verify if the problem is fixed and if so move the JIRA to "Closed"? |
Comment by Marc Palmer (JIRA) Definitely will check as soon as I get back from vacation! Many thanks for fixing. |
Comment by Marc Palmer (JIRA) @AnnaZaks how do I know which Xcode 10 beta includes this fix? I am unsure how to determine this in order to validate the fix. Xcode 10 beta 5 is from some weeks ago, but how can I be sure it includes this change from 3rd July? |
There's no way to tell from just the GitHub repo, but Anna waited to ask her question until the fix was in a beta. In this case it was actually in beta 4. |
Comment by Marc Palmer (JIRA) Thanks @belkadan I’ll try to retest my clients app minus workarounds tomorrow |
marcpalmer (JIRA User), Could you confirm that the fix works for you and "close" the JIRA? Thanks! |
Marc Palmer, Could you confirm that the fix works for you and "close" the JIRA? Thanks! |
Comment by Marc Palmer (JIRA) Thank you so much for fixing this! Apologies for the delay verifying. |
Environment
Xcode 10 beta 1 and 2.
Additional Detail from JIRA
md5: 0d101064449b56477faf3d132af3b5a4
Issue Description:
It seems there is a regression in Swift 4.2 where subclasses that inherit automatic codable conformance do no construct the correct type or something else is a little bit off, but in a pretty scary way.
Take the following playground:
On Xcode 10 beta 1 and 2 this gives the output shown in the comments - basically polymorphism is broken on B when decoded.
When run on Xcode 9.4, it works as expected and outputs "Yo" in both cases. Hat tip to @robmaceachern for the isolated case.
Note that adding a "no-op" empty
init(from: )
that callstry super.init(from: )
works around the problem.The text was updated successfully, but these errors were encountered: