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
Fix#6199: Use a skolemized prefix in asSeenFrom when needed
Prior to
91ee02f,
unstable prefixes appearing in selection types were handled in a
two-pass approach which can be summarized as:
1. Type the selection with the unstable prefix, if this prefix appears
in a position where it cannot be widened away, mark it with a special
annotation.
2. If the result of the selection contains this annotation, retype it
after having wrapped its prefix in a skolem.
This got replaced by the use of an `ApproximatingTypeMap` which can
always construct a valid (but potentially approximated) type for the
selection.
Most of the time this is all we need but there are some cases where
skolemizing the prefix is still useful as witnessed by the tests added
in this commit. They are now handled by unconditionally skolemizing
unstable prefixes.
To avoid any potential performance impact from this, we teach
`asSeenFrom` to always widen these prefixes first and only make use of
the skolem to avoid returning an approximation. Since this almost never
occurs (it happens only once when compiling Dotty) this means we incur
almost no extra cost (the skolem itself still needs to be allocated
unconditionally in advance, this cannot be delegated to `asSeenFrom`
because it's supposed to be an idempotent operation and each skolem is
unique).
0 commit comments