Fix parsing of JavaScript number literals out of integer range
Fix KT-17219
This commit is contained in:
@@ -797,7 +797,7 @@ public class TokenStream {
|
|||||||
|
|
||||||
this.number = dval;
|
this.number = dval;
|
||||||
|
|
||||||
if (isInteger) {
|
if (isInteger && this.number >= Integer.MIN_VALUE && this.number <= Integer.MAX_VALUE) {
|
||||||
return NUMBER_INT;
|
return NUMBER_INT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5051,6 +5051,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("numberLiteralOverflow.kt")
|
||||||
|
public void testNumberLiteralOverflow() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/numberLiteralOverflow.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("object.kt")
|
@TestMetadata("object.kt")
|
||||||
public void testObject() throws Exception {
|
public void testObject() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/object.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/object.kt");
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
fun box(): String {
|
||||||
|
val a = js("0xff000000")
|
||||||
|
if (a != 4278190080.0) return "fail1: $a"
|
||||||
|
|
||||||
|
val b = js("-0xff000000")
|
||||||
|
if (b != -4278190080.0) return "fail2: $b"
|
||||||
|
|
||||||
|
val c = js("10000000000")
|
||||||
|
if (c != 10000000000.0) return "fail3: $c"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user