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-7395] CaseEnumerable and Codable cause crash #49938
Comments
CodaFi (JIRA User), @itaiferber, any ideas? |
This should not compile. The final name of the protocol is CaseIterable. In fact, you can play this game with any invalid protocol name and it crashes. For that reason, I'm out. @itaiferber? |
Oh, good catch. |
Looks like this happens only for |
Don't forget the -g, to make sure it's emitting a module. But it's possible your recent changes to check for invalid things better were sufficient. |
Looks like this is still an issue in 4.2; I'm repeating the test with a clean build of master just to make sure those changes aren't making it in (since they haven't been merged yet) |
Looks like this happens on master too. Taking a look |
@belkadan Okay, looks like the fix here is relatively simple, but highlights a problem with how note: some codable problem here
note: another codable problem here
error: type 'Foo' does not conform to 'Decodable' those two notes get lost because Xcode has no error to associate them with. To combat this, PR-10253 introduced the collation of these errors by using a The problem is that if we don't consider everything that could go wrong, other diagnostics can get lost. What's happening here is that the Because The easy fix here is to check for these errors in |
At worst we can collect a bunch of |
@belkadan Yeah, that's one reasonable way to do it. It just still requires us to thread those through other functions which already have their own return types too. Feasible (we could pass in a mutable vector reference to append to instead), just a bit of a pain potentially. |
Another option is to make a helper class to contain all of these synthesis functions, and then the class can have state. |
Additional Detail from JIRA
md5: 5c187570ea65a580656b47caf24ec65e
Issue Description:
The above code causes a crash in serialization, with an ErrorType appearing somewhere in the CodingKeys enum. This may indicate an error that wasn't diagnosed, or it may indicate a type not being computed property.
(You can get this to happen with
swiftc -g
.)The text was updated successfully, but these errors were encountered: