Skip to content

Conversation

HarrisL2
Copy link
Contributor

@HarrisL2 HarrisL2 commented Sep 12, 2025

More tests may be needed

Fixes #23908

@sjrd
Copy link
Member

sjrd commented Sep 12, 2025

It looks like this PR was initiated on top of the wrong branch. Please rebase on top of main and only include the relevant commit.

// We don't modify unit types.
|| tp.isRef(defn.UnitClass)
// We don't modify `Any` because it's already nullable.
|| tp.isRef(defn.AnyClass) => false
case tp: TypeParamRef if !tp.hasSimpleKind => false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!tp.hasSimpleKind can be moved to the first if together with outermostLevelAlreadyNullable.

@@ -107,10 +107,13 @@ object ImplicitNullInterop {
case tp: TypeRef if !tp.hasSimpleKind
// We don't modify value types because they're non-nullable even in Java.
|| tp.symbol.isValueClass
|| tp.isRef(defn.NullClass)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may also need to consider the following special classes: SingletonClass, AnyKindClass, FromJavaObjectSymbol, etc...

val n1: List[Map[String, Int]] = ???
val n2 = new N[List]()
val n3 = n2.accept[Any](n1)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also test some type lambdas like [X] =>> R

@noti0na1 noti0na1 removed the request for review from a team September 12, 2025 23:33
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.

Crash with FlexibleTypes when nullifying classes with Higher-kinded Type Parameters
3 participants