Skip to content

Backport "Don't approximate a type using Nothing as prefix" to 3.3 LTS #521

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

Open
wants to merge 1 commit into
base: backport-lts-3.3-23211
Choose a base branch
from

Conversation

tgodzik
Copy link

@tgodzik tgodzik commented Jul 26, 2025

Backports scala#23531 to the 3.3.7.

PR submitted by the release tooling.
[skip ci]

Approximate range(Nothing, hi) to Nothing & hi instead of Nothing. This avoids
creating TypeRefs with a Nothing prefix which manifest themselves down the line
with an error like:

    Cannot resolve reference to type path.type.AbsMember.
    The classfile defining the type might be missing from the classpath.
         val z1 = transition(di).ext(1) // error
                            ^
Due to a MissingType thrown from TypeErasure#sigName.

This change required tweaking Type#findMember to handle WildcardTypes instead of
returning NoDenotation. This was only required for two
tests (tests/pos/i7414.scala and tests/pos/i13842.scala) where `wildApprox` ends
up creating a TermRef whose underlying type is a WildcardType, because of a type
parameter being substituted by a wildcard, which seems legitimate when we're using
`wildApprox`.

The presentation compiler also had a special case for Nothing appearing in
completion which had to be adapted.

Fixes scala#23530

[Cherry-picked 9f4179a]
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.

2 participants