Skip to content

Commit

Permalink
LegacyTokenData: relax float check, max as decimal
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Mar 16, 2024
1 parent a83e79e commit 175f5a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 36 deletions.
Expand Up @@ -114,6 +114,6 @@ trait LegacyTokenData {
}

object LegacyTokenData {
private val bigDecimalMaxFloat = BigDecimal(Float.MaxValue)
private val bigDecimalMaxDouble = BigDecimal(Double.MaxValue)
private val bigDecimalMaxFloat = BigDecimal.decimal(Float.MaxValue)
private val bigDecimalMaxDouble = BigDecimal.decimal(Double.MaxValue)
}
Expand Up @@ -389,8 +389,8 @@ class LitSuite extends ParseSuite {
("0L", 0L),
("0x80000000", -2147483648),
("0x8000000000000000L", -9223372036854775808L),
("3.40e+38f", 3.40e+38f),
("-3.40e+38f", -3.40e+38f),
("3.4028235e38f", Float.MaxValue),
("-3.4028235e38f", Float.MinValue),
("1.7976931348623157e+308d", Double.MaxValue),
("-1.7976931348623157e+308d", Double.MinValue),
("0b00101010", 42),
Expand Down Expand Up @@ -476,19 +476,6 @@ class LitSuite extends ParseSuite {
|.f
|^""".stripMargin
),
// these two are actually within range
(
"3.4028235e38f",
"""|<input>:1: error: floating-point value out of range for Float
|3.4028235e38f
|^""".stripMargin
),
(
"-3.4028235e38f",
"""|<input>:1: error: floating-point value out of range for Float
|-3.4028235e38f
| ^""".stripMargin
),
(
"3.4028236e38f",
"""|<input>:1: error: floating-point value out of range for Float
Expand Down
Expand Up @@ -1493,18 +1493,18 @@ class TokenizerSuite extends BaseTokenizerSuite {
|""".stripMargin
),
(
"3.40e+38f",
"3.4028235e38f",
"""|BOF [0..0)
|Constant.Float(3.40e+38f) [0..9)
|EOF [9..9)
|Constant.Float(3.4028235e38f) [0..13)
|EOF [13..13)
|""".stripMargin
),
(
"-3.40e+38f",
"-3.4028235e38f",
"""|BOF [0..0)
|Ident(-) [0..1)
|Constant.Float(3.40e+38f) [1..10)
|EOF [10..10)
|Constant.Float(3.4028235e38f) [1..14)
|EOF [14..14)
|""".stripMargin
),
(
Expand Down Expand Up @@ -1597,19 +1597,6 @@ class TokenizerSuite extends BaseTokenizerSuite {
|0b0123
| ^""".stripMargin
),
// these two are actually within range
(
"3.4028235e38f",
"""|<input>:1: error: floating-point value out of range for Float
|3.4028235e38f
|^""".stripMargin
),
(
"-3.4028235e38f",
"""|<input>:1: error: floating-point value out of range for Float
|-3.4028235e38f
| ^""".stripMargin
),
(
"3.4028236e38f",
"""|<input>:1: error: floating-point value out of range for Float
Expand Down

0 comments on commit 175f5a9

Please sign in to comment.