WIP: Keep skolem types when unpickling/bringing a denotation to a new run, in more cases #22856
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Attempts to fix #22585
The source of the issue is in the inlined makeHammer method, where the
hammer
method Is generated.Initially,
hammer.hammer(???.asInstanceOf).asInstanceOf[O]
Is typed asSo
hammer.hammer
is a function with a skolemtype ((input: <?1:Hammer[?, Int]>.I): Int
) and???.asInstanceOf
is the same skolemtype (<?1:Hammer[?, Int]>.I>
).The issues arrived when we either would try to inline this from unpicked tasty (test case
tests/pos/i22585-a
), or if we suspended compilation (e.g. because of a macro method usage) and tried to inline it in a new run, after compiling the inlined method.In the first case, we would previously not unpickle the applied type parameter to ???.asInstanceOf to a skolemtype, (but the function input would) so a type checker would fail there.
In the second case, we would remember the skolemtype in the ???.asInstanceOf, but the
hammer.hammer
function denotation, while being brought to a new run, would recalculate the type, losing the skolemtype in the process (and then failing the type checking).This PR currently provides naive fixes to both things, but the unpicking part seems to suffer from a few issues: