Skip to content

Commit 91b54aa

Browse files
committed
fix assert
1 parent 58db0c0 commit 91b54aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Nullables.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ object Nullables with
293293
def computeAssignNullable()(given Context): tree.type = tree.lhs match
294294
case TrackedRef(ref) =>
295295
val rhstp = tree.rhs.typeOpt
296-
if (rhstp.isNullType || rhstp.isNullableUnion)
296+
if (rhstp.isNullType || (curCtx.explicitNulls && rhstp.isNullableUnion))
297297
// If the type of rhs is nullable (`T|Null` or `Null`), then the nullability of the
298298
// lhs variable is no longer trackable. We don't need to check whether the type `T`
299299
// is correct here, as typer will check it.

0 commit comments

Comments
 (0)