Skip to content

Commit 337657c

Browse files
committed
Fix scala#5441: Primitive operations on Long with Float argument have different semantics from Java
1 parent 99548bd commit 337657c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler/src/dotty/tools/backend/jvm/BTypes.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,12 @@ abstract class BTypes {
290290
}
291291

292292
case LONG =>
293-
if (other.isIntegralType) LONG
294-
else if (other.isRealType) DOUBLE
295-
else uncomparable
293+
other match {
294+
case INT | BYTE | LONG | CHAR | SHORT => LONG
295+
case DOUBLE => DOUBLE
296+
case FLOAT => FLOAT
297+
case _ => uncomparable
298+
}
296299

297300
case FLOAT =>
298301
if (other == DOUBLE) DOUBLE

0 commit comments

Comments
 (0)