From a2e8f9e001356a993da4e01235c12583d97163d3 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 27 May 2013 12:02:45 -0700 Subject: Make all numeric coercions explicit. Optimistically, this is preparation for a day when we don't let numeric types drift with the winds. Even without the optimism it's a good idea. It flushed out an undocumented change in the math package object relative to the methods being forwarded (a type is widened from what is returned in java) so I documented the intentionality of it. Managing type coercions manually is a bit tedious, no doubt, but it's not tedious enough to warrant abandoning type safety just because java did it. --- src/compiler/scala/tools/nsc/javac/JavaScanners.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/compiler/scala/tools/nsc/javac') diff --git a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala index f9b1e57e66..e987b6de2f 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala @@ -724,7 +724,7 @@ trait JavaScanners extends ast.parser.ScannersCommon { */ def intVal(negated: Boolean): Long = { if (token == CHARLIT && !negated) { - if (name.length > 0) name.charAt(0) else 0 + if (name.length > 0) name.charAt(0).toLong else 0 } else { var value: Long = 0 val divider = if (base == 10) 1 else 2 -- cgit v1.2.3