Skip to content
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

Avoid using the current denotation in NamedType.disambiguate #21414

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

jchyb
Copy link
Contributor

@jchyb jchyb commented Aug 22, 2024

While recalculating denotation in NamedType (in NamedType.memberDenot, which itself can be called from NamedType.computeDenot or NamedType.recomputeDenot), it might call NamedType.disambiguate which uses a denotation to decide about the correct overloaded method. Using current denotation here might cause stale symbol errors, so instead we use the lastKnownDenotation, which should be enough for the use case here, as targetName should not change between phases/runs.

Later in the denotation recalculation a similar thing happens with SourceLanguage.apply, where we also now avoid using currentDenotation, as whether the symbol comes from java or Scala 2 should also not change between phases/runs.

Fixes #20574

While recalculating denotation in NamedType we might call
NamedType.disambiguate which uses a denotation to decide about
the correct overloaded method. Using current denotation here might cause
stale symbol errors, so instead we use the lastKnownDenotation,
which should be enough for the use case here, as targetName should not
change between phases/runs.

Later in the denotation recalculation a similar thing happens with
SourceLanguage.apply, where we also now avoid using currentDenotation,
as whether the symbol comes from java or Scala 2 should
also not change between phases/runs.
@jchyb jchyb changed the title Experiment: Avoid using the current denotation in NamedType.disambiguate Avoid using the current denotation in NamedType.disambiguate Oct 2, 2024
@jchyb jchyb marked this pull request as ready for review October 2, 2024 12:05
@jchyb jchyb requested a review from dwijnand October 3, 2024 08:23
@jchyb jchyb merged commit fd0548e into scala:main Oct 14, 2024
28 checks passed
@jchyb jchyb deleted the fix-i20574 branch October 14, 2024 09:17
@WojciechMazur WojciechMazur added this to the 3.6.3 milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested overloaded inline methods crash the compiler when imported from exported object
3 participants