Skip to content

Commit

Permalink
Remove special eq in unsafeNulls
Browse files Browse the repository at this point in the history
  • Loading branch information
noti0na1 committed May 13, 2022
1 parent be65db4 commit 0cf96cc
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -643,19 +643,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer

def typeSelectOnTerm(using Context): Tree =
val qual = typedExpr(tree.qualifier, shallowSelectionProto(tree.name, pt, this))
val qual1 = if Nullables.unsafeNullsEnabled then
qual.tpe match {
case OrNull(tpe1) if tpe1 <:< defn.ObjectType =>
qual.cast(AndType(qual.tpe, tpe1))
case tp =>
if tp.isNullType
&& (tree.name == nme.eq || tree.name == nme.ne) then
// Allow selecting `eq` and `ne` on `Null` specially
qual.cast(defn.ObjectType)
else qual
}
else qual
typedSelect(tree, pt, qual1).withSpan(tree.span).computeNullable()
typedSelect(tree, pt, qual).withSpan(tree.span).computeNullable()

def javaSelectOnType(qual: Tree)(using Context) =
// semantic name conversion for `O$` in java code
Expand Down

0 comments on commit 0cf96cc

Please sign in to comment.