diff options
author | Paul Phillips <paulp@improving.org> | 2009-10-28 20:10:54 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-10-28 20:10:54 +0000 |
commit | b7772a6535b1d3989ad350069568b124619f2877 (patch) | |
tree | 56726bf0a76929fc69bcf059e68e6e7fb2632ce1 /src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala | |
parent | cc934ee7bb181645d4436eb923f7eb843b7c259d (diff) | |
download | scala-b7772a6535b1d3989ad350069568b124619f2877.tar.gz scala-b7772a6535b1d3989ad350069568b124619f2877.tar.bz2 scala-b7772a6535b1d3989ad350069568b124619f2877.zip |
Whole bunch of code for people interested in eq...
Whole bunch of code for people interested in equality. This includes
four command line options you can use to alter equality semantics and
the various levels of babbling and panicking which the runtime has to
offer when confronted with a boxed primitive comparison.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala index a46a987bb8..12f6f4021b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala @@ -70,6 +70,12 @@ abstract class ConstantFolder { } private def foldBinop(op: Name, x: Constant, y: Constant): Constant = try { + // temporarily logging folded ==/!= so the log doesn't have unexplained absences + if ((op == nme.EQ || op == nme.NE) && x.tag != y.tag && settings.logEqEq.value) { + val opstr = if (op == nme.EQ) "==" else "!=" + scala.runtime.Equality.log("Folding constant expression (%s %s %s)".format(x.value, opstr, y.value)) + } + val optag = if (x.tag == y.tag) x.tag else if (isNumeric(x.tag) && isNumeric(y.tag)) if (x.tag > y.tag) x.tag else y.tag |