File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -558,9 +558,15 @@ class Typer extends Namer
558558 case _ =>
559559 }
560560 else if (target.isRef(defn.FloatClass ))
561- return lit(floatFromDigits(digits))
561+ tree.kind match {
562+ case Whole (16 ) => // cant parse hex literal as float
563+ case _ => return lit(floatFromDigits(digits))
564+ }
562565 else if (target.isRef(defn.DoubleClass ))
563- return lit(doubleFromDigits(digits))
566+ tree.kind match {
567+ case Whole (16 ) => // cant parse hex literal as double
568+ case _ => return lit(doubleFromDigits(digits))
569+ }
564570 else if (target.isValueType && isFullyDefined(target, ForceDegree .none)) {
565571 // If expected type is defined with a FromDigits instance, use that one
566572 val fromDigitsCls = tree.kind match {
Original file line number Diff line number Diff line change 1+ @ main def Test =
2+ assert((0x7FFF_FFFF : Float ) == 2.14748365E9f )
3+ assert((0x7FFF_FFFF : Double ) == 2.147483647E9 )
You can’t perform that action at this time.
0 commit comments