diff options
author | Dmitry Petrashko <dark@d-d.me> | 2016-12-03 04:31:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-03 04:31:41 +0100 |
commit | b0a64ec191b1b0c4ab0b066c4dcb11e0c073d6b5 (patch) | |
tree | d8d2267282b047e3b76e6c570a627606f82af9a7 /compiler | |
parent | 47d208448e614125446c7f294f8231c3fb7108d6 (diff) | |
parent | 929efec076d3ae5d2cf6d007c900c77602ed69e5 (diff) | |
download | dotty-b0a64ec191b1b0c4ab0b066c4dcb11e0c073d6b5.tar.gz dotty-b0a64ec191b1b0c4ab0b066c4dcb11e0c073d6b5.tar.bz2 dotty-b0a64ec191b1b0c4ab0b066c4dcb11e0c073d6b5.zip |
Merge pull request #1685 from dotty-staging/fix-1665
Fix #1665: Check that != has an operand on the left.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala b/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala index 7c60e8d72..21ca8dbfd 100644 --- a/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala +++ b/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala @@ -96,14 +96,24 @@ class InterceptedMethods extends MiniPhaseTransform { s"that means the intercepted methods set doesn't match the code") tree } - lazy val Select(qual, _) = tree.fun + lazy val qual = tree.fun match { + case Select(qual, _) => qual + case ident @ Ident(_) => + ident.tpe match { + case TermRef(prefix: TermRef, _) => + tpd.ref(prefix) + case TermRef(prefix: ThisType, _) => + tpd.This(prefix.cls) + } + + } val Any_## = this.Any_## val Any_!= = defn.Any_!= val rewrite: Tree = tree.fun.symbol match { case Any_## => - poundPoundValue(qual) + poundPoundValue(qual) case Any_!= => - qual.select(defn.Any_==).appliedToArgs(tree.args).select(defn.Boolean_!) + qual.select(defn.Any_==).appliedToArgs(tree.args).select(defn.Boolean_!) /* /* else if (isPrimitiveValueClass(qual.tpe.typeSymbol)) { // todo: this is needed to support value classes @@ -121,7 +131,7 @@ class InterceptedMethods extends MiniPhaseTransform { // we get a primitive form of _getClass trying to target a boxed value // so we need replace that method name with Object_getClass to get correct behavior. // See SI-5568. - qual.selectWithSig(defn.Any_getClass).appliedToNone + qual.selectWithSig(defn.Any_getClass).appliedToNone case _ => tree } |