diff --git a/compiler/src/dotty/tools/backend/jvm/BTypes.scala b/compiler/src/dotty/tools/backend/jvm/BTypes.scala index fb399461a03c..8b996d0d5bdb 100644 --- a/compiler/src/dotty/tools/backend/jvm/BTypes.scala +++ b/compiler/src/dotty/tools/backend/jvm/BTypes.scala @@ -290,9 +290,12 @@ abstract class BTypes { } case LONG => - if (other.isIntegralType) LONG - else if (other.isRealType) DOUBLE - else uncomparable + other match { + case INT | BYTE | LONG | CHAR | SHORT => LONG + case DOUBLE => DOUBLE + case FLOAT => FLOAT + case _ => uncomparable + } case FLOAT => if (other == DOUBLE) DOUBLE diff --git a/tests/run/i5441.check b/tests/run/i5441.check new file mode 100644 index 000000000000..d5761e30a2e3 --- /dev/null +++ b/tests/run/i5441.check @@ -0,0 +1,3 @@ +1.164309 +1.164309 +2.3242621 diff --git a/tests/run/i5441.scala b/tests/run/i5441.scala new file mode 100644 index 000000000000..c3183bf2a675 --- /dev/null +++ b/tests/run/i5441.scala @@ -0,0 +1,8 @@ +object Test { + def main(args: Array[String]): Unit = + def a(): Float = java.lang.Float.intBitsToFloat(1079290514) + def b(): Long = 1412906027847L + println(b() % a()) + println((b().toFloat % a().toFloat).toFloat) + println((b().toDouble % a().toDouble).toFloat) +}