-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Only cache base types when gadt state is empty #19562
Conversation
test performance please |
performance test scheduled: 1 job(s) in queue, 1 running. |
Performance test finished successfully: Visit https://dotty-bench.epfl.ch/19562/ to see the changes. Benchmarks is based on merging with main (b20747d) |
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit https://dotty-bench.epfl.ch/19562/ to see the changes. Benchmarks is based on merging with main (b20747d) |
It looks like simply not caching base types when the |
bd25160
to
0a759cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels reasonable, on balance.
) Backports #19562 to the LTS branch. PR submitted by the release tooling. [skip ci]
The
Typer
inserts casts for trees which only conform using gadt constraints, so that -Ycheck succeeds in later phases.We recheck in an empty GadtState, whether the type is found to already be a subtype, in which case we do not add the cast. The issue is that
isSubtype
relies on the baseType cache, which might have been populated in a ctx with the narrowing gadt constraints.https://github.com/lampepfl/dotty/blob/1716bcd9dbefbef88def848c09768a698b6b9ed9/compiler/src/dotty/tools/dotc/typer/Typer.scala#L4075-L4084
Fixes #19521