diff options
author | paltherr <paltherr@epfl.ch> | 2003-12-08 15:18:59 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-12-08 15:18:59 +0000 |
commit | 486a8c2f7d4dd1fc05e36307af055b70c0e5a6ca (patch) | |
tree | 00fb9e3c100b835da57ef21fd508ac877fed1baa | |
parent | 2aa1444f81e0fb72815cec5aeb4dbc7c2e76c725 (diff) | |
download | scala-486a8c2f7d4dd1fc05e36307af055b70c0e5a6ca.tar.gz scala-486a8c2f7d4dd1fc05e36307af055b70c0e5a6ca.tar.bz2 scala-486a8c2f7d4dd1fc05e36307af055b70c0e5a6ca.zip |
- Added cases for operations on strings
-rw-r--r-- | sources/scala/tools/scalac/typechecker/ConstantFolder.scala | 36 | ||||
-rw-r--r-- | 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): |