From 486a8c2f7d4dd1fc05e36307af055b70c0e5a6ca Mon Sep 17 00:00:00 2001 From: paltherr Date: Mon, 8 Dec 2003 15:18:59 +0000 Subject: - Added cases for operations on strings --- .../tools/scalac/typechecker/ConstantFolder.scala | 36 ++++++++++++---------- sources/scalac/typechecker/ConstantFolder.java | 36 ++++++++++++---------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/sources/scala/tools/scalac/typechecker/ConstantFolder.scala b/sources/scala/tools/scalac/typechecker/ConstantFolder.scala index 36855193cb..22950466ca 100644 --- a/sources/scala/tools/scalac/typechecker/ConstantFolder.scala +++ b/sources/scala/tools/scalac/typechecker/ConstantFolder.scala @@ -42,24 +42,26 @@ class ConstantFolder(ana: Analyzer) { rsymbol = ana.definitions.INT_CLASS; } val optype: Type = - if (ltype.isSameAs(rtype)) { + if (ltype.isSameAs(rtype)) ltype; - } else { - if (lsymbol == ana.definitions.INT_CLASS) - rtype; - else if (rsymbol == ana.definitions.INT_CLASS) - ltype; - else if (lsymbol == ana.definitions.LONG_CLASS) - rtype; - else if (rsymbol == ana.definitions.LONG_CLASS) - ltype; - else if (lsymbol == ana.definitions.FLOAT_CLASS) - rtype; - else if (rsymbol == ana.definitions.FLOAT_CLASS) - ltype; - else - throw Debug.abort("illegal case", ltype.toString() +" - "+ rtype); - } + else if (lsymbol == ana.definitions.JAVA_STRING_CLASS) + ltype; + else if (rsymbol == ana.definitions.JAVA_STRING_CLASS) + rtype; + else if (lsymbol == ana.definitions.INT_CLASS) + rtype; + else if (rsymbol == ana.definitions.INT_CLASS) + ltype; + else if (lsymbol == ana.definitions.LONG_CLASS) + rtype; + else if (rsymbol == ana.definitions.LONG_CLASS) + ltype; + else if (lsymbol == ana.definitions.FLOAT_CLASS) + rtype; + else if (rsymbol == ana.definitions.FLOAT_CLASS) + ltype; + else + throw Debug.abort("illegal case", ltype.toString() +" - "+ rtype); var value: Object = null; optype.unbox() match { case Type$UnboxedType(INT) => diff --git a/sources/scalac/typechecker/ConstantFolder.java b/sources/scalac/typechecker/ConstantFolder.java index 10738bb47d..46d33b702f 100644 --- a/sources/scalac/typechecker/ConstantFolder.java +++ b/sources/scalac/typechecker/ConstantFolder.java @@ -46,24 +46,26 @@ class ConstantFolder implements /*imports*/ TypeTags { rsymbol = ana.definitions.INT_CLASS; } Type optype; - if (ltype.isSameAs(rtype)) { + if (ltype.isSameAs(rtype)) optype = ltype; - } else { - if (lsymbol == ana.definitions.INT_CLASS) - optype = rtype; - else if (rsymbol == ana.definitions.INT_CLASS) - optype = ltype; - else if (lsymbol == ana.definitions.LONG_CLASS) - optype = rtype; - else if (rsymbol == ana.definitions.LONG_CLASS) - optype = ltype; - else if (lsymbol == ana.definitions.FLOAT_CLASS) - optype = rtype; - else if (rsymbol == ana.definitions.FLOAT_CLASS) - optype = ltype; - else - throw Debug.abort("illegal case", ltype + " - " + rtype); - } + else if (lsymbol == ana.definitions.JAVA_STRING_CLASS) + optype = ltype; + else if (rsymbol == ana.definitions.JAVA_STRING_CLASS) + optype = rtype; + else if (lsymbol == ana.definitions.INT_CLASS) + optype = rtype; + else if (rsymbol == ana.definitions.INT_CLASS) + optype = ltype; + else if (lsymbol == ana.definitions.LONG_CLASS) + optype = rtype; + else if (rsymbol == ana.definitions.LONG_CLASS) + optype = ltype; + else if (lsymbol == ana.definitions.FLOAT_CLASS) + optype = rtype; + else if (rsymbol == ana.definitions.FLOAT_CLASS) + optype = ltype; + else + throw Debug.abort("illegal case", ltype + " - " + rtype); Object value = null; switch (optype.unbox()) { case UnboxedType(INT): -- cgit v1.2.3