File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -96,14 +96,24 @@ class InterceptedMethods extends MiniPhaseTransform {
9696 s " that means the intercepted methods set doesn't match the code " )
9797 tree
9898 }
99- lazy val Select (qual, _) = tree.fun
99+ lazy val qual = tree.fun match {
100+ case Select (qual, _) => qual
101+ case ident @ Ident (_) =>
102+ ident.tpe match {
103+ case TermRef (prefix : TermRef , _) =>
104+ tpd.ref(prefix)
105+ case TermRef (prefix : ThisType , _) =>
106+ tpd.This (prefix.cls)
107+ }
108+
109+ }
100110 val Any_## = this .Any_##
101111 val Any_!= = defn.Any_!=
102112 val rewrite : Tree = tree.fun.symbol match {
103113 case Any_## =>
104- poundPoundValue(qual)
114+ poundPoundValue(qual)
105115 case Any_!= =>
106- qual.select(defn.Any_== ).appliedToArgs(tree.args).select(defn.Boolean_! )
116+ qual.select(defn.Any_== ).appliedToArgs(tree.args).select(defn.Boolean_! )
107117 /*
108118 /* else if (isPrimitiveValueClass(qual.tpe.typeSymbol)) {
109119 // todo: this is needed to support value classes
@@ -121,7 +131,7 @@ class InterceptedMethods extends MiniPhaseTransform {
121131 // we get a primitive form of _getClass trying to target a boxed value
122132 // so we need replace that method name with Object_getClass to get correct behavior.
123133 // See SI-5568.
124- qual.selectWithSig(defn.Any_getClass ).appliedToNone
134+ qual.selectWithSig(defn.Any_getClass ).appliedToNone
125135 case _ =>
126136 tree
127137 }
Original file line number Diff line number Diff line change 1+
2+ object Test {
3+ != (1 )
4+ != (" abc" )
5+ 1 != this
6+ != (this )
7+ }
You can’t perform that action at this time.
0 commit comments