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
There are two holes with conformance availability checking as it interacts with dynamic casts:
We should ensure that an unconditionally unavailable conformance is never discovered by a dynamic `as?` cast
We should ensure that a conditionally unavailable conformance is never discovered by a dynamic `as?` cast, even if the witness table symbol exists on the deployment target.
There might be some places we need to check in the SIL optimizer as well.
The text was updated successfully, but these errors were encountered:
> We should ensure that a conditionally unavailable conformance is never discovered by a dynamic `as?` cast, even if the witness table symbol exists on the deployment target.
I think dynamic casts ought to succeed if the conformance is available at runtime. The alternative seems far less desirable – by forcing dynamic casts to fail, we would cripple these additions with a second-rate status.
Code that does dynamic casting already needs to prepare for failure, much like the else branch of an `if #available` check.
Hm, that is probably overly optimistic. I think we'd only want dynamic casts to consider these conformances if the running code was compiled with an stdlib module that included them – but I think we'd definitely want them in that case. (These new conformances may cause regressions in existing binaries, I guess esp. for any code that included its own conformance for these.)
Additional Detail from JIRA
md5: 13f414e9d05d4909524ed22bf5e9f240
Issue Description:
There are two holes with conformance availability checking as it interacts with dynamic casts:
We should ensure that an unconditionally unavailable conformance is never discovered by a dynamic `as?` cast
We should ensure that a conditionally unavailable conformance is never discovered by a dynamic `as?` cast, even if the witness table symbol exists on the deployment target.
There might be some places we need to check in the SIL optimizer as well.
The text was updated successfully, but these errors were encountered: