-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[WIP] [4.2] Allow a specialized conformance to fail #17406
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
[WIP] [4.2] Allow a specialized conformance to fail #17406
Conversation
This handles the case where a conditional conformance cannot be inherited because the subclass provides a generic argument that doesn't satisfy the conditional requirements. https://bugs.swift.org/browse/SR-7337
Does this even make sense? It does make the crash from SR-7337 go away, but I have no idea what else it might break. I also don't know what the equivalent change would be on master. The original test case no longer fails because we don't serialize substitutions, but that doesn't mean that everything is working as intended. @swift-ci Please test |
@swift-ci Please test source compatibility |
Build failed |
Build failed |
Well, this crashed building the stdlib, so maybe not. |
@jrose-apple We crash on 4.2 but not on master because of differences in how SubstitutionMap and SubstitutionList were represented. Suppose we have this generic signature:
Now let's say we have an invalid substitution On the other hand, a substitution list will store the replacement type for T, and the replacement type for T.X. Since T doesn't have an X, the second replacement type is an ErrorType, which cannot be serialized. It's funny because I was going to add an 'invalid' bit to SubstitutionMap to represent maps where some conformances are missing, because this will allow us to enforce stronger invariants (concrete type must have concrete conformance, and vice versa, instead of treating an abstract conformance as an 'error conformance'). However if we do that, presumably we don't want to serialize invalid SubstitutionMaps, and we'd end up with the same crash on master. So I don't really know what the right fix here is. Perhaps inherited conformances should not serialize their substitutions; I think they can always be re-constructed at runtime. You mentioned not serializing inherited conformances at all, but I don't know what that means; they can be referenced from other entities that get serialized, so you have to serialize something. |
Your explanation makes sense but doesn't exactly give us a way forward. :-) It would be nice™ to not crash here in 4.2. What about something much smaller, like putting a null type in the serialized Substitution? Or allowing error types just in this one location? I mean, it should never be used, right? |
Closing in favor of #17523. |
This handles the case where a conditional conformance cannot be inherited because the subclass provides a generic argument that doesn't satisfy the conditional requirements.
SR-7337 / rdar://problem/39142121