File tree 2 files changed +11
-2
lines changed
compiler/src/dotty/tools/dotc/typer 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
558
558
case _ =>
559
559
}
560
560
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
+ }
562
565
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
+ }
564
570
else if (target.isValueType && isFullyDefined(target, ForceDegree .none)) {
565
571
// If expected type is defined with a FromDigits instance, use that one
566
572
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