File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
compiler/src/dotty/tools/dotc/typer
tests/explicit-nulls/unsafe-common/unsafe-java-call Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3749,7 +3749,7 @@ class Typer extends Namer
37493749 // if unsafeNulls is enabled, try to strip nulls from Java function calls
37503750 if Nullables .unsafeNullsEnabled then
37513751 tree match
3752- case _ : Apply if tree.symbol.is(JavaDefined ) =>
3752+ case _ : Apply | _ : Select if tree.symbol.is(JavaDefined ) =>
37533753 wtp match
37543754 case OrNull (wtp1) => return readapt(tree.cast(wtp1))
37553755 case _ =>
Original file line number Diff line number Diff line change @@ -10,4 +10,8 @@ public int f2() {
1010 public <T > T g1 () {
1111 return null ;
1212 }
13+ }
14+
15+ class J2 <T > {
16+ public T x = null ;
1317}
Original file line number Diff line number Diff line change @@ -30,4 +30,8 @@ def clo1[T]: T = j.g1[T]() // error
3030
3131def clo2 [T <: AnyRef ]: T = j.g1[T | Null ]() // error
3232
33- def clo3 [T >: Null <: AnyRef | Null ]: T = j.g1[T ]()
33+ def clo3 [T >: Null <: AnyRef | Null ]: T = j.g1[T ]()
34+
35+ def testJ2 [T ]: T =
36+ val j2 : J2 [T ] = new J2
37+ j2.x // error
You can’t perform that action at this time.
0 commit comments