File tree 2 files changed +21
-4
lines changed
compiler/src/dotty/tools/dotc/transform
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 {
96
96
s " that means the intercepted methods set doesn't match the code " )
97
97
tree
98
98
}
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
+ }
100
110
val Any_## = this .Any_##
101
111
val Any_!= = defn.Any_!=
102
112
val rewrite : Tree = tree.fun.symbol match {
103
113
case Any_## =>
104
- poundPoundValue(qual)
114
+ poundPoundValue(qual)
105
115
case Any_!= =>
106
- qual.select(defn.Any_== ).appliedToArgs(tree.args).select(defn.Boolean_! )
116
+ qual.select(defn.Any_== ).appliedToArgs(tree.args).select(defn.Boolean_! )
107
117
/*
108
118
/* else if (isPrimitiveValueClass(qual.tpe.typeSymbol)) {
109
119
// todo: this is needed to support value classes
@@ -121,7 +131,7 @@ class InterceptedMethods extends MiniPhaseTransform {
121
131
// we get a primitive form of _getClass trying to target a boxed value
122
132
// so we need replace that method name with Object_getClass to get correct behavior.
123
133
// See SI-5568.
124
- qual.selectWithSig(defn.Any_getClass ).appliedToNone
134
+ qual.selectWithSig(defn.Any_getClass ).appliedToNone
125
135
case _ =>
126
136
tree
127
137
}
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