summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-11-14 18:02:10 +0000
committerPaul Phillips <paulp@improving.org>2009-11-14 18:02:10 +0000
commit1cd31e2edd031c0d32266de54ef63ddb9233c047 (patch)
tree4659619c1b3532ce4b31b2f4b52f912d64dff188 /src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
parent6c4064a77086ee82de861ec30dfd87fe120c6b0d (diff)
downloadscala-1cd31e2edd031c0d32266de54ef63ddb9233c047.tar.gz
scala-1cd31e2edd031c0d32266de54ef63ddb9233c047.tar.bz2
scala-1cd31e2edd031c0d32266de54ef63ddb9233c047.zip
Fixes and test cases for #2087 and #2400.
fixing a long-standing bug in fjbg and recompiling fjbg.jar, which had the side effect of revealing that the current fjbg jar had never been recompiled with target 1.5, so now it's smaller and (I imagine) faster.
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala')
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
index 8ed2b04045..2d586ba7ea 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
@@ -162,28 +162,36 @@ trait TypeKinds { self: ICodes =>
case object BYTE extends TypeKind {
override def maxType(other: TypeKind): TypeKind =
other match {
- case BYTE | SHORT | CHAR | INT | LONG | FLOAT | DOUBLE => other
+ case CHAR => INT
+ case BYTE | SHORT | INT | LONG | FLOAT | DOUBLE => other
case REFERENCE(NothingClass) => BYTE
case _ => abort("Uncomparable type kinds: BYTE with " + other)
}
}
+ /** Note that the max of Char/Byte and Char/Short is Int, because
+ * neither strictly encloses the other due to unsignedness.
+ * See ticket #2087 for a consequence.
+ */
+
/** A 2-byte signed integer */
case object SHORT extends TypeKind {
override def maxType(other: TypeKind): TypeKind =
other match {
- case BYTE | SHORT | CHAR => SHORT
+ case CHAR => INT
+ case BYTE | SHORT => SHORT
case REFERENCE(NothingClass) => SHORT
case INT | LONG | FLOAT | DOUBLE => other
case _ => abort("Uncomparable type kinds: SHORT with " + other)
}
}
- /** A 2-byte signed integer */
+ /** A 2-byte UNSIGNED integer */
case object CHAR extends TypeKind {
override def maxType(other: TypeKind): TypeKind =
other match {
- case BYTE | SHORT | CHAR => CHAR
+ case CHAR => CHAR
+ case BYTE | SHORT => INT
case REFERENCE(NothingClass) => CHAR
case INT | LONG | FLOAT | DOUBLE => other
case _ => abort("Uncomparable type kinds: CHAR with " + other)