Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove special eq in unsafeNulls
  • Loading branch information
noti0na1 committed May 13, 2022
commit 0cf96cc4851fe094563640dbde53b4adbe6ea4b7
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