[Custom Descriptors] Handle inexact ref.get_desc in AbstractTypeRefining#7965
Conversation
| // The descriptor is abstract, but it has a subtype that is not | ||
| // (which we want to optimize to). We know this will only succeed if | ||
| // we receive the subtype of the described type, so that that | ||
| // descriptor is fetched. Add a cast so that we validate. |
There was a problem hiding this comment.
As a follow-up, we can get rid of this cast (and if I'm not mistaken, this entire visitor) by inferring that a described type must not be instantiated if its descriptor type is uninstantiated.
There was a problem hiding this comment.
I was thinking that, yeah, we can infer abstractness from descriptors to described...
There was a problem hiding this comment.
I suspect though that other optimizations handle this (if the descriptor is not instantiated, eventually we infer all creations of the described receive null descriptors and hence trap, get removed, and the type becomes abstract).
There was a problem hiding this comment.
Yep, but I think cutting down on the iterations required to reach a good state is still useful, especially when it can make our code simpler as well.
In that case we need to consider subtypes.