From 079b96e5b18461322a494e1091ed35abe0a0b182 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 28 Nov 2017 17:47:58 -0800 Subject: [PATCH 01/10] Add support into octal and binary literals --- src/compiler/diagnosticMessages.json | 4 ++ src/compiler/scanner.ts | 15 +++++ .../parser.numericSeperators.binary.js | 12 ++++ .../parser.numericSeperators.binary.symbols | 7 +++ .../parser.numericSeperators.binary.types | 13 ++++ ...umericSeperators.binaryNegative.errors.txt | 59 +++++++++++++++++++ ...parser.numericSeperators.binaryNegative.js | 38 ++++++++++++ ...r.numericSeperators.binaryNegative.symbols | 19 ++++++ ...ser.numericSeperators.binaryNegative.types | 29 +++++++++ .../parser.numericSeperators.octal.js | 12 ++++ .../parser.numericSeperators.octal.symbols | 7 +++ .../parser.numericSeperators.octal.types | 13 ++++ ...numericSeperators.octalNegative.errors.txt | 59 +++++++++++++++++++ .../parser.numericSeperators.octalNegative.js | 38 ++++++++++++ ...er.numericSeperators.octalNegative.symbols | 19 ++++++ ...rser.numericSeperators.octalNegative.types | 29 +++++++++ .../parser.numericSeperators.binary.ts | 4 ++ ...parser.numericSeperators.binaryNegative.ts | 18 ++++++ .../parser.numericSeperators.octal.ts | 4 ++ .../parser.numericSeperators.octalNegative.ts | 18 ++++++ 20 files changed, 417 insertions(+) create mode 100644 tests/baselines/reference/parser.numericSeperators.binary.js create mode 100644 tests/baselines/reference/parser.numericSeperators.binary.symbols create mode 100644 tests/baselines/reference/parser.numericSeperators.binary.types create mode 100644 tests/baselines/reference/parser.numericSeperators.binaryNegative.errors.txt create mode 100644 tests/baselines/reference/parser.numericSeperators.binaryNegative.js create mode 100644 tests/baselines/reference/parser.numericSeperators.binaryNegative.symbols create mode 100644 tests/baselines/reference/parser.numericSeperators.binaryNegative.types create mode 100644 tests/baselines/reference/parser.numericSeperators.octal.js create mode 100644 tests/baselines/reference/parser.numericSeperators.octal.symbols create mode 100644 tests/baselines/reference/parser.numericSeperators.octal.types create mode 100644 tests/baselines/reference/parser.numericSeperators.octalNegative.errors.txt create mode 100644 tests/baselines/reference/parser.numericSeperators.octalNegative.js create mode 100644 tests/baselines/reference/parser.numericSeperators.octalNegative.symbols create mode 100644 tests/baselines/reference/parser.numericSeperators.octalNegative.types create mode 100644 tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binary.ts create mode 100644 tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binaryNegative.ts create mode 100644 tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octal.ts create mode 100644 tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octalNegative.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index cd65bf945f478..3f927834d4da1 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3407,6 +3407,10 @@ "category": "Message", "code": 6187 }, + "Numeric seperators are not allowed at the end of a literal.": { + "category": "Error", + "code": 6188 + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 78df166633c49..6da094ff562c9 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -1218,8 +1218,16 @@ namespace ts { // For counting number of digits; Valid binaryIntegerLiteral must have at least one binary digit following B or b. // Similarly valid octalIntegerLiteral must have at least one octal digit following o or O. let numberOfDigits = 0; + let noSeperatorAllowed = true; while (true) { const ch = text.charCodeAt(pos); + // Numeric seperators are allowed anywhere within a numeric literal, except not at the beginning, or following another seperator + if (!noSeperatorAllowed && ch === CharacterCodes._) { + noSeperatorAllowed = true; + pos++; + continue; + } + noSeperatorAllowed = false; const valueOfCh = ch - CharacterCodes._0; if (!isDigit(ch) || valueOfCh >= base) { break; @@ -1232,6 +1240,13 @@ namespace ts { if (numberOfDigits === 0) { return -1; } + if (text.charCodeAt(pos - 1) === CharacterCodes._) { + // Literal ends with underscore - not allowed + pos--; + error(Diagnostics.Numeric_seperators_are_not_allowed_at_the_end_of_a_literal, 1); + pos++; // Consume character anyway to reduce followon errors from a single erroneous trailing `_`, like `Cannot find name '_'` + return value; + } return value; } diff --git a/tests/baselines/reference/parser.numericSeperators.binary.js b/tests/baselines/reference/parser.numericSeperators.binary.js new file mode 100644 index 0000000000000..4af3cff55ab81 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.binary.js @@ -0,0 +1,12 @@ +//// [parser.numericSeperators.binary.ts] +0b00_11; +0B0_1; +0b1100_0011; +0B0_11_0101; + + +//// [parser.numericSeperators.binary.js] +3; +1; +195; +53; diff --git a/tests/baselines/reference/parser.numericSeperators.binary.symbols b/tests/baselines/reference/parser.numericSeperators.binary.symbols new file mode 100644 index 0000000000000..d98b7676bc31c --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.binary.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binary.ts === +0b00_11; +No type information for this code.0B0_1; +No type information for this code.0b1100_0011; +No type information for this code.0B0_11_0101; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.binary.types b/tests/baselines/reference/parser.numericSeperators.binary.types new file mode 100644 index 0000000000000..b5ee8b7d5267c --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.binary.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binary.ts === +0b00_11; +>0b00_11 : 3 + +0B0_1; +>0B0_1 : 1 + +0b1100_0011; +>0b1100_0011 : 195 + +0B0_11_0101; +>0B0_11_0101 : 53 + diff --git a/tests/baselines/reference/parser.numericSeperators.binaryNegative.errors.txt b/tests/baselines/reference/parser.numericSeperators.binaryNegative.errors.txt new file mode 100644 index 0000000000000..abfdbf3d68f97 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.binaryNegative.errors.txt @@ -0,0 +1,59 @@ +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS1177: Binary digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS2304: Cannot find name '_110'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS2304: Cannot find name '_B0101'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS2304: Cannot find name '_11'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS2304: Cannot find name '_'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS1177: Binary digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. + + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts (1 errors) ==== + 0b00_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts (2 errors) ==== + 0b_110 + +!!! error TS1177: Binary digit expected. + ~~~~ +!!! error TS2304: Cannot find name '_110'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts (2 errors) ==== + 0_B0101 + ~~~~~~ +!!! error TS1005: ';' expected. + ~~~~~~ +!!! error TS2304: Cannot find name '_B0101'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts (3 errors) ==== + 0b01__11 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~ +!!! error TS1005: ';' expected. + ~~~ +!!! error TS2304: Cannot find name '_11'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts (3 errors) ==== + 0B0110_0110__ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS2304: Cannot find name '_'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts (2 errors) ==== + 0b___0111010_0101_1 + +!!! error TS1177: Binary digit expected. + ~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name '___0111010_0101_1'. + \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.binaryNegative.js b/tests/baselines/reference/parser.numericSeperators.binaryNegative.js new file mode 100644 index 0000000000000..e9783f829a7bc --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.binaryNegative.js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binaryNegative.ts] //// + +//// [1.ts] +0b00_ + +//// [2.ts] +0b_110 + +//// [3.ts] +0_B0101 + +//// [4.ts] +0b01__11 + +//// [5.ts] +0B0110_0110__ + +//// [6.ts] +0b___0111010_0101_1 + + +//// [1.js] +0; +//// [2.js] +0; +_110; +//// [3.js] +0; +_B0101; +//// [4.js] +1; +_11; +//// [5.js] +102; +_; +//// [6.js] +0; +___0111010_0101_1; diff --git a/tests/baselines/reference/parser.numericSeperators.binaryNegative.symbols b/tests/baselines/reference/parser.numericSeperators.binaryNegative.symbols new file mode 100644 index 0000000000000..d0d0a141afbb2 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.binaryNegative.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === +0b00_ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === +0b_110 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === +0_B0101 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === +0b01__11 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === +0B0110_0110__ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === +0b___0111010_0101_1 +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.binaryNegative.types b/tests/baselines/reference/parser.numericSeperators.binaryNegative.types new file mode 100644 index 0000000000000..6892fecc2b10c --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.binaryNegative.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === +0b00_ +>0b00_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === +0b_110 +>0b : 0 +>_110 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === +0_B0101 +>0 : 0 +>_B0101 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === +0b01__11 +>0b01_ : 1 +>_11 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === +0B0110_0110__ +>0B0110_0110_ : 102 +>_ : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === +0b___0111010_0101_1 +>0b : 0 +>___0111010_0101_1 : any + diff --git a/tests/baselines/reference/parser.numericSeperators.octal.js b/tests/baselines/reference/parser.numericSeperators.octal.js new file mode 100644 index 0000000000000..322ece02437cc --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.octal.js @@ -0,0 +1,12 @@ +//// [parser.numericSeperators.octal.ts] +0o00_11; +0O0_1; +0o1100_0011; +0O0_11_0101; + + +//// [parser.numericSeperators.octal.js] +9; +1; +2359305; +36929; diff --git a/tests/baselines/reference/parser.numericSeperators.octal.symbols b/tests/baselines/reference/parser.numericSeperators.octal.symbols new file mode 100644 index 0000000000000..5fec3c0c95026 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.octal.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octal.ts === +0o00_11; +No type information for this code.0O0_1; +No type information for this code.0o1100_0011; +No type information for this code.0O0_11_0101; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.octal.types b/tests/baselines/reference/parser.numericSeperators.octal.types new file mode 100644 index 0000000000000..6af4d537b6caf --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.octal.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octal.ts === +0o00_11; +>0o00_11 : 9 + +0O0_1; +>0O0_1 : 1 + +0o1100_0011; +>0o1100_0011 : 2359305 + +0O0_11_0101; +>0O0_11_0101 : 36929 + diff --git a/tests/baselines/reference/parser.numericSeperators.octalNegative.errors.txt b/tests/baselines/reference/parser.numericSeperators.octalNegative.errors.txt new file mode 100644 index 0000000000000..71f0539cc4e2f --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.octalNegative.errors.txt @@ -0,0 +1,59 @@ +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS1178: Octal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS2304: Cannot find name '_110'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS2304: Cannot find name '_O0101'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS2304: Cannot find name '_11'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS2304: Cannot find name '_'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS1178: Octal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. + + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts (1 errors) ==== + 0o00_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts (2 errors) ==== + 0o_110 + +!!! error TS1178: Octal digit expected. + ~~~~ +!!! error TS2304: Cannot find name '_110'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts (2 errors) ==== + 0_O0101 + ~~~~~~ +!!! error TS1005: ';' expected. + ~~~~~~ +!!! error TS2304: Cannot find name '_O0101'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts (3 errors) ==== + 0o01__11 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~ +!!! error TS1005: ';' expected. + ~~~ +!!! error TS2304: Cannot find name '_11'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts (3 errors) ==== + 0O0110_0110__ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS2304: Cannot find name '_'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts (2 errors) ==== + 0o___0111010_0101_1 + +!!! error TS1178: Octal digit expected. + ~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name '___0111010_0101_1'. + \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.octalNegative.js b/tests/baselines/reference/parser.numericSeperators.octalNegative.js new file mode 100644 index 0000000000000..ac7b22a2dd8fa --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.octalNegative.js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octalNegative.ts] //// + +//// [1.ts] +0o00_ + +//// [2.ts] +0o_110 + +//// [3.ts] +0_O0101 + +//// [4.ts] +0o01__11 + +//// [5.ts] +0O0110_0110__ + +//// [6.ts] +0o___0111010_0101_1 + + +//// [1.js] +0; +//// [2.js] +0; +_110; +//// [3.js] +0; +_O0101; +//// [4.js] +1; +_11; +//// [5.js] +294984; +_; +//// [6.js] +0; +___0111010_0101_1; diff --git a/tests/baselines/reference/parser.numericSeperators.octalNegative.symbols b/tests/baselines/reference/parser.numericSeperators.octalNegative.symbols new file mode 100644 index 0000000000000..2cfd7beec8323 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.octalNegative.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === +0o00_ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === +0o_110 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === +0_O0101 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === +0o01__11 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === +0O0110_0110__ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === +0o___0111010_0101_1 +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.octalNegative.types b/tests/baselines/reference/parser.numericSeperators.octalNegative.types new file mode 100644 index 0000000000000..8f7ac1012be0f --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.octalNegative.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === +0o00_ +>0o00_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === +0o_110 +>0o : 0 +>_110 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === +0_O0101 +>0 : 0 +>_O0101 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === +0o01__11 +>0o01_ : 1 +>_11 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === +0O0110_0110__ +>0O0110_0110_ : 294984 +>_ : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === +0o___0111010_0101_1 +>0o : 0 +>___0111010_0101_1 : any + diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binary.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binary.ts new file mode 100644 index 0000000000000..ece8cba27c7ab --- /dev/null +++ b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binary.ts @@ -0,0 +1,4 @@ +0b00_11; +0B0_1; +0b1100_0011; +0B0_11_0101; diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binaryNegative.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binaryNegative.ts new file mode 100644 index 0000000000000..f979ce1b3a04d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binaryNegative.ts @@ -0,0 +1,18 @@ +// @filename: 1.ts +0b00_ + +// @filename: 2.ts +0b_110 + +// @filename: 3.ts +0_B0101 + +// @filename: 4.ts +0b01__11 + +// @filename: 5.ts + +0B0110_0110__ + +// @filename: 6.ts +0b___0111010_0101_1 diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octal.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octal.ts new file mode 100644 index 0000000000000..96372751c7f92 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octal.ts @@ -0,0 +1,4 @@ +0o00_11; +0O0_1; +0o1100_0011; +0O0_11_0101; diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octalNegative.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octalNegative.ts new file mode 100644 index 0000000000000..e7b7f7648b78a --- /dev/null +++ b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octalNegative.ts @@ -0,0 +1,18 @@ +// @filename: 1.ts +0o00_ + +// @filename: 2.ts +0o_110 + +// @filename: 3.ts +0_O0101 + +// @filename: 4.ts +0o01__11 + +// @filename: 5.ts + +0O0110_0110__ + +// @filename: 6.ts +0o___0111010_0101_1 From e214d989fb3542fb722389b278b4d351d9c57c1a Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 28 Nov 2017 18:10:47 -0800 Subject: [PATCH 02/10] Add hex support --- src/compiler/scanner.ts | 22 +++++-- src/compiler/types.ts | 3 +- src/compiler/utilities.ts | 2 +- .../reference/parser.numericSeperators.hex.js | 12 ++++ .../parser.numericSeperators.hex.symbols | 7 +++ .../parser.numericSeperators.hex.types | 13 ++++ ...r.numericSeperators.hexNegative.errors.txt | 59 +++++++++++++++++++ .../parser.numericSeperators.hexNegative.js | 38 ++++++++++++ ...rser.numericSeperators.hexNegative.symbols | 19 ++++++ ...parser.numericSeperators.hexNegative.types | 29 +++++++++ .../parser.numericSeperators.hex.ts | 4 ++ .../parser.numericSeperators.hexNegative.ts | 18 ++++++ 12 files changed, 220 insertions(+), 6 deletions(-) create mode 100644 tests/baselines/reference/parser.numericSeperators.hex.js create mode 100644 tests/baselines/reference/parser.numericSeperators.hex.symbols create mode 100644 tests/baselines/reference/parser.numericSeperators.hex.types create mode 100644 tests/baselines/reference/parser.numericSeperators.hexNegative.errors.txt create mode 100644 tests/baselines/reference/parser.numericSeperators.hexNegative.js create mode 100644 tests/baselines/reference/parser.numericSeperators.hexNegative.symbols create mode 100644 tests/baselines/reference/parser.numericSeperators.hexNegative.types create mode 100644 tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hex.ts create mode 100644 tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hexNegative.ts diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 6da094ff562c9..804e420133f4f 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -909,8 +909,16 @@ namespace ts { function scanHexDigits(minCount: number, scanAsManyAsPossible: boolean): number { let digits = 0; let value = 0; + let seperatorAllowed = false; while (digits < minCount || scanAsManyAsPossible) { const ch = text.charCodeAt(pos); + if (seperatorAllowed && ch === CharacterCodes._) { + seperatorAllowed = false; + tokenFlags |= TokenFlags.ContainsSeperator; + pos++; + continue; + } + seperatorAllowed = true; if (ch >= CharacterCodes._0 && ch <= CharacterCodes._9) { value = value * 16 + ch - CharacterCodes._0; } @@ -929,6 +937,11 @@ namespace ts { if (digits < minCount) { value = -1; } + if (text.charCodeAt(pos - 1) === CharacterCodes._) { + pos--; + error(Diagnostics.Numeric_seperators_are_not_allowed_at_the_end_of_a_literal, 1); + pos++; + } return value; } @@ -1218,16 +1231,17 @@ namespace ts { // For counting number of digits; Valid binaryIntegerLiteral must have at least one binary digit following B or b. // Similarly valid octalIntegerLiteral must have at least one octal digit following o or O. let numberOfDigits = 0; - let noSeperatorAllowed = true; + let seperatorAllowed = false; while (true) { const ch = text.charCodeAt(pos); // Numeric seperators are allowed anywhere within a numeric literal, except not at the beginning, or following another seperator - if (!noSeperatorAllowed && ch === CharacterCodes._) { - noSeperatorAllowed = true; + if (seperatorAllowed && ch === CharacterCodes._) { + seperatorAllowed = false; + tokenFlags |= TokenFlags.ContainsSeperator; pos++; continue; } - noSeperatorAllowed = false; + seperatorAllowed = true; const valueOfCh = ch - CharacterCodes._0; if (!isDigit(ch) || valueOfCh >= base) { break; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c6d1c1327becd..47d845a5455d2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1490,8 +1490,9 @@ namespace ts { HexSpecifier = 1 << 6, // e.g. `0x00000000` BinarySpecifier = 1 << 7, // e.g. `0b0110010000000000` OctalSpecifier = 1 << 8, // e.g. `0o777` + ContainsSeperator = 1 << 9, // e.g. `0b1100_0101` BinaryOrOctalSpecifier = BinarySpecifier | OctalSpecifier, - NumericLiteralFlags = Scientific | Octal | HexSpecifier | BinarySpecifier | OctalSpecifier + NumericLiteralFlags = Scientific | Octal | HexSpecifier | BinarySpecifier | OctalSpecifier | ContainsSeperator } export interface NumericLiteral extends LiteralExpression { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 366c4bc229c97..ae65c0284a6d8 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -345,7 +345,7 @@ namespace ts { export function getLiteralText(node: LiteralLikeNode, sourceFile: SourceFile) { // If we don't need to downlevel and we can reach the original source text using // the node's parent reference, then simply get the text as it was originally written. - if (!nodeIsSynthesized(node) && node.parent) { + if (!nodeIsSynthesized(node) && node.parent && !(isNumericLiteral(node) && node.numericLiteralFlags & TokenFlags.ContainsSeperator)) { return getSourceTextOfNodeFromSourceFile(sourceFile, node); } diff --git a/tests/baselines/reference/parser.numericSeperators.hex.js b/tests/baselines/reference/parser.numericSeperators.hex.js new file mode 100644 index 0000000000000..3822dd0ed0748 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.hex.js @@ -0,0 +1,12 @@ +//// [parser.numericSeperators.hex.ts] +0x00_11; +0X0_1; +0x1100_0011; +0X0_11_0101; + + +//// [parser.numericSeperators.hex.js] +17; +1; +285212689; +1114369; diff --git a/tests/baselines/reference/parser.numericSeperators.hex.symbols b/tests/baselines/reference/parser.numericSeperators.hex.symbols new file mode 100644 index 0000000000000..113de2278e19f --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.hex.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hex.ts === +0x00_11; +No type information for this code.0X0_1; +No type information for this code.0x1100_0011; +No type information for this code.0X0_11_0101; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.hex.types b/tests/baselines/reference/parser.numericSeperators.hex.types new file mode 100644 index 0000000000000..35f2e1204eeef --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.hex.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hex.ts === +0x00_11; +>0x00_11 : 17 + +0X0_1; +>0X0_1 : 1 + +0x1100_0011; +>0x1100_0011 : 285212689 + +0X0_11_0101; +>0X0_11_0101 : 1114369 + diff --git a/tests/baselines/reference/parser.numericSeperators.hexNegative.errors.txt b/tests/baselines/reference/parser.numericSeperators.hexNegative.errors.txt new file mode 100644 index 0000000000000..39182e651ddf9 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.hexNegative.errors.txt @@ -0,0 +1,59 @@ +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS2304: Cannot find name '_110'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS2304: Cannot find name '_X0101'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS2304: Cannot find name '_11'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS2304: Cannot find name '_'. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. + + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts (1 errors) ==== + 0x00_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts (2 errors) ==== + 0x_110 + +!!! error TS1125: Hexadecimal digit expected. + ~~~~ +!!! error TS2304: Cannot find name '_110'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts (2 errors) ==== + 0_X0101 + ~~~~~~ +!!! error TS1005: ';' expected. + ~~~~~~ +!!! error TS2304: Cannot find name '_X0101'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts (3 errors) ==== + 0x01__11 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~ +!!! error TS1005: ';' expected. + ~~~ +!!! error TS2304: Cannot find name '_11'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts (3 errors) ==== + 0X0110_0110__ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS2304: Cannot find name '_'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts (2 errors) ==== + 0x___0111010_0101_1 + +!!! error TS1125: Hexadecimal digit expected. + ~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name '___0111010_0101_1'. + \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.hexNegative.js b/tests/baselines/reference/parser.numericSeperators.hexNegative.js new file mode 100644 index 0000000000000..d75e456937542 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.hexNegative.js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hexNegative.ts] //// + +//// [1.ts] +0x00_ + +//// [2.ts] +0x_110 + +//// [3.ts] +0_X0101 + +//// [4.ts] +0x01__11 + +//// [5.ts] +0X0110_0110__ + +//// [6.ts] +0x___0111010_0101_1 + + +//// [1.js] +0; +//// [2.js] +0x; +_110; +//// [3.js] +0; +_X0101; +//// [4.js] +1; +_11; +//// [5.js] +17826064; +_; +//// [6.js] +0x; +___0111010_0101_1; diff --git a/tests/baselines/reference/parser.numericSeperators.hexNegative.symbols b/tests/baselines/reference/parser.numericSeperators.hexNegative.symbols new file mode 100644 index 0000000000000..b6f21ef42f871 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.hexNegative.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === +0x00_ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === +0x_110 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === +0_X0101 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === +0x01__11 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === +0X0110_0110__ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === +0x___0111010_0101_1 +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.hexNegative.types b/tests/baselines/reference/parser.numericSeperators.hexNegative.types new file mode 100644 index 0000000000000..981623c1423d5 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeperators.hexNegative.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === +0x00_ +>0x00_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === +0x_110 +>0x : 0 +>_110 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === +0_X0101 +>0 : 0 +>_X0101 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === +0x01__11 +>0x01_ : 1 +>_11 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === +0X0110_0110__ +>0X0110_0110_ : 17826064 +>_ : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === +0x___0111010_0101_1 +>0x : 0 +>___0111010_0101_1 : any + diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hex.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hex.ts new file mode 100644 index 0000000000000..03a7de3eae1c4 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hex.ts @@ -0,0 +1,4 @@ +0x00_11; +0X0_1; +0x1100_0011; +0X0_11_0101; diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hexNegative.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hexNegative.ts new file mode 100644 index 0000000000000..96725fd56b310 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hexNegative.ts @@ -0,0 +1,18 @@ +// @filename: 1.ts +0x00_ + +// @filename: 2.ts +0x_110 + +// @filename: 3.ts +0_X0101 + +// @filename: 4.ts +0x01__11 + +// @filename: 5.ts + +0X0110_0110__ + +// @filename: 6.ts +0x___0111010_0101_1 From d980e4a82b6b5d9b783cfb692d6a50c5209d99a9 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 28 Nov 2017 19:05:49 -0800 Subject: [PATCH 03/10] And finally support all numeric literals and fix spelling --- src/compiler/scanner.ts | 66 ++- src/compiler/types.ts | 4 +- src/compiler/utilities.ts | 2 +- .../parser.numericSeparators.binary.js | 12 + ...> parser.numericSeparators.binary.symbols} | 2 +- .../parser.numericSeparators.binary.types | 13 + ...umericSeparators.binaryNegative.errors.txt | 62 +++ ...arser.numericSeparators.binaryNegative.js} | 4 +- ....numericSeparators.binaryNegative.symbols} | 12 +- ...ser.numericSeparators.binaryNegative.types | 29 ++ .../parser.numericSeparators.decimal.js | 32 ++ .../parser.numericSeparators.decimal.symbols | 17 + .../parser.numericSeparators.decimal.types | 43 ++ ...mericSeparators.decmialNegative.errors.txt | 416 ++++++++++++++++++ ...arser.numericSeparators.decmialNegative.js | 264 +++++++++++ ....numericSeparators.decmialNegative.symbols | 139 ++++++ ...er.numericSeparators.decmialNegative.types | 223 ++++++++++ .../reference/parser.numericSeparators.hex.js | 12 + ...s => parser.numericSeparators.hex.symbols} | 2 +- ...pes => parser.numericSeparators.hex.types} | 2 +- ...r.numericSeparators.hexNegative.errors.txt | 62 +++ ...> parser.numericSeparators.hexNegative.js} | 4 +- ...ser.numericSeparators.hexNegative.symbols} | 12 +- ...parser.numericSeparators.hexNegative.types | 29 ++ .../parser.numericSeparators.octal.js | 12 + ...=> parser.numericSeparators.octal.symbols} | 2 +- .../parser.numericSeparators.octal.types | 13 + ...numericSeparators.octalNegative.errors.txt | 62 +++ ...parser.numericSeparators.octalNegative.js} | 4 +- ...r.numericSeparators.octalNegative.symbols} | 12 +- ...rser.numericSeparators.octalNegative.types | 29 ++ .../parser.numericSeperators.binary.js | 12 - .../parser.numericSeperators.binary.types | 13 - ...umericSeperators.binaryNegative.errors.txt | 59 --- ...ser.numericSeperators.binaryNegative.types | 29 -- .../reference/parser.numericSeperators.hex.js | 12 - ...r.numericSeperators.hexNegative.errors.txt | 59 --- ...parser.numericSeperators.hexNegative.types | 29 -- .../parser.numericSeperators.octal.js | 12 - .../parser.numericSeperators.octal.types | 13 - ...numericSeperators.octalNegative.errors.txt | 59 --- ...rser.numericSeperators.octalNegative.types | 29 -- .../parser.numericSeparators.binary.ts} | 0 ...arser.numericSeparators.binaryNegative.ts} | 0 .../parser.numericSeparators.decimal.ts | 14 + ...arser.numericSeparators.decmialNegative.ts | 137 ++++++ .../parser.numericSeparators.hex.ts} | 0 .../parser.numericSeparators.hexNegative.ts} | 0 .../parser.numericSeparators.octal.ts} | 0 ...parser.numericSeparators.octalNegative.ts} | 0 50 files changed, 1708 insertions(+), 366 deletions(-) create mode 100644 tests/baselines/reference/parser.numericSeparators.binary.js rename tests/baselines/reference/{parser.numericSeperators.binary.symbols => parser.numericSeparators.binary.symbols} (65%) create mode 100644 tests/baselines/reference/parser.numericSeparators.binary.types create mode 100644 tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt rename tests/baselines/reference/{parser.numericSeperators.binaryNegative.js => parser.numericSeparators.binaryNegative.js} (62%) rename tests/baselines/reference/{parser.numericSeperators.binaryNegative.symbols => parser.numericSeparators.binaryNegative.symbols} (66%) create mode 100644 tests/baselines/reference/parser.numericSeparators.binaryNegative.types create mode 100644 tests/baselines/reference/parser.numericSeparators.decimal.js create mode 100644 tests/baselines/reference/parser.numericSeparators.decimal.symbols create mode 100644 tests/baselines/reference/parser.numericSeparators.decimal.types create mode 100644 tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt create mode 100644 tests/baselines/reference/parser.numericSeparators.decmialNegative.js create mode 100644 tests/baselines/reference/parser.numericSeparators.decmialNegative.symbols create mode 100644 tests/baselines/reference/parser.numericSeparators.decmialNegative.types create mode 100644 tests/baselines/reference/parser.numericSeparators.hex.js rename tests/baselines/reference/{parser.numericSeperators.hex.symbols => parser.numericSeparators.hex.symbols} (65%) rename tests/baselines/reference/{parser.numericSeperators.hex.types => parser.numericSeparators.hex.types} (50%) create mode 100644 tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt rename tests/baselines/reference/{parser.numericSeperators.hexNegative.js => parser.numericSeparators.hexNegative.js} (63%) rename tests/baselines/reference/{parser.numericSeperators.hexNegative.symbols => parser.numericSeparators.hexNegative.symbols} (66%) create mode 100644 tests/baselines/reference/parser.numericSeparators.hexNegative.types create mode 100644 tests/baselines/reference/parser.numericSeparators.octal.js rename tests/baselines/reference/{parser.numericSeperators.octal.symbols => parser.numericSeparators.octal.symbols} (65%) create mode 100644 tests/baselines/reference/parser.numericSeparators.octal.types create mode 100644 tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt rename tests/baselines/reference/{parser.numericSeperators.octalNegative.js => parser.numericSeparators.octalNegative.js} (63%) rename tests/baselines/reference/{parser.numericSeperators.octalNegative.symbols => parser.numericSeparators.octalNegative.symbols} (66%) create mode 100644 tests/baselines/reference/parser.numericSeparators.octalNegative.types delete mode 100644 tests/baselines/reference/parser.numericSeperators.binary.js delete mode 100644 tests/baselines/reference/parser.numericSeperators.binary.types delete mode 100644 tests/baselines/reference/parser.numericSeperators.binaryNegative.errors.txt delete mode 100644 tests/baselines/reference/parser.numericSeperators.binaryNegative.types delete mode 100644 tests/baselines/reference/parser.numericSeperators.hex.js delete mode 100644 tests/baselines/reference/parser.numericSeperators.hexNegative.errors.txt delete mode 100644 tests/baselines/reference/parser.numericSeperators.hexNegative.types delete mode 100644 tests/baselines/reference/parser.numericSeperators.octal.js delete mode 100644 tests/baselines/reference/parser.numericSeperators.octal.types delete mode 100644 tests/baselines/reference/parser.numericSeperators.octalNegative.errors.txt delete mode 100644 tests/baselines/reference/parser.numericSeperators.octalNegative.types rename tests/cases/conformance/parser/ecmascriptnext/{numericSeperators/parser.numericSeperators.binary.ts => numericSeparators/parser.numericSeparators.binary.ts} (100%) rename tests/cases/conformance/parser/ecmascriptnext/{numericSeperators/parser.numericSeperators.binaryNegative.ts => numericSeparators/parser.numericSeparators.binaryNegative.ts} (100%) create mode 100644 tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decimal.ts create mode 100644 tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decmialNegative.ts rename tests/cases/conformance/parser/ecmascriptnext/{numericSeperators/parser.numericSeperators.hex.ts => numericSeparators/parser.numericSeparators.hex.ts} (100%) rename tests/cases/conformance/parser/ecmascriptnext/{numericSeperators/parser.numericSeperators.hexNegative.ts => numericSeparators/parser.numericSeparators.hexNegative.ts} (100%) rename tests/cases/conformance/parser/ecmascriptnext/{numericSeperators/parser.numericSeperators.octal.ts => numericSeparators/parser.numericSeparators.octal.ts} (100%) rename tests/cases/conformance/parser/ecmascriptnext/{numericSeperators/parser.numericSeperators.octalNegative.ts => numericSeparators/parser.numericSeparators.octalNegative.ts} (100%) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 804e420133f4f..17a8525612e0e 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -858,28 +858,76 @@ namespace ts { } } + function scanNumberFragment(): string { + let start = pos; + let allowSeperator = false; + let result: string; + while (true) { + const ch = text.charCodeAt(pos); + if (allowSeperator && ch === CharacterCodes._) { + allowSeperator = false; + tokenFlags |= TokenFlags.ContainsSeparator; + result = (result || "") + text.substring(start, pos); + pos++; + start = pos; + continue; + } + if (isDigit(ch)) { + allowSeperator = true; + pos++; + continue; + } + break; + } + if (text.charCodeAt(pos - 1) === CharacterCodes._) { + pos--; + error(Diagnostics.Numeric_seperators_are_not_allowed_at_the_end_of_a_literal, 1); + pos++; + } + return result = (result || "") + text.substring(start, pos); + } + function scanNumber(): string { const start = pos; - while (isDigit(text.charCodeAt(pos))) pos++; + const mainFragment = scanNumberFragment(); + let decimalFragment: string; + let scientificFragment: string; if (text.charCodeAt(pos) === CharacterCodes.dot) { pos++; - while (isDigit(text.charCodeAt(pos))) pos++; + decimalFragment = scanNumberFragment(); } let end = pos; if (text.charCodeAt(pos) === CharacterCodes.E || text.charCodeAt(pos) === CharacterCodes.e) { pos++; tokenFlags |= TokenFlags.Scientific; if (text.charCodeAt(pos) === CharacterCodes.plus || text.charCodeAt(pos) === CharacterCodes.minus) pos++; - if (isDigit(text.charCodeAt(pos))) { - pos++; - while (isDigit(text.charCodeAt(pos))) pos++; + const preNumericPart = pos; + const finalFragment = scanNumberFragment(); + if (!finalFragment) { + error(Diagnostics.Digit_expected); + } + else { + scientificFragment = text.substring(end, preNumericPart) + finalFragment; end = pos; } + } + if (tokenFlags & TokenFlags.ContainsSeparator) { + if (decimalFragment && scientificFragment) { + return "" + +(mainFragment + "." + decimalFragment + scientificFragment); + } + else if (decimalFragment) { + return "" + +(mainFragment + "." + decimalFragment); + } + else if (scientificFragment) { + return "" + +(mainFragment + scientificFragment); + } else { - error(Diagnostics.Digit_expected); + return "" + +mainFragment; } } - return "" + +(text.substring(start, end)); + else { + return "" + +(text.substring(start, end)); // No need to use all the fragments; no _ removal needed + } } function scanOctalDigits(): number { @@ -914,7 +962,7 @@ namespace ts { const ch = text.charCodeAt(pos); if (seperatorAllowed && ch === CharacterCodes._) { seperatorAllowed = false; - tokenFlags |= TokenFlags.ContainsSeperator; + tokenFlags |= TokenFlags.ContainsSeparator; pos++; continue; } @@ -1237,7 +1285,7 @@ namespace ts { // Numeric seperators are allowed anywhere within a numeric literal, except not at the beginning, or following another seperator if (seperatorAllowed && ch === CharacterCodes._) { seperatorAllowed = false; - tokenFlags |= TokenFlags.ContainsSeperator; + tokenFlags |= TokenFlags.ContainsSeparator; pos++; continue; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 47d845a5455d2..55c1277b05727 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1490,9 +1490,9 @@ namespace ts { HexSpecifier = 1 << 6, // e.g. `0x00000000` BinarySpecifier = 1 << 7, // e.g. `0b0110010000000000` OctalSpecifier = 1 << 8, // e.g. `0o777` - ContainsSeperator = 1 << 9, // e.g. `0b1100_0101` + ContainsSeparator = 1 << 9, // e.g. `0b1100_0101` BinaryOrOctalSpecifier = BinarySpecifier | OctalSpecifier, - NumericLiteralFlags = Scientific | Octal | HexSpecifier | BinarySpecifier | OctalSpecifier | ContainsSeperator + NumericLiteralFlags = Scientific | Octal | HexSpecifier | BinarySpecifier | OctalSpecifier | ContainsSeparator } export interface NumericLiteral extends LiteralExpression { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ae65c0284a6d8..8eba35cad363a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -345,7 +345,7 @@ namespace ts { export function getLiteralText(node: LiteralLikeNode, sourceFile: SourceFile) { // If we don't need to downlevel and we can reach the original source text using // the node's parent reference, then simply get the text as it was originally written. - if (!nodeIsSynthesized(node) && node.parent && !(isNumericLiteral(node) && node.numericLiteralFlags & TokenFlags.ContainsSeperator)) { + if (!nodeIsSynthesized(node) && node.parent && !(isNumericLiteral(node) && node.numericLiteralFlags & TokenFlags.ContainsSeparator)) { return getSourceTextOfNodeFromSourceFile(sourceFile, node); } diff --git a/tests/baselines/reference/parser.numericSeparators.binary.js b/tests/baselines/reference/parser.numericSeparators.binary.js new file mode 100644 index 0000000000000..dada25e96e620 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.binary.js @@ -0,0 +1,12 @@ +//// [parser.numericSeparators.binary.ts] +0b00_11; +0B0_1; +0b1100_0011; +0B0_11_0101; + + +//// [parser.numericSeparators.binary.js] +3; +1; +195; +53; diff --git a/tests/baselines/reference/parser.numericSeperators.binary.symbols b/tests/baselines/reference/parser.numericSeparators.binary.symbols similarity index 65% rename from tests/baselines/reference/parser.numericSeperators.binary.symbols rename to tests/baselines/reference/parser.numericSeparators.binary.symbols index d98b7676bc31c..548836c3a3a52 100644 --- a/tests/baselines/reference/parser.numericSeperators.binary.symbols +++ b/tests/baselines/reference/parser.numericSeparators.binary.symbols @@ -1,4 +1,4 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binary.ts === +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.binary.ts === 0b00_11; No type information for this code.0B0_1; No type information for this code.0b1100_0011; diff --git a/tests/baselines/reference/parser.numericSeparators.binary.types b/tests/baselines/reference/parser.numericSeparators.binary.types new file mode 100644 index 0000000000000..44a859385f048 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.binary.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.binary.ts === +0b00_11; +>0b00_11 : 3 + +0B0_1; +>0B0_1 : 1 + +0b1100_0011; +>0b1100_0011 : 195 + +0B0_11_0101; +>0B0_11_0101 : 53 + diff --git a/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt new file mode 100644 index 0000000000000..254fa138e243f --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt @@ -0,0 +1,62 @@ +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS1177: Binary digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS2304: Cannot find name '_110'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'B0101'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS2304: Cannot find name '_11'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS2304: Cannot find name '_'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS1177: Binary digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. + + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== + 0b00_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (2 errors) ==== + 0b_110 + +!!! error TS1177: Binary digit expected. + ~~~~ +!!! error TS2304: Cannot find name '_110'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== + 0_B0101 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~~~ +!!! error TS1005: ';' expected. + ~~~~~ +!!! error TS2304: Cannot find name 'B0101'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (3 errors) ==== + 0b01__11 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~ +!!! error TS1005: ';' expected. + ~~~ +!!! error TS2304: Cannot find name '_11'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (3 errors) ==== + 0B0110_0110__ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS2304: Cannot find name '_'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (2 errors) ==== + 0b___0111010_0101_1 + +!!! error TS1177: Binary digit expected. + ~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name '___0111010_0101_1'. + \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.binaryNegative.js b/tests/baselines/reference/parser.numericSeparators.binaryNegative.js similarity index 62% rename from tests/baselines/reference/parser.numericSeperators.binaryNegative.js rename to tests/baselines/reference/parser.numericSeparators.binaryNegative.js index e9783f829a7bc..0b56b65cb7a4a 100644 --- a/tests/baselines/reference/parser.numericSeperators.binaryNegative.js +++ b/tests/baselines/reference/parser.numericSeparators.binaryNegative.js @@ -1,4 +1,4 @@ -//// [tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binaryNegative.ts] //// +//// [tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.binaryNegative.ts] //// //// [1.ts] 0b00_ @@ -26,7 +26,7 @@ _110; //// [3.js] 0; -_B0101; +B0101; //// [4.js] 1; _11; diff --git a/tests/baselines/reference/parser.numericSeperators.binaryNegative.symbols b/tests/baselines/reference/parser.numericSeparators.binaryNegative.symbols similarity index 66% rename from tests/baselines/reference/parser.numericSeperators.binaryNegative.symbols rename to tests/baselines/reference/parser.numericSeparators.binaryNegative.symbols index d0d0a141afbb2..a637eaa687a54 100644 --- a/tests/baselines/reference/parser.numericSeperators.binaryNegative.symbols +++ b/tests/baselines/reference/parser.numericSeparators.binaryNegative.symbols @@ -1,19 +1,19 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts === 0b00_ No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === 0b_110 No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === 0_B0101 No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === 0b01__11 No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === 0B0110_0110__ No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === 0b___0111010_0101_1 No type information for this code. No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.binaryNegative.types b/tests/baselines/reference/parser.numericSeparators.binaryNegative.types new file mode 100644 index 0000000000000..a6a70bf99daa3 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.binaryNegative.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts === +0b00_ +>0b00_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === +0b_110 +>0b : 0 +>_110 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === +0_B0101 +>0_ : 0 +>B0101 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === +0b01__11 +>0b01_ : 1 +>_11 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === +0B0110_0110__ +>0B0110_0110_ : 102 +>_ : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === +0b___0111010_0101_1 +>0b : 0 +>___0111010_0101_1 : any + diff --git a/tests/baselines/reference/parser.numericSeparators.decimal.js b/tests/baselines/reference/parser.numericSeparators.decimal.js new file mode 100644 index 0000000000000..9def2bf47f7cc --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.decimal.js @@ -0,0 +1,32 @@ +//// [parser.numericSeparators.decimal.ts] +1_000_000_000 +1.1_00_01 +1e1_0 +1e+1_0 +1e-1_0 +1.1e10_0 +1.1e+10_0 +1.1e-10_0 +12_34_56 +1_22_333 +1_2.3_4 +1_2.3_4e5_6 +1_2.3_4e+5_6 +1_2.3_4e-5_6 + + +//// [parser.numericSeparators.decimal.js] +1000000000; +1.10001; +10000000000; +10000000000; +1e-10; +1.1e+100; +1.1e+100; +1.1e-100; +123456; +122333; +12.34; +1.234e+57; +1.234e+57; +1.234e-55; diff --git a/tests/baselines/reference/parser.numericSeparators.decimal.symbols b/tests/baselines/reference/parser.numericSeparators.decimal.symbols new file mode 100644 index 0000000000000..0e0cf2d17421b --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.decimal.symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decimal.ts === +1_000_000_000 +No type information for this code.1.1_00_01 +No type information for this code.1e1_0 +No type information for this code.1e+1_0 +No type information for this code.1e-1_0 +No type information for this code.1.1e10_0 +No type information for this code.1.1e+10_0 +No type information for this code.1.1e-10_0 +No type information for this code.12_34_56 +No type information for this code.1_22_333 +No type information for this code.1_2.3_4 +No type information for this code.1_2.3_4e5_6 +No type information for this code.1_2.3_4e+5_6 +No type information for this code.1_2.3_4e-5_6 +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.decimal.types b/tests/baselines/reference/parser.numericSeparators.decimal.types new file mode 100644 index 0000000000000..f8537553dd016 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.decimal.types @@ -0,0 +1,43 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decimal.ts === +1_000_000_000 +>1_000_000_000 : 1000000000 + +1.1_00_01 +>1.1_00_01 : 1.10001 + +1e1_0 +>1e1_0 : 10000000000 + +1e+1_0 +>1e+1_0 : 10000000000 + +1e-1_0 +>1e-1_0 : 1e-10 + +1.1e10_0 +>1.1e10_0 : 1.1e+100 + +1.1e+10_0 +>1.1e+10_0 : 1.1e+100 + +1.1e-10_0 +>1.1e-10_0 : 1.1e-100 + +12_34_56 +>12_34_56 : 123456 + +1_22_333 +>1_22_333 : 122333 + +1_2.3_4 +>1_2.3_4 : 12.34 + +1_2.3_4e5_6 +>1_2.3_4e5_6 : 1.234e+57 + +1_2.3_4e+5_6 +>1_2.3_4e+5_6 : 1.234e+57 + +1_2.3_4e-5_6 +>1_2.3_4e-5_6 : 1.234e-55 + diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt new file mode 100644 index 0000000000000..85fccd838e903 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt @@ -0,0 +1,416 @@ +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,1): error TS2304: Cannot find name '_10'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,5): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,5): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts(1,3): error TS2304: Cannot find name '_0e0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts(1,5): error TS1124: Digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts(1,5): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts(1,1): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts(1,6): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,3): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,5): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,5): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,5): error TS2304: Cannot find name '_0e0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts(1,7): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts(1,8): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts(1,8): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts(1,4): error TS1124: Digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts(1,4): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts(1,6): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts(1,6): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts(1,3): error TS2304: Cannot find name '_0e'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts(1,6): error TS1124: Digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts(1,6): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts(1,1): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/30.ts(1,7): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,3): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,5): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts(1,5): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts(1,5): error TS2304: Cannot find name '_0e'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts(1,8): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts(1,9): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts(1,9): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts(1,4): error TS1124: Digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts(1,4): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,6): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,6): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts(1,3): error TS2304: Cannot find name '_0e'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts(1,6): error TS1124: Digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts(1,6): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts(1,1): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts(1,7): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,3): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,5): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,5): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,5): error TS2304: Cannot find name '_0e'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,8): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,9): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,9): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,3): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,5): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,5): error TS2304: Cannot find name '_'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error TS1124: Digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error TS2304: Cannot find name '_0'. + + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== + _10 + ~~~ +!!! error TS2304: Cannot find name '_10'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (1 errors) ==== + 10_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== + 1__0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (1 errors) ==== + 0_.0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (2 errors) ==== + 0._0 + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (3 errors) ==== + 0.0__0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts (3 errors) ==== + 0.0__ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS2304: Cannot find name '_'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts (1 errors) ==== + 0_e0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts (2 errors) ==== + 0e_0 + +!!! error TS1124: Digit expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts (1 errors) ==== + 0e0_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts (3 errors) ==== + 0e0__0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts (1 errors) ==== + 0_.0e0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts (2 errors) ==== + 0._0e0 + ~~~~ +!!! error TS1005: ';' expected. + ~~~~ +!!! error TS2304: Cannot find name '_0e0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts (1 errors) ==== + 0.0_e0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts (2 errors) ==== + 0.0e_0 + +!!! error TS1124: Digit expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts (2 errors) ==== + _0.0e0 + ~~ +!!! error TS2304: Cannot find name '_0'. + ~~~~ +!!! error TS1005: ';' expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts (1 errors) ==== + 0.0e0_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts (4 errors) ==== + 0__0.0e0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + ~~~~ +!!! error TS1005: ';' expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts (3 errors) ==== + 0.0__0e0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~~ +!!! error TS1005: ';' expected. + ~~~~ +!!! error TS2304: Cannot find name '_0e0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts (3 errors) ==== + 0.00e0__0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts (1 errors) ==== + 0_e+0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts (2 errors) ==== + 0e+_0 + +!!! error TS1124: Digit expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts (1 errors) ==== + 0e+0_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts (3 errors) ==== + 0e+0__0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts (1 errors) ==== + 0_.0e+0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts (2 errors) ==== + 0._0e+0 + ~~~ +!!! error TS1005: ';' expected. + ~~~ +!!! error TS2304: Cannot find name '_0e'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts (1 errors) ==== + 0.0_e+0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts (2 errors) ==== + 0.0e+_0 + +!!! error TS1124: Digit expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts (2 errors) ==== + _0.0e+0 + ~~ +!!! error TS2304: Cannot find name '_0'. + ~~~~~ +!!! error TS1005: ';' expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/30.ts (1 errors) ==== + 0.0e+0_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts (4 errors) ==== + 0__0.0e+0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + ~~~~~ +!!! error TS1005: ';' expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts (3 errors) ==== + 0.0__0e+0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~ +!!! error TS1005: ';' expected. + ~~~ +!!! error TS2304: Cannot find name '_0e'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts (3 errors) ==== + 0.00e+0__0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts (1 errors) ==== + 0_e+0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts (2 errors) ==== + 0e-_0 + +!!! error TS1124: Digit expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts (1 errors) ==== + 0e-0_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts (3 errors) ==== + 0e-0__0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts (1 errors) ==== + 0_.0e-0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts (2 errors) ==== + 0._0e-0 + ~~~ +!!! error TS1005: ';' expected. + ~~~ +!!! error TS2304: Cannot find name '_0e'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts (1 errors) ==== + 0.0_e-0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts (2 errors) ==== + 0.0e-_0 + +!!! error TS1124: Digit expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts (2 errors) ==== + _0.0e-0 + ~~ +!!! error TS2304: Cannot find name '_0'. + ~~~~~ +!!! error TS1005: ';' expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts (1 errors) ==== + 0.0e-0_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts (4 errors) ==== + 0__0.0e-0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + ~~~~~ +!!! error TS1005: ';' expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts (3 errors) ==== + 0.0__0e-0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~ +!!! error TS1005: ';' expected. + ~~~ +!!! error TS2304: Cannot find name '_0e'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts (3 errors) ==== + 0.00e-0__0 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~ +!!! error TS1005: ';' expected. + ~~ +!!! error TS2304: Cannot find name '_0'. + \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.js b/tests/baselines/reference/parser.numericSeparators.decmialNegative.js new file mode 100644 index 0000000000000..cfe2b879cb6bb --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.js @@ -0,0 +1,264 @@ +//// [tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decmialNegative.ts] //// + +//// [1.ts] +_10 + +//// [2.ts] +10_ + +//// [3.ts] +1__0 + +//// [4.ts] +0_.0 + +//// [5.ts] +0._0 + +//// [6.ts] +0.0__0 + +//// [7.ts] +0.0__ + +//// [8.ts] +0_e0 + +//// [9.ts] +0e_0 + +//// [10.ts] +0e0_ + +//// [11.ts] +0e0__0 + +//// [12.ts] +0_.0e0 + +//// [13.ts] +0._0e0 + +//// [14.ts] +0.0_e0 + +//// [15.ts] +0.0e_0 + +//// [16.ts] +_0.0e0 + +//// [17.ts] +0.0e0_ + +//// [18.ts] +0__0.0e0 + +//// [19.ts] +0.0__0e0 + +//// [20.ts] +0.00e0__0 + +//// [21.ts] +0_e+0 + +//// [22.ts] +0e+_0 + +//// [23.ts] +0e+0_ + +//// [24.ts] +0e+0__0 + +//// [25.ts] +0_.0e+0 + +//// [26.ts] +0._0e+0 + +//// [27.ts] +0.0_e+0 + +//// [28.ts] +0.0e+_0 + +//// [29.ts] +_0.0e+0 + +//// [30.ts] +0.0e+0_ + +//// [31.ts] +0__0.0e+0 + +//// [32.ts] +0.0__0e+0 + +//// [33.ts] +0.00e+0__0 + +//// [34.ts] +0_e+0 + +//// [35.ts] +0e-_0 + +//// [36.ts] +0e-0_ + +//// [37.ts] +0e-0__0 + +//// [38.ts] +0_.0e-0 + +//// [39.ts] +0._0e-0 + +//// [40.ts] +0.0_e-0 + +//// [41.ts] +0.0e-_0 + +//// [42.ts] +_0.0e-0 + +//// [43.ts] +0.0e-0_ + +//// [44.ts] +0__0.0e-0 + +//// [45.ts] +0.0__0e-0 + +//// [46.ts] +0.00e-0__0 + + +//// [1.js] +_10; +//// [2.js] +10; +//// [3.js] +1; +_0; +//// [4.js] +0; +//// [5.js] +0.; +_0; +//// [6.js] +0; +_0; +//// [7.js] +0; +_; +//// [8.js] +0; +//// [9.js] +0e; +_0; +//// [10.js] +0; +//// [11.js] +0; +_0; +//// [12.js] +0; +//// [13.js] +0.; +_0e0; +//// [14.js] +0; +//// [15.js] +0.0e; +_0; +//// [16.js] +_0; +.0e0; +//// [17.js] +0; +//// [18.js] +0; +_0; +.0e0; +//// [19.js] +0; +_0e0; +//// [20.js] +0; +_0; +//// [21.js] +0; +//// [22.js] +0e+; +_0; +//// [23.js] +0; +//// [24.js] +0; +_0; +//// [25.js] +0; +//// [26.js] +0.; +_0e + 0; +//// [27.js] +0; +//// [28.js] +0.0e+; +_0; +//// [29.js] +_0; +.0e+0; +//// [30.js] +0; +//// [31.js] +0; +_0; +.0e+0; +//// [32.js] +0; +_0e + 0; +//// [33.js] +0; +_0; +//// [34.js] +0; +//// [35.js] +0e-; +_0; +//// [36.js] +0; +//// [37.js] +0; +_0; +//// [38.js] +0; +//// [39.js] +0.; +_0e - 0; +//// [40.js] +0; +//// [41.js] +0.0e-; +_0; +//// [42.js] +_0; +.0e-0; +//// [43.js] +0; +//// [44.js] +0; +_0; +.0e-0; +//// [45.js] +0; +_0e - 0; +//// [46.js] +0; +_0; diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.symbols b/tests/baselines/reference/parser.numericSeparators.decmialNegative.symbols new file mode 100644 index 0000000000000..a6257790851c6 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.symbols @@ -0,0 +1,139 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts === +_10 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === +10_ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === +1__0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === +0_.0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === +0._0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === +0.0__0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts === +0.0__ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts === +0_e0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts === +0e_0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts === +0e0_ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts === +0e0__0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts === +0_.0e0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts === +0._0e0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts === +0.0_e0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts === +0.0e_0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts === +_0.0e0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts === +0.0e0_ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts === +0__0.0e0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts === +0.0__0e0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts === +0.00e0__0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts === +0_e+0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts === +0e+_0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts === +0e+0_ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts === +0e+0__0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts === +0_.0e+0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts === +0._0e+0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts === +0.0_e+0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts === +0.0e+_0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts === +_0.0e+0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/30.ts === +0.0e+0_ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts === +0__0.0e+0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts === +0.0__0e+0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts === +0.00e+0__0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts === +0_e+0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts === +0e-_0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts === +0e-0_ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts === +0e-0__0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts === +0_.0e-0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts === +0._0e-0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts === +0.0_e-0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts === +0.0e-_0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts === +_0.0e-0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts === +0.0e-0_ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts === +0__0.0e-0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts === +0.0__0e-0 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts === +0.00e-0__0 +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.types b/tests/baselines/reference/parser.numericSeparators.decmialNegative.types new file mode 100644 index 0000000000000..e0aa57e54683c --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.types @@ -0,0 +1,223 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts === +_10 +>_10 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === +10_ +>10_ : 10 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === +1__0 +>1_ : 1 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === +0_.0 +>0_.0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === +0._0 +>0. : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === +0.0__0 +>0.0_ : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts === +0.0__ +>0.0_ : 0 +>_ : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts === +0_e0 +>0_e0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts === +0e_0 +>0e : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts === +0e0_ +>0e0_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts === +0e0__0 +>0e0_ : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts === +0_.0e0 +>0_.0e0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts === +0._0e0 +>0. : 0 +>_0e0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts === +0.0_e0 +>0.0_e0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts === +0.0e_0 +>0.0e : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts === +_0.0e0 +>_0 : any +>.0e0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts === +0.0e0_ +>0.0e0_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts === +0__0.0e0 +>0_ : 0 +>_0 : any +>.0e0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts === +0.0__0e0 +>0.0_ : 0 +>_0e0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts === +0.00e0__0 +>0.00e0_ : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts === +0_e+0 +>0_e+0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts === +0e+_0 +>0e+ : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts === +0e+0_ +>0e+0_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts === +0e+0__0 +>0e+0_ : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts === +0_.0e+0 +>0_.0e+0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts === +0._0e+0 +>0. : 0 +>_0e+0 : any +>_0e : any +>0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts === +0.0_e+0 +>0.0_e+0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts === +0.0e+_0 +>0.0e+ : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts === +_0.0e+0 +>_0 : any +>.0e+0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/30.ts === +0.0e+0_ +>0.0e+0_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts === +0__0.0e+0 +>0_ : 0 +>_0 : any +>.0e+0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts === +0.0__0e+0 +>0.0_ : 0 +>_0e+0 : any +>_0e : any +>0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts === +0.00e+0__0 +>0.00e+0_ : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts === +0_e+0 +>0_e+0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts === +0e-_0 +>0e- : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts === +0e-0_ +>0e-0_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts === +0e-0__0 +>0e-0_ : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts === +0_.0e-0 +>0_.0e-0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts === +0._0e-0 +>0. : 0 +>_0e-0 : number +>_0e : any +>0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts === +0.0_e-0 +>0.0_e-0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts === +0.0e-_0 +>0.0e- : 0 +>_0 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts === +_0.0e-0 +>_0 : any +>.0e-0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts === +0.0e-0_ +>0.0e-0_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts === +0__0.0e-0 +>0_ : 0 +>_0 : any +>.0e-0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts === +0.0__0e-0 +>0.0_ : 0 +>_0e-0 : number +>_0e : any +>0 : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts === +0.00e-0__0 +>0.00e-0_ : 0 +>_0 : any + diff --git a/tests/baselines/reference/parser.numericSeparators.hex.js b/tests/baselines/reference/parser.numericSeparators.hex.js new file mode 100644 index 0000000000000..ffa64ec552d77 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.hex.js @@ -0,0 +1,12 @@ +//// [parser.numericSeparators.hex.ts] +0x00_11; +0X0_1; +0x1100_0011; +0X0_11_0101; + + +//// [parser.numericSeparators.hex.js] +17; +1; +285212689; +1114369; diff --git a/tests/baselines/reference/parser.numericSeperators.hex.symbols b/tests/baselines/reference/parser.numericSeparators.hex.symbols similarity index 65% rename from tests/baselines/reference/parser.numericSeperators.hex.symbols rename to tests/baselines/reference/parser.numericSeparators.hex.symbols index 113de2278e19f..9c8a5176cdae0 100644 --- a/tests/baselines/reference/parser.numericSeperators.hex.symbols +++ b/tests/baselines/reference/parser.numericSeparators.hex.symbols @@ -1,4 +1,4 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hex.ts === +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.hex.ts === 0x00_11; No type information for this code.0X0_1; No type information for this code.0x1100_0011; diff --git a/tests/baselines/reference/parser.numericSeperators.hex.types b/tests/baselines/reference/parser.numericSeparators.hex.types similarity index 50% rename from tests/baselines/reference/parser.numericSeperators.hex.types rename to tests/baselines/reference/parser.numericSeparators.hex.types index 35f2e1204eeef..25830f414b1b3 100644 --- a/tests/baselines/reference/parser.numericSeperators.hex.types +++ b/tests/baselines/reference/parser.numericSeparators.hex.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hex.ts === +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.hex.ts === 0x00_11; >0x00_11 : 17 diff --git a/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt new file mode 100644 index 0000000000000..3dacf30d7ba04 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt @@ -0,0 +1,62 @@ +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS2304: Cannot find name '_110'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'X0101'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS2304: Cannot find name '_11'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS2304: Cannot find name '_'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. + + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== + 0x00_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (2 errors) ==== + 0x_110 + +!!! error TS1125: Hexadecimal digit expected. + ~~~~ +!!! error TS2304: Cannot find name '_110'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== + 0_X0101 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~~~ +!!! error TS1005: ';' expected. + ~~~~~ +!!! error TS2304: Cannot find name 'X0101'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (3 errors) ==== + 0x01__11 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~ +!!! error TS1005: ';' expected. + ~~~ +!!! error TS2304: Cannot find name '_11'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (3 errors) ==== + 0X0110_0110__ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS2304: Cannot find name '_'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (2 errors) ==== + 0x___0111010_0101_1 + +!!! error TS1125: Hexadecimal digit expected. + ~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name '___0111010_0101_1'. + \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.hexNegative.js b/tests/baselines/reference/parser.numericSeparators.hexNegative.js similarity index 63% rename from tests/baselines/reference/parser.numericSeperators.hexNegative.js rename to tests/baselines/reference/parser.numericSeparators.hexNegative.js index d75e456937542..81f1463fc919c 100644 --- a/tests/baselines/reference/parser.numericSeperators.hexNegative.js +++ b/tests/baselines/reference/parser.numericSeparators.hexNegative.js @@ -1,4 +1,4 @@ -//// [tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hexNegative.ts] //// +//// [tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.hexNegative.ts] //// //// [1.ts] 0x00_ @@ -26,7 +26,7 @@ _110; //// [3.js] 0; -_X0101; +X0101; //// [4.js] 1; _11; diff --git a/tests/baselines/reference/parser.numericSeperators.hexNegative.symbols b/tests/baselines/reference/parser.numericSeparators.hexNegative.symbols similarity index 66% rename from tests/baselines/reference/parser.numericSeperators.hexNegative.symbols rename to tests/baselines/reference/parser.numericSeparators.hexNegative.symbols index b6f21ef42f871..f69f51519fb1a 100644 --- a/tests/baselines/reference/parser.numericSeperators.hexNegative.symbols +++ b/tests/baselines/reference/parser.numericSeparators.hexNegative.symbols @@ -1,19 +1,19 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts === 0x00_ No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === 0x_110 No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === 0_X0101 No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === 0x01__11 No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === 0X0110_0110__ No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === 0x___0111010_0101_1 No type information for this code. No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.hexNegative.types b/tests/baselines/reference/parser.numericSeparators.hexNegative.types new file mode 100644 index 0000000000000..f4ce73a05a4df --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.hexNegative.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts === +0x00_ +>0x00_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === +0x_110 +>0x : 0 +>_110 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === +0_X0101 +>0_ : 0 +>X0101 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === +0x01__11 +>0x01_ : 1 +>_11 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === +0X0110_0110__ +>0X0110_0110_ : 17826064 +>_ : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === +0x___0111010_0101_1 +>0x : 0 +>___0111010_0101_1 : any + diff --git a/tests/baselines/reference/parser.numericSeparators.octal.js b/tests/baselines/reference/parser.numericSeparators.octal.js new file mode 100644 index 0000000000000..fa8d49db8fdd2 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.octal.js @@ -0,0 +1,12 @@ +//// [parser.numericSeparators.octal.ts] +0o00_11; +0O0_1; +0o1100_0011; +0O0_11_0101; + + +//// [parser.numericSeparators.octal.js] +9; +1; +2359305; +36929; diff --git a/tests/baselines/reference/parser.numericSeperators.octal.symbols b/tests/baselines/reference/parser.numericSeparators.octal.symbols similarity index 65% rename from tests/baselines/reference/parser.numericSeperators.octal.symbols rename to tests/baselines/reference/parser.numericSeparators.octal.symbols index 5fec3c0c95026..a69900ae50f1a 100644 --- a/tests/baselines/reference/parser.numericSeperators.octal.symbols +++ b/tests/baselines/reference/parser.numericSeparators.octal.symbols @@ -1,4 +1,4 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octal.ts === +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.octal.ts === 0o00_11; No type information for this code.0O0_1; No type information for this code.0o1100_0011; diff --git a/tests/baselines/reference/parser.numericSeparators.octal.types b/tests/baselines/reference/parser.numericSeparators.octal.types new file mode 100644 index 0000000000000..18f0b5bd0f23b --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.octal.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.octal.ts === +0o00_11; +>0o00_11 : 9 + +0O0_1; +>0O0_1 : 1 + +0o1100_0011; +>0o1100_0011 : 2359305 + +0O0_11_0101; +>0O0_11_0101 : 36929 + diff --git a/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt new file mode 100644 index 0000000000000..e72c2ee7f5575 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt @@ -0,0 +1,62 @@ +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS1178: Octal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS2304: Cannot find name '_110'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'O0101'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS2304: Cannot find name '_11'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS2304: Cannot find name '_'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS1178: Octal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. + + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== + 0o00_ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (2 errors) ==== + 0o_110 + +!!! error TS1178: Octal digit expected. + ~~~~ +!!! error TS2304: Cannot find name '_110'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== + 0_O0101 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~~~ +!!! error TS1005: ';' expected. + ~~~~~ +!!! error TS2304: Cannot find name 'O0101'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (3 errors) ==== + 0o01__11 + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~~~ +!!! error TS1005: ';' expected. + ~~~ +!!! error TS2304: Cannot find name '_11'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (3 errors) ==== + 0O0110_0110__ + ~ +!!! error TS6188: Numeric seperators are not allowed at the end of a literal. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS2304: Cannot find name '_'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (2 errors) ==== + 0o___0111010_0101_1 + +!!! error TS1178: Octal digit expected. + ~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name '___0111010_0101_1'. + \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.octalNegative.js b/tests/baselines/reference/parser.numericSeparators.octalNegative.js similarity index 63% rename from tests/baselines/reference/parser.numericSeperators.octalNegative.js rename to tests/baselines/reference/parser.numericSeparators.octalNegative.js index ac7b22a2dd8fa..484833c11a02f 100644 --- a/tests/baselines/reference/parser.numericSeperators.octalNegative.js +++ b/tests/baselines/reference/parser.numericSeparators.octalNegative.js @@ -1,4 +1,4 @@ -//// [tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octalNegative.ts] //// +//// [tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.octalNegative.ts] //// //// [1.ts] 0o00_ @@ -26,7 +26,7 @@ _110; //// [3.js] 0; -_O0101; +O0101; //// [4.js] 1; _11; diff --git a/tests/baselines/reference/parser.numericSeperators.octalNegative.symbols b/tests/baselines/reference/parser.numericSeparators.octalNegative.symbols similarity index 66% rename from tests/baselines/reference/parser.numericSeperators.octalNegative.symbols rename to tests/baselines/reference/parser.numericSeparators.octalNegative.symbols index 2cfd7beec8323..212331d001097 100644 --- a/tests/baselines/reference/parser.numericSeperators.octalNegative.symbols +++ b/tests/baselines/reference/parser.numericSeparators.octalNegative.symbols @@ -1,19 +1,19 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts === 0o00_ No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === 0o_110 No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === 0_O0101 No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === 0o01__11 No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === 0O0110_0110__ No type information for this code. -No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === 0o___0111010_0101_1 No type information for this code. No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.octalNegative.types b/tests/baselines/reference/parser.numericSeparators.octalNegative.types new file mode 100644 index 0000000000000..bf614c0d2b2ac --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.octalNegative.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts === +0o00_ +>0o00_ : 0 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === +0o_110 +>0o : 0 +>_110 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === +0_O0101 +>0_ : 0 +>O0101 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === +0o01__11 +>0o01_ : 1 +>_11 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === +0O0110_0110__ +>0O0110_0110_ : 294984 +>_ : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === +0o___0111010_0101_1 +>0o : 0 +>___0111010_0101_1 : any + diff --git a/tests/baselines/reference/parser.numericSeperators.binary.js b/tests/baselines/reference/parser.numericSeperators.binary.js deleted file mode 100644 index 4af3cff55ab81..0000000000000 --- a/tests/baselines/reference/parser.numericSeperators.binary.js +++ /dev/null @@ -1,12 +0,0 @@ -//// [parser.numericSeperators.binary.ts] -0b00_11; -0B0_1; -0b1100_0011; -0B0_11_0101; - - -//// [parser.numericSeperators.binary.js] -3; -1; -195; -53; diff --git a/tests/baselines/reference/parser.numericSeperators.binary.types b/tests/baselines/reference/parser.numericSeperators.binary.types deleted file mode 100644 index b5ee8b7d5267c..0000000000000 --- a/tests/baselines/reference/parser.numericSeperators.binary.types +++ /dev/null @@ -1,13 +0,0 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binary.ts === -0b00_11; ->0b00_11 : 3 - -0B0_1; ->0B0_1 : 1 - -0b1100_0011; ->0b1100_0011 : 195 - -0B0_11_0101; ->0B0_11_0101 : 53 - diff --git a/tests/baselines/reference/parser.numericSeperators.binaryNegative.errors.txt b/tests/baselines/reference/parser.numericSeperators.binaryNegative.errors.txt deleted file mode 100644 index abfdbf3d68f97..0000000000000 --- a/tests/baselines/reference/parser.numericSeperators.binaryNegative.errors.txt +++ /dev/null @@ -1,59 +0,0 @@ -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS1177: Binary digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS2304: Cannot find name '_110'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS2304: Cannot find name '_B0101'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS2304: Cannot find name '_11'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS2304: Cannot find name '_'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS1177: Binary digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. - - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts (1 errors) ==== - 0b00_ - ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts (2 errors) ==== - 0b_110 - -!!! error TS1177: Binary digit expected. - ~~~~ -!!! error TS2304: Cannot find name '_110'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts (2 errors) ==== - 0_B0101 - ~~~~~~ -!!! error TS1005: ';' expected. - ~~~~~~ -!!! error TS2304: Cannot find name '_B0101'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts (3 errors) ==== - 0b01__11 - ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. - ~~~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name '_11'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts (3 errors) ==== - 0B0110_0110__ - ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. - ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS2304: Cannot find name '_'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts (2 errors) ==== - 0b___0111010_0101_1 - -!!! error TS1177: Binary digit expected. - ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name '___0111010_0101_1'. - \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.binaryNegative.types b/tests/baselines/reference/parser.numericSeperators.binaryNegative.types deleted file mode 100644 index 6892fecc2b10c..0000000000000 --- a/tests/baselines/reference/parser.numericSeperators.binaryNegative.types +++ /dev/null @@ -1,29 +0,0 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === -0b00_ ->0b00_ : 0 - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === -0b_110 ->0b : 0 ->_110 : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === -0_B0101 ->0 : 0 ->_B0101 : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === -0b01__11 ->0b01_ : 1 ->_11 : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === -0B0110_0110__ ->0B0110_0110_ : 102 ->_ : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === -0b___0111010_0101_1 ->0b : 0 ->___0111010_0101_1 : any - diff --git a/tests/baselines/reference/parser.numericSeperators.hex.js b/tests/baselines/reference/parser.numericSeperators.hex.js deleted file mode 100644 index 3822dd0ed0748..0000000000000 --- a/tests/baselines/reference/parser.numericSeperators.hex.js +++ /dev/null @@ -1,12 +0,0 @@ -//// [parser.numericSeperators.hex.ts] -0x00_11; -0X0_1; -0x1100_0011; -0X0_11_0101; - - -//// [parser.numericSeperators.hex.js] -17; -1; -285212689; -1114369; diff --git a/tests/baselines/reference/parser.numericSeperators.hexNegative.errors.txt b/tests/baselines/reference/parser.numericSeperators.hexNegative.errors.txt deleted file mode 100644 index 39182e651ddf9..0000000000000 --- a/tests/baselines/reference/parser.numericSeperators.hexNegative.errors.txt +++ /dev/null @@ -1,59 +0,0 @@ -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS1125: Hexadecimal digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS2304: Cannot find name '_110'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS2304: Cannot find name '_X0101'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS2304: Cannot find name '_11'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS2304: Cannot find name '_'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS1125: Hexadecimal digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. - - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts (1 errors) ==== - 0x00_ - ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts (2 errors) ==== - 0x_110 - -!!! error TS1125: Hexadecimal digit expected. - ~~~~ -!!! error TS2304: Cannot find name '_110'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts (2 errors) ==== - 0_X0101 - ~~~~~~ -!!! error TS1005: ';' expected. - ~~~~~~ -!!! error TS2304: Cannot find name '_X0101'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts (3 errors) ==== - 0x01__11 - ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. - ~~~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name '_11'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts (3 errors) ==== - 0X0110_0110__ - ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. - ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS2304: Cannot find name '_'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts (2 errors) ==== - 0x___0111010_0101_1 - -!!! error TS1125: Hexadecimal digit expected. - ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name '___0111010_0101_1'. - \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.hexNegative.types b/tests/baselines/reference/parser.numericSeperators.hexNegative.types deleted file mode 100644 index 981623c1423d5..0000000000000 --- a/tests/baselines/reference/parser.numericSeperators.hexNegative.types +++ /dev/null @@ -1,29 +0,0 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === -0x00_ ->0x00_ : 0 - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === -0x_110 ->0x : 0 ->_110 : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === -0_X0101 ->0 : 0 ->_X0101 : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === -0x01__11 ->0x01_ : 1 ->_11 : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === -0X0110_0110__ ->0X0110_0110_ : 17826064 ->_ : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === -0x___0111010_0101_1 ->0x : 0 ->___0111010_0101_1 : any - diff --git a/tests/baselines/reference/parser.numericSeperators.octal.js b/tests/baselines/reference/parser.numericSeperators.octal.js deleted file mode 100644 index 322ece02437cc..0000000000000 --- a/tests/baselines/reference/parser.numericSeperators.octal.js +++ /dev/null @@ -1,12 +0,0 @@ -//// [parser.numericSeperators.octal.ts] -0o00_11; -0O0_1; -0o1100_0011; -0O0_11_0101; - - -//// [parser.numericSeperators.octal.js] -9; -1; -2359305; -36929; diff --git a/tests/baselines/reference/parser.numericSeperators.octal.types b/tests/baselines/reference/parser.numericSeperators.octal.types deleted file mode 100644 index 6af4d537b6caf..0000000000000 --- a/tests/baselines/reference/parser.numericSeperators.octal.types +++ /dev/null @@ -1,13 +0,0 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octal.ts === -0o00_11; ->0o00_11 : 9 - -0O0_1; ->0O0_1 : 1 - -0o1100_0011; ->0o1100_0011 : 2359305 - -0O0_11_0101; ->0O0_11_0101 : 36929 - diff --git a/tests/baselines/reference/parser.numericSeperators.octalNegative.errors.txt b/tests/baselines/reference/parser.numericSeperators.octalNegative.errors.txt deleted file mode 100644 index 71f0539cc4e2f..0000000000000 --- a/tests/baselines/reference/parser.numericSeperators.octalNegative.errors.txt +++ /dev/null @@ -1,59 +0,0 @@ -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS1178: Octal digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts(1,3): error TS2304: Cannot find name '_110'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts(1,2): error TS2304: Cannot find name '_O0101'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts(1,6): error TS2304: Cannot find name '_11'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts(1,13): error TS2304: Cannot find name '_'. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS1178: Octal digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. - - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts (1 errors) ==== - 0o00_ - ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts (2 errors) ==== - 0o_110 - -!!! error TS1178: Octal digit expected. - ~~~~ -!!! error TS2304: Cannot find name '_110'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts (2 errors) ==== - 0_O0101 - ~~~~~~ -!!! error TS1005: ';' expected. - ~~~~~~ -!!! error TS2304: Cannot find name '_O0101'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts (3 errors) ==== - 0o01__11 - ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. - ~~~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name '_11'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts (3 errors) ==== - 0O0110_0110__ - ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. - ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS2304: Cannot find name '_'. - -==== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts (2 errors) ==== - 0o___0111010_0101_1 - -!!! error TS1178: Octal digit expected. - ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name '___0111010_0101_1'. - \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeperators.octalNegative.types b/tests/baselines/reference/parser.numericSeperators.octalNegative.types deleted file mode 100644 index 8f7ac1012be0f..0000000000000 --- a/tests/baselines/reference/parser.numericSeperators.octalNegative.types +++ /dev/null @@ -1,29 +0,0 @@ -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/1.ts === -0o00_ ->0o00_ : 0 - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/2.ts === -0o_110 ->0o : 0 ->_110 : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/3.ts === -0_O0101 ->0 : 0 ->_O0101 : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/4.ts === -0o01__11 ->0o01_ : 1 ->_11 : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/5.ts === -0O0110_0110__ ->0O0110_0110_ : 294984 ->_ : any - -=== tests/cases/conformance/parser/ecmascriptnext/numericSeperators/6.ts === -0o___0111010_0101_1 ->0o : 0 ->___0111010_0101_1 : any - diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binary.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.binary.ts similarity index 100% rename from tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binary.ts rename to tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.binary.ts diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binaryNegative.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.binaryNegative.ts similarity index 100% rename from tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.binaryNegative.ts rename to tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.binaryNegative.ts diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decimal.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decimal.ts new file mode 100644 index 0000000000000..e8b6d5440cf08 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decimal.ts @@ -0,0 +1,14 @@ +1_000_000_000 +1.1_00_01 +1e1_0 +1e+1_0 +1e-1_0 +1.1e10_0 +1.1e+10_0 +1.1e-10_0 +12_34_56 +1_22_333 +1_2.3_4 +1_2.3_4e5_6 +1_2.3_4e+5_6 +1_2.3_4e-5_6 diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decmialNegative.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decmialNegative.ts new file mode 100644 index 0000000000000..5d088e34526af --- /dev/null +++ b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decmialNegative.ts @@ -0,0 +1,137 @@ +// @filename: 1.ts +_10 + +// @filename: 2.ts +10_ + +// @filename: 3.ts +1__0 + +// @filename: 4.ts +0_.0 + +// @filename: 5.ts +0._0 + +// @filename: 6.ts +0.0__0 + +// @filename: 7.ts +0.0__ + +// @filename: 8.ts +0_e0 + +// @filename: 9.ts +0e_0 + +// @filename: 10.ts +0e0_ + +// @filename: 11.ts +0e0__0 + +// @filename: 12.ts +0_.0e0 + +// @filename: 13.ts +0._0e0 + +// @filename: 14.ts +0.0_e0 + +// @filename: 15.ts +0.0e_0 + +// @filename: 16.ts +_0.0e0 + +// @filename: 17.ts +0.0e0_ + +// @filename: 18.ts +0__0.0e0 + +// @filename: 19.ts +0.0__0e0 + +// @filename: 20.ts +0.00e0__0 + +// @filename: 21.ts +0_e+0 + +// @filename: 22.ts +0e+_0 + +// @filename: 23.ts +0e+0_ + +// @filename: 24.ts +0e+0__0 + +// @filename: 25.ts +0_.0e+0 + +// @filename: 26.ts +0._0e+0 + +// @filename: 27.ts +0.0_e+0 + +// @filename: 28.ts +0.0e+_0 + +// @filename: 29.ts +_0.0e+0 + +// @filename: 30.ts +0.0e+0_ + +// @filename: 31.ts +0__0.0e+0 + +// @filename: 32.ts +0.0__0e+0 + +// @filename: 33.ts +0.00e+0__0 + +// @filename: 34.ts +0_e+0 + +// @filename: 35.ts +0e-_0 + +// @filename: 36.ts +0e-0_ + +// @filename: 37.ts +0e-0__0 + +// @filename: 38.ts +0_.0e-0 + +// @filename: 39.ts +0._0e-0 + +// @filename: 40.ts +0.0_e-0 + +// @filename: 41.ts +0.0e-_0 + +// @filename: 42.ts +_0.0e-0 + +// @filename: 43.ts +0.0e-0_ + +// @filename: 44.ts +0__0.0e-0 + +// @filename: 45.ts +0.0__0e-0 + +// @filename: 46.ts +0.00e-0__0 diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hex.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.hex.ts similarity index 100% rename from tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hex.ts rename to tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.hex.ts diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hexNegative.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.hexNegative.ts similarity index 100% rename from tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.hexNegative.ts rename to tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.hexNegative.ts diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octal.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.octal.ts similarity index 100% rename from tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octal.ts rename to tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.octal.ts diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octalNegative.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.octalNegative.ts similarity index 100% rename from tests/cases/conformance/parser/ecmascriptnext/numericSeperators/parser.numericSeperators.octalNegative.ts rename to tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.octalNegative.ts From 60d8bdfb3be6c82ddbb534552bda89e1dd7fb8de Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 29 Nov 2017 13:23:58 -0800 Subject: [PATCH 04/10] Update error message --- src/compiler/diagnosticMessages.json | 2 +- src/compiler/scanner.ts | 6 +- ...umericSeparators.binaryNegative.errors.txt | 16 +-- ...mericSeparators.decmialNegative.errors.txt | 128 +++++++++--------- ...r.numericSeparators.hexNegative.errors.txt | 16 +-- ...numericSeparators.octalNegative.errors.txt | 16 +-- 6 files changed, 92 insertions(+), 92 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 3f927834d4da1..3a25594fa79f6 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3407,7 +3407,7 @@ "category": "Message", "code": 6187 }, - "Numeric seperators are not allowed at the end of a literal.": { + "Numeric separators are not allowed here.": { "category": "Error", "code": 6188 }, diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 17a8525612e0e..60a8283f2f7fb 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -881,7 +881,7 @@ namespace ts { } if (text.charCodeAt(pos - 1) === CharacterCodes._) { pos--; - error(Diagnostics.Numeric_seperators_are_not_allowed_at_the_end_of_a_literal, 1); + error(Diagnostics.Numeric_separators_are_not_allowed_here, 1); pos++; } return result = (result || "") + text.substring(start, pos); @@ -987,7 +987,7 @@ namespace ts { } if (text.charCodeAt(pos - 1) === CharacterCodes._) { pos--; - error(Diagnostics.Numeric_seperators_are_not_allowed_at_the_end_of_a_literal, 1); + error(Diagnostics.Numeric_separators_are_not_allowed_here, 1); pos++; } return value; @@ -1305,7 +1305,7 @@ namespace ts { if (text.charCodeAt(pos - 1) === CharacterCodes._) { // Literal ends with underscore - not allowed pos--; - error(Diagnostics.Numeric_seperators_are_not_allowed_at_the_end_of_a_literal, 1); + error(Diagnostics.Numeric_separators_are_not_allowed_here, 1); pos++; // Consume character anyway to reduce followon errors from a single erroneous trailing `_`, like `Cannot find name '_'` return value; } diff --git a/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt index 254fa138e243f..e3aea6ff094ba 100644 --- a/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS1177: Binary digit expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS2304: Cannot find name '_110'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'B0101'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS2304: Cannot find name '_11'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS2304: Cannot find name '_'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS1177: Binary digit expected. @@ -17,7 +17,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== 0b00_ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (2 errors) ==== 0b_110 @@ -29,7 +29,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== 0_B0101 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~~~~ !!! error TS1005: ';' expected. ~~~~~ @@ -38,7 +38,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (3 errors) ==== 0b01__11 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~~ !!! error TS1005: ';' expected. ~~~ @@ -47,7 +47,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (3 errors) ==== 0B0110_0110__ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~ !!! error TS1005: ';' expected. ~ diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt index 85fccd838e903..d54ab24c095b3 100644 --- a/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt @@ -1,93 +1,93 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,1): error TS2304: Cannot find name '_10'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts(1,4): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,5): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,5): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts(1,3): error TS2304: Cannot find name '_0e0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts(1,5): error TS1124: Digit expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts(1,5): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts(1,1): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts(1,6): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts(1,6): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,3): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,5): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,5): error TS2304: Cannot find name '_0e0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts(1,7): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts(1,7): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts(1,8): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts(1,8): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts(1,4): error TS1124: Digit expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts(1,4): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts(1,5): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts(1,6): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts(1,6): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts(1,3): error TS2304: Cannot find name '_0e'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts(1,6): error TS1124: Digit expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts(1,6): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts(1,1): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/30.ts(1,7): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/30.ts(1,7): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,3): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts(1,5): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts(1,5): error TS2304: Cannot find name '_0e'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts(1,8): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts(1,8): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts(1,9): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts(1,9): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts(1,4): error TS1124: Digit expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts(1,4): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts(1,5): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,6): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,6): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts(1,3): error TS2304: Cannot find name '_0e'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,2): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts(1,6): error TS1124: Digit expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts(1,6): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts(1,1): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts(1,7): error TS6188: Numeric seperators are not allowed at the end of a literal. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts(1,7): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,3): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,5): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,5): error TS2304: Cannot find name '_0e'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,8): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,8): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,9): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,9): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,3): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,4): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,5): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,5): error TS2304: Cannot find name '_'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error TS1124: Digit expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error TS2304: Cannot find name '_0'. @@ -100,12 +100,12 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (1 errors) ==== 10_ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== 1__0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~ !!! error TS1005: ';' expected. ~~ @@ -114,7 +114,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (1 errors) ==== 0_.0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (2 errors) ==== 0._0 @@ -126,7 +126,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (3 errors) ==== 0.0__0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~ !!! error TS1005: ';' expected. ~~ @@ -135,7 +135,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts (3 errors) ==== 0.0__ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~ !!! error TS1005: ';' expected. ~ @@ -144,7 +144,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts (1 errors) ==== 0_e0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts (2 errors) ==== 0e_0 @@ -156,12 +156,12 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts (1 errors) ==== 0e0_ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts (3 errors) ==== 0e0__0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~ !!! error TS1005: ';' expected. ~~ @@ -170,7 +170,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts (1 errors) ==== 0_.0e0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts (2 errors) ==== 0._0e0 @@ -182,7 +182,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts (1 errors) ==== 0.0_e0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts (2 errors) ==== 0.0e_0 @@ -201,12 +201,12 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts (1 errors) ==== 0.0e0_ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts (4 errors) ==== 0__0.0e0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~ !!! error TS1005: ';' expected. ~~ @@ -217,7 +217,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts (3 errors) ==== 0.0__0e0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~~~ !!! error TS1005: ';' expected. ~~~~ @@ -226,7 +226,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts (3 errors) ==== 0.00e0__0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~ !!! error TS1005: ';' expected. ~~ @@ -235,7 +235,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts (1 errors) ==== 0_e+0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts (2 errors) ==== 0e+_0 @@ -247,12 +247,12 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts (1 errors) ==== 0e+0_ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts (3 errors) ==== 0e+0__0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~ !!! error TS1005: ';' expected. ~~ @@ -261,7 +261,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts (1 errors) ==== 0_.0e+0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts (2 errors) ==== 0._0e+0 @@ -273,7 +273,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts (1 errors) ==== 0.0_e+0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts (2 errors) ==== 0.0e+_0 @@ -292,12 +292,12 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/30.ts (1 errors) ==== 0.0e+0_ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts (4 errors) ==== 0__0.0e+0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~ !!! error TS1005: ';' expected. ~~ @@ -308,7 +308,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts (3 errors) ==== 0.0__0e+0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~~ !!! error TS1005: ';' expected. ~~~ @@ -317,7 +317,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts (3 errors) ==== 0.00e+0__0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~ !!! error TS1005: ';' expected. ~~ @@ -326,7 +326,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts (1 errors) ==== 0_e+0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts (2 errors) ==== 0e-_0 @@ -338,12 +338,12 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts (1 errors) ==== 0e-0_ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts (3 errors) ==== 0e-0__0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~ !!! error TS1005: ';' expected. ~~ @@ -352,7 +352,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts (1 errors) ==== 0_.0e-0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts (2 errors) ==== 0._0e-0 @@ -364,7 +364,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts (1 errors) ==== 0.0_e-0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts (2 errors) ==== 0.0e-_0 @@ -383,12 +383,12 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts (1 errors) ==== 0.0e-0_ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts (4 errors) ==== 0__0.0e-0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~ !!! error TS1005: ';' expected. ~~ @@ -399,7 +399,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts (3 errors) ==== 0.0__0e-0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~~ !!! error TS1005: ';' expected. ~~~ @@ -408,7 +408,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts (3 errors) ==== 0.00e-0__0 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~ !!! error TS1005: ';' expected. ~~ diff --git a/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt index 3dacf30d7ba04..f065a7db5ebd3 100644 --- a/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS1125: Hexadecimal digit expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS2304: Cannot find name '_110'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'X0101'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS2304: Cannot find name '_11'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS2304: Cannot find name '_'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS1125: Hexadecimal digit expected. @@ -17,7 +17,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== 0x00_ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (2 errors) ==== 0x_110 @@ -29,7 +29,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== 0_X0101 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~~~~ !!! error TS1005: ';' expected. ~~~~~ @@ -38,7 +38,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (3 errors) ==== 0x01__11 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~~ !!! error TS1005: ';' expected. ~~~ @@ -47,7 +47,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (3 errors) ==== 0X0110_0110__ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~ !!! error TS1005: ';' expected. ~ diff --git a/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt index e72c2ee7f5575..54f00e7465a65 100644 --- a/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS1178: Octal digit expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS2304: Cannot find name '_110'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'O0101'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS2304: Cannot find name '_11'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric seperators are not allowed at the end of a literal. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS2304: Cannot find name '_'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS1178: Octal digit expected. @@ -17,7 +17,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== 0o00_ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (2 errors) ==== 0o_110 @@ -29,7 +29,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== 0_O0101 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~~~~ !!! error TS1005: ';' expected. ~~~~~ @@ -38,7 +38,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (3 errors) ==== 0o01__11 ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~~~ !!! error TS1005: ';' expected. ~~~ @@ -47,7 +47,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (3 errors) ==== 0O0110_0110__ ~ -!!! error TS6188: Numeric seperators are not allowed at the end of a literal. +!!! error TS6188: Numeric separators are not allowed here. ~ !!! error TS1005: ';' expected. ~ From 771a1d630aae1d8ee8b04fe428f39b2437f8a878 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 29 Nov 2017 13:28:19 -0800 Subject: [PATCH 05/10] Refactor error in scanner to take a position --- src/compiler/scanner.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 60a8283f2f7fb..98edc0a8a4e13 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -852,9 +852,15 @@ namespace ts { scanRange, }; - function error(message: DiagnosticMessage, length?: number): void { + + function error(message: DiagnosticMessage): void; + function error(message: DiagnosticMessage, errPos: number, length: number): void; + function error(message: DiagnosticMessage, errPos?: number, length?: number): void { if (onError) { + const oldPos = pos; + pos = errPos; onError(message, length || 0); + pos = oldPos; } } @@ -880,9 +886,7 @@ namespace ts { break; } if (text.charCodeAt(pos - 1) === CharacterCodes._) { - pos--; - error(Diagnostics.Numeric_separators_are_not_allowed_here, 1); - pos++; + error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); } return result = (result || "") + text.substring(start, pos); } @@ -986,9 +990,7 @@ namespace ts { value = -1; } if (text.charCodeAt(pos - 1) === CharacterCodes._) { - pos--; - error(Diagnostics.Numeric_separators_are_not_allowed_here, 1); - pos++; + error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); } return value; } @@ -1304,9 +1306,7 @@ namespace ts { } if (text.charCodeAt(pos - 1) === CharacterCodes._) { // Literal ends with underscore - not allowed - pos--; - error(Diagnostics.Numeric_separators_are_not_allowed_here, 1); - pos++; // Consume character anyway to reduce followon errors from a single erroneous trailing `_`, like `Cannot find name '_'` + error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); return value; } return value; From cd0777a83b3af3cdb9cd01553f6ecf125aad2af3 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 29 Nov 2017 14:10:46 -0800 Subject: [PATCH 06/10] Scan no separators in escape sequences, add escape sequence tests --- src/compiler/scanner.ts | 67 +++-- ...numericSeparators.unicodeEscape.errors.txt | 236 +++++++++++++++++ .../parser.numericSeparators.unicodeEscape.js | 243 ++++++++++++++++++ ...er.numericSeparators.unicodeEscape.symbols | 145 +++++++++++ ...rser.numericSeparators.unicodeEscape.types | 192 ++++++++++++++ .../parser.numericSeparators.unicodeEscape.ts | 143 +++++++++++ 6 files changed, 990 insertions(+), 36 deletions(-) create mode 100644 tests/baselines/reference/parser.numericSeparators.unicodeEscape.errors.txt create mode 100644 tests/baselines/reference/parser.numericSeparators.unicodeEscape.js create mode 100644 tests/baselines/reference/parser.numericSeparators.unicodeEscape.symbols create mode 100644 tests/baselines/reference/parser.numericSeparators.unicodeEscape.types create mode 100644 tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.unicodeEscape.ts diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 98edc0a8a4e13..ee64acae85ab8 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -561,9 +561,9 @@ namespace ts { return false; } - function scanConflictMarkerTrivia(text: string, pos: number, error?: ErrorCallback) { + function scanConflictMarkerTrivia(text: string, pos: number, error?: (diag: DiagnosticMessage, pos?: number, len?: number) => void) { if (error) { - error(Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength); + error(Diagnostics.Merge_conflict_marker_encountered, pos, mergeConflictMarkerLength); } const ch = text.charCodeAt(pos); @@ -852,10 +852,9 @@ namespace ts { scanRange, }; - function error(message: DiagnosticMessage): void; function error(message: DiagnosticMessage, errPos: number, length: number): void; - function error(message: DiagnosticMessage, errPos?: number, length?: number): void { + function error(message: DiagnosticMessage, errPos: number = pos, length?: number): void { if (onError) { const oldPos = pos; pos = errPos; @@ -866,12 +865,12 @@ namespace ts { function scanNumberFragment(): string { let start = pos; - let allowSeperator = false; + let allowSeparator = false; let result: string; while (true) { const ch = text.charCodeAt(pos); - if (allowSeperator && ch === CharacterCodes._) { - allowSeperator = false; + if (allowSeparator && ch === CharacterCodes._) { + allowSeparator = false; tokenFlags |= TokenFlags.ContainsSeparator; result = (result || "") + text.substring(start, pos); pos++; @@ -879,7 +878,7 @@ namespace ts { continue; } if (isDigit(ch)) { - allowSeperator = true; + allowSeparator = true; pos++; continue; } @@ -916,18 +915,14 @@ namespace ts { } } if (tokenFlags & TokenFlags.ContainsSeparator) { - if (decimalFragment && scientificFragment) { - return "" + +(mainFragment + "." + decimalFragment + scientificFragment); + let result = mainFragment; + if (decimalFragment) { + result += "." + decimalFragment; } - else if (decimalFragment) { - return "" + +(mainFragment + "." + decimalFragment); - } - else if (scientificFragment) { - return "" + +(mainFragment + scientificFragment); - } - else { - return "" + +mainFragment; + if (scientificFragment) { + result += scientificFragment; } + return "" + +result; } else { return "" + +(text.substring(start, end)); // No need to use all the fragments; no _ removal needed @@ -946,31 +941,31 @@ namespace ts { * Scans the given number of hexadecimal digits in the text, * returning -1 if the given number is unavailable. */ - function scanExactNumberOfHexDigits(count: number): number { - return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ false); + function scanExactNumberOfHexDigits(count: number, canHaveSeparators: boolean): number { + return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ false, canHaveSeparators); } /** * Scans as many hexadecimal digits as are available in the text, * returning -1 if the given number of digits was unavailable. */ - function scanMinimumNumberOfHexDigits(count: number): number { - return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ true); + function scanMinimumNumberOfHexDigits(count: number, canHaveSeparators: boolean): number { + return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ true, canHaveSeparators); } - function scanHexDigits(minCount: number, scanAsManyAsPossible: boolean): number { + function scanHexDigits(minCount: number, scanAsManyAsPossible: boolean, canHaveSeparators: boolean): number { let digits = 0; let value = 0; - let seperatorAllowed = false; + let allowSeparator = false; while (digits < minCount || scanAsManyAsPossible) { const ch = text.charCodeAt(pos); - if (seperatorAllowed && ch === CharacterCodes._) { - seperatorAllowed = false; + if (allowSeparator && ch === CharacterCodes._) { + allowSeparator = false; tokenFlags |= TokenFlags.ContainsSeparator; pos++; continue; } - seperatorAllowed = true; + allowSeparator = canHaveSeparators; if (ch >= CharacterCodes._0 && ch <= CharacterCodes._9) { value = value * 16 + ch - CharacterCodes._0; } @@ -1160,7 +1155,7 @@ namespace ts { } function scanHexadecimalEscape(numDigits: number): string { - const escapedValue = scanExactNumberOfHexDigits(numDigits); + const escapedValue = scanExactNumberOfHexDigits(numDigits, /*canHaveSeparators*/ false); if (escapedValue >= 0) { return String.fromCharCode(escapedValue); @@ -1172,7 +1167,7 @@ namespace ts { } function scanExtendedUnicodeEscape(): string { - const escapedValue = scanMinimumNumberOfHexDigits(1); + const escapedValue = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false); let isInvalidExtendedEscape = false; // Validate the value of the digit @@ -1225,7 +1220,7 @@ namespace ts { if (pos + 5 < end && text.charCodeAt(pos + 1) === CharacterCodes.u) { const start = pos; pos += 2; - const value = scanExactNumberOfHexDigits(4); + const value = scanExactNumberOfHexDigits(4, /*canHaveSeparators*/ false); pos = start; return value; } @@ -1281,17 +1276,17 @@ namespace ts { // For counting number of digits; Valid binaryIntegerLiteral must have at least one binary digit following B or b. // Similarly valid octalIntegerLiteral must have at least one octal digit following o or O. let numberOfDigits = 0; - let seperatorAllowed = false; + let separatorAllowed = false; while (true) { const ch = text.charCodeAt(pos); - // Numeric seperators are allowed anywhere within a numeric literal, except not at the beginning, or following another seperator - if (seperatorAllowed && ch === CharacterCodes._) { - seperatorAllowed = false; + // Numeric seperators are allowed anywhere within a numeric literal, except not at the beginning, or following another separator + if (separatorAllowed && ch === CharacterCodes._) { + separatorAllowed = false; tokenFlags |= TokenFlags.ContainsSeparator; pos++; continue; } - seperatorAllowed = true; + separatorAllowed = true; const valueOfCh = ch - CharacterCodes._0; if (!isDigit(ch) || valueOfCh >= base) { break; @@ -1512,7 +1507,7 @@ namespace ts { case CharacterCodes._0: if (pos + 2 < end && (text.charCodeAt(pos + 1) === CharacterCodes.X || text.charCodeAt(pos + 1) === CharacterCodes.x)) { pos += 2; - let value = scanMinimumNumberOfHexDigits(1); + let value = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ true); if (value < 0) { error(Diagnostics.Hexadecimal_digit_expected); value = 0; diff --git a/tests/baselines/reference/parser.numericSeparators.unicodeEscape.errors.txt b/tests/baselines/reference/parser.numericSeparators.unicodeEscape.errors.txt new file mode 100644 index 0000000000000..6ba8c2efdf75a --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.unicodeEscape.errors.txt @@ -0,0 +1,236 @@ +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,7): error TS1199: Unterminated Unicode escape sequence. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts(1,5): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,5): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts(1,5): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts(1,5): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts(1,5): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts(1,4): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,4): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,4): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,7): error TS1199: Unterminated Unicode escape sequence. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts(1,4): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts(1,4): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts(1,4): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts(1,11): error TS1199: Unterminated Unicode escape sequence. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts(1,11): error TS1199: Unterminated Unicode escape sequence. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts(1,11): error TS1199: Unterminated Unicode escape sequence. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,7): error TS1199: Unterminated Unicode escape sequence. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,7): error TS1199: Unterminated Unicode escape sequence. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts(1,7): error TS1199: Unterminated Unicode escape sequence. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts(1,7): error TS1199: Unterminated Unicode escape sequence. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts(1,6): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts(1,6): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts(1,6): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,5): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,5): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts(1,5): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,6): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,6): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,6): error TS1125: Hexadecimal digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,5): error TS1125: Hexadecimal digit expected. + + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== + "\u{10_ffff}" + +!!! error TS1199: Unterminated Unicode escape sequence. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (1 errors) ==== + '\u{10_ffff}' + +!!! error TS1199: Unterminated Unicode escape sequence. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (1 errors) ==== + `\u{10_ffff}` + +!!! error TS1199: Unterminated Unicode escape sequence. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (0 errors) ==== + /\u{10_ffff}/u + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (1 errors) ==== + "\uff_ff" + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (1 errors) ==== + '\uff_ff' + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts (1 errors) ==== + `\uff_ff` + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts (0 errors) ==== + /\uff_ff/u + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts (1 errors) ==== + "\xf_f" + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts (1 errors) ==== + '\xf_f' + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts (1 errors) ==== + `\xf_f` + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts (0 errors) ==== + /\xf_f/u + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts (1 errors) ==== + "\u{_10ffff}" + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts (1 errors) ==== + '\u{_10ffff}' + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts (1 errors) ==== + `\u{_10ffff}` + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts (0 errors) ==== + /\u{_10ffff}/u + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts (1 errors) ==== + "\u_ffff" + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts (1 errors) ==== + '\u_ffff' + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts (1 errors) ==== + `\u_ffff` + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts (0 errors) ==== + /\u_ffff/u + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts (1 errors) ==== + "\x_ff" + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts (1 errors) ==== + '\x_ff' + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts (1 errors) ==== + `\x_ff` + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts (0 errors) ==== + /\x_ff/u + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts (1 errors) ==== + "\u{10ffff_}" + +!!! error TS1199: Unterminated Unicode escape sequence. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts (1 errors) ==== + '\u{10ffff_}' + +!!! error TS1199: Unterminated Unicode escape sequence. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts (1 errors) ==== + `\u{10ffff_}` + +!!! error TS1199: Unterminated Unicode escape sequence. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts (0 errors) ==== + /\u{10ffff_}/u + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts (0 errors) ==== + "\uffff_" + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/30.ts (0 errors) ==== + '\uffff_' + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts (0 errors) ==== + `\uffff_` + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts (0 errors) ==== + /\uffff_/u + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts (0 errors) ==== + "\xff_" + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts (0 errors) ==== + '\xff_' + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts (0 errors) ==== + `\xff_` + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts (0 errors) ==== + /\xff_/u + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts (1 errors) ==== + "\u{10__ffff}" + +!!! error TS1199: Unterminated Unicode escape sequence. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts (1 errors) ==== + '\u{10__ffff}' + +!!! error TS1199: Unterminated Unicode escape sequence. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts (1 errors) ==== + `\u{10__ffff}` + +!!! error TS1199: Unterminated Unicode escape sequence. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts (0 errors) ==== + /\u{10__ffff}/u + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts (1 errors) ==== + "\uff__ff" + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts (1 errors) ==== + '\uff__ff' + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts (1 errors) ==== + `\uff__ff` + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts (0 errors) ==== + /\uff__ff/u + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts (1 errors) ==== + "\xf__f" + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts (1 errors) ==== + '\xf__f' + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts (1 errors) ==== + `\xf__f` + +!!! error TS1125: Hexadecimal digit expected. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/48.ts (0 errors) ==== + /\xf__f/u + \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.unicodeEscape.js b/tests/baselines/reference/parser.numericSeparators.unicodeEscape.js new file mode 100644 index 0000000000000..8e19ba9994913 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.unicodeEscape.js @@ -0,0 +1,243 @@ +//// [tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.unicodeEscape.ts] //// + +//// [1.ts] +"\u{10_ffff}" + +//// [2.ts] +'\u{10_ffff}' + +//// [3.ts] +`\u{10_ffff}` + +//// [4.ts] +/\u{10_ffff}/u + +//// [5.ts] +"\uff_ff" + +//// [6.ts] +'\uff_ff' + +//// [7.ts] +`\uff_ff` + +//// [8.ts] +/\uff_ff/u + +//// [9.ts] +"\xf_f" + +//// [10.ts] +'\xf_f' + +//// [11.ts] +`\xf_f` + +//// [12.ts] +/\xf_f/u + +//// [13.ts] +"\u{_10ffff}" + +//// [14.ts] +'\u{_10ffff}' + +//// [15.ts] +`\u{_10ffff}` + +//// [16.ts] +/\u{_10ffff}/u + +//// [17.ts] +"\u_ffff" + +//// [18.ts] +'\u_ffff' + +//// [19.ts] +`\u_ffff` + +//// [20.ts] +/\u_ffff/u + +//// [21.ts] +"\x_ff" + +//// [22.ts] +'\x_ff' + +//// [23.ts] +`\x_ff` + +//// [24.ts] +/\x_ff/u + +//// [25.ts] +"\u{10ffff_}" + +//// [26.ts] +'\u{10ffff_}' + +//// [27.ts] +`\u{10ffff_}` + +//// [28.ts] +/\u{10ffff_}/u + +//// [29.ts] +"\uffff_" + +//// [30.ts] +'\uffff_' + +//// [31.ts] +`\uffff_` + +//// [32.ts] +/\uffff_/u + +//// [33.ts] +"\xff_" + +//// [34.ts] +'\xff_' + +//// [35.ts] +`\xff_` + +//// [36.ts] +/\xff_/u + +//// [37.ts] +"\u{10__ffff}" + +//// [38.ts] +'\u{10__ffff}' + +//// [39.ts] +`\u{10__ffff}` + +//// [40.ts] +/\u{10__ffff}/u + +//// [41.ts] +"\uff__ff" + +//// [42.ts] +'\uff__ff' + +//// [43.ts] +`\uff__ff` + +//// [44.ts] +/\uff__ff/u + +//// [45.ts] +"\xf__f" + +//// [46.ts] +'\xf__f' + +//// [47.ts] +`\xf__f` + +//// [48.ts] +/\xf__f/u + + +//// [1.js] +"\u{10_ffff}"; +//// [2.js] +'\u{10_ffff}'; +//// [3.js] +"_ffff}"; +//// [4.js] +/\u{10_ffff}/u; +//// [5.js] +"\uff_ff"; +//// [6.js] +'\uff_ff'; +//// [7.js] +"_ff"; +//// [8.js] +/\uff_ff/u; +//// [9.js] +"\xf_f"; +//// [10.js] +'\xf_f'; +//// [11.js] +"_f"; +//// [12.js] +/\xf_f/u; +//// [13.js] +"\u{_10ffff}"; +//// [14.js] +'\u{_10ffff}'; +//// [15.js] +"_10ffff}"; +//// [16.js] +/\u{_10ffff}/u; +//// [17.js] +"\u_ffff"; +//// [18.js] +'\u_ffff'; +//// [19.js] +"_ffff"; +//// [20.js] +/\u_ffff/u; +//// [21.js] +"\x_ff"; +//// [22.js] +'\x_ff'; +//// [23.js] +"_ff"; +//// [24.js] +/\x_ff/u; +//// [25.js] +"\u{10ffff_}"; +//// [26.js] +'\u{10ffff_}'; +//// [27.js] +"_}"; +//// [28.js] +/\u{10ffff_}/u; +//// [29.js] +"\uffff_"; +//// [30.js] +'\uffff_'; +//// [31.js] +"\uFFFF_"; +//// [32.js] +/\uffff_/u; +//// [33.js] +"\xff_"; +//// [34.js] +'\xff_'; +//// [35.js] +"\u00FF_"; +//// [36.js] +/\xff_/u; +//// [37.js] +"\u{10__ffff}"; +//// [38.js] +'\u{10__ffff}'; +//// [39.js] +"__ffff}"; +//// [40.js] +/\u{10__ffff}/u; +//// [41.js] +"\uff__ff"; +//// [42.js] +'\uff__ff'; +//// [43.js] +"__ff"; +//// [44.js] +/\uff__ff/u; +//// [45.js] +"\xf__f"; +//// [46.js] +'\xf__f'; +//// [47.js] +"__f"; +//// [48.js] +/\xf__f/u; diff --git a/tests/baselines/reference/parser.numericSeparators.unicodeEscape.symbols b/tests/baselines/reference/parser.numericSeparators.unicodeEscape.symbols new file mode 100644 index 0000000000000..908e05065a7ff --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.unicodeEscape.symbols @@ -0,0 +1,145 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts === +"\u{10_ffff}" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === +'\u{10_ffff}' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === +`\u{10_ffff}` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === +/\u{10_ffff}/u +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === +"\uff_ff" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === +'\uff_ff' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts === +`\uff_ff` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts === +/\uff_ff/u +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts === +"\xf_f" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts === +'\xf_f' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts === +`\xf_f` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts === +/\xf_f/u +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts === +"\u{_10ffff}" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts === +'\u{_10ffff}' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts === +`\u{_10ffff}` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts === +/\u{_10ffff}/u +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts === +"\u_ffff" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts === +'\u_ffff' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts === +`\u_ffff` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts === +/\u_ffff/u +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts === +"\x_ff" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts === +'\x_ff' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts === +`\x_ff` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts === +/\x_ff/u +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts === +"\u{10ffff_}" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts === +'\u{10ffff_}' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts === +`\u{10ffff_}` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts === +/\u{10ffff_}/u +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts === +"\uffff_" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/30.ts === +'\uffff_' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts === +`\uffff_` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts === +/\uffff_/u +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts === +"\xff_" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts === +'\xff_' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts === +`\xff_` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts === +/\xff_/u +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts === +"\u{10__ffff}" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts === +'\u{10__ffff}' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts === +`\u{10__ffff}` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts === +/\u{10__ffff}/u +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts === +"\uff__ff" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts === +'\uff__ff' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts === +`\uff__ff` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts === +/\uff__ff/u +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts === +"\xf__f" +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts === +'\xf__f' +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts === +`\xf__f` +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/48.ts === +/\xf__f/u +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.unicodeEscape.types b/tests/baselines/reference/parser.numericSeparators.unicodeEscape.types new file mode 100644 index 0000000000000..052fc3c09cd76 --- /dev/null +++ b/tests/baselines/reference/parser.numericSeparators.unicodeEscape.types @@ -0,0 +1,192 @@ +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts === +"\u{10_ffff}" +>"\u{10_ffff}" : "_ffff}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === +'\u{10_ffff}' +>'\u{10_ffff}' : "_ffff}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === +`\u{10_ffff}` +>`\u{10_ffff}` : "_ffff}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === +/\u{10_ffff}/u +>/\u{10_ffff}/u : RegExp + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === +"\uff_ff" +>"\uff_ff" : "_ff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === +'\uff_ff' +>'\uff_ff' : "_ff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts === +`\uff_ff` +>`\uff_ff` : "_ff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts === +/\uff_ff/u +>/\uff_ff/u : RegExp + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts === +"\xf_f" +>"\xf_f" : "_f" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts === +'\xf_f' +>'\xf_f' : "_f" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts === +`\xf_f` +>`\xf_f` : "_f" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts === +/\xf_f/u +>/\xf_f/u : RegExp + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts === +"\u{_10ffff}" +>"\u{_10ffff}" : "_10ffff}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts === +'\u{_10ffff}' +>'\u{_10ffff}' : "_10ffff}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts === +`\u{_10ffff}` +>`\u{_10ffff}` : "_10ffff}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts === +/\u{_10ffff}/u +>/\u{_10ffff}/u : RegExp + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts === +"\u_ffff" +>"\u_ffff" : "_ffff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts === +'\u_ffff' +>'\u_ffff' : "_ffff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts === +`\u_ffff` +>`\u_ffff` : "_ffff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts === +/\u_ffff/u +>/\u_ffff/u : RegExp + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts === +"\x_ff" +>"\x_ff" : "_ff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts === +'\x_ff' +>'\x_ff' : "_ff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts === +`\x_ff` +>`\x_ff` : "_ff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts === +/\x_ff/u +>/\x_ff/u : RegExp + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts === +"\u{10ffff_}" +>"\u{10ffff_}" : "_}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts === +'\u{10ffff_}' +>'\u{10ffff_}' : "_}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts === +`\u{10ffff_}` +>`\u{10ffff_}` : "_}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts === +/\u{10ffff_}/u +>/\u{10ffff_}/u : RegExp + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts === +"\uffff_" +>"\uffff_" : "￿_" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/30.ts === +'\uffff_' +>'\uffff_' : "￿_" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts === +`\uffff_` +>`\uffff_` : "￿_" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts === +/\uffff_/u +>/\uffff_/u : RegExp + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts === +"\xff_" +>"\xff_" : "ÿ_" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts === +'\xff_' +>'\xff_' : "ÿ_" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts === +`\xff_` +>`\xff_` : "ÿ_" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts === +/\xff_/u +>/\xff_/u : RegExp + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts === +"\u{10__ffff}" +>"\u{10__ffff}" : "__ffff}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts === +'\u{10__ffff}' +>'\u{10__ffff}' : "__ffff}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts === +`\u{10__ffff}` +>`\u{10__ffff}` : "__ffff}" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts === +/\u{10__ffff}/u +>/\u{10__ffff}/u : RegExp + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts === +"\uff__ff" +>"\uff__ff" : "__ff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts === +'\uff__ff' +>'\uff__ff' : "__ff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts === +`\uff__ff` +>`\uff__ff` : "__ff" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts === +/\uff__ff/u +>/\uff__ff/u : RegExp + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts === +"\xf__f" +>"\xf__f" : "__f" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts === +'\xf__f' +>'\xf__f' : "__f" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts === +`\xf__f` +>`\xf__f` : "__f" + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/48.ts === +/\xf__f/u +>/\xf__f/u : RegExp + diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.unicodeEscape.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.unicodeEscape.ts new file mode 100644 index 0000000000000..ae143939aa76f --- /dev/null +++ b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.unicodeEscape.ts @@ -0,0 +1,143 @@ +// @filename: 1.ts +"\u{10_ffff}" + +// @filename: 2.ts +'\u{10_ffff}' + +// @filename: 3.ts +`\u{10_ffff}` + +// @filename: 4.ts +/\u{10_ffff}/u + +// @filename: 5.ts +"\uff_ff" + +// @filename: 6.ts +'\uff_ff' + +// @filename: 7.ts +`\uff_ff` + +// @filename: 8.ts +/\uff_ff/u + +// @filename: 9.ts +"\xf_f" + +// @filename: 10.ts +'\xf_f' + +// @filename: 11.ts +`\xf_f` + +// @filename: 12.ts +/\xf_f/u + +// @filename: 13.ts +"\u{_10ffff}" + +// @filename: 14.ts +'\u{_10ffff}' + +// @filename: 15.ts +`\u{_10ffff}` + +// @filename: 16.ts +/\u{_10ffff}/u + +// @filename: 17.ts +"\u_ffff" + +// @filename: 18.ts +'\u_ffff' + +// @filename: 19.ts +`\u_ffff` + +// @filename: 20.ts +/\u_ffff/u + +// @filename: 21.ts +"\x_ff" + +// @filename: 22.ts +'\x_ff' + +// @filename: 23.ts +`\x_ff` + +// @filename: 24.ts +/\x_ff/u + +// @filename: 25.ts +"\u{10ffff_}" + +// @filename: 26.ts +'\u{10ffff_}' + +// @filename: 27.ts +`\u{10ffff_}` + +// @filename: 28.ts +/\u{10ffff_}/u + +// @filename: 29.ts +"\uffff_" + +// @filename: 30.ts +'\uffff_' + +// @filename: 31.ts +`\uffff_` + +// @filename: 32.ts +/\uffff_/u + +// @filename: 33.ts +"\xff_" + +// @filename: 34.ts +'\xff_' + +// @filename: 35.ts +`\xff_` + +// @filename: 36.ts +/\xff_/u + +// @filename: 37.ts +"\u{10__ffff}" + +// @filename: 38.ts +'\u{10__ffff}' + +// @filename: 39.ts +`\u{10__ffff}` + +// @filename: 40.ts +/\u{10__ffff}/u + +// @filename: 41.ts +"\uff__ff" + +// @filename: 42.ts +'\uff__ff' + +// @filename: 43.ts +`\uff__ff` + +// @filename: 44.ts +/\uff__ff/u + +// @filename: 45.ts +"\xf__f" + +// @filename: 46.ts +'\xf__f' + +// @filename: 47.ts +`\xf__f` + +// @filename: 48.ts +/\xf__f/u From cc84c0b5fcabdee0a639458f3393132ae8d95a6c Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 29 Nov 2017 14:15:37 -0800 Subject: [PATCH 07/10] More decimal tests from the spec presentation examples --- ...mericSeparators.decmialNegative.errors.txt | 45 +++++++++++++++++++ ...arser.numericSeparators.decmialNegative.js | 29 ++++++++++++ ....numericSeparators.decmialNegative.symbols | 15 +++++++ ...er.numericSeparators.decmialNegative.types | 28 ++++++++++++ ...arser.numericSeparators.decmialNegative.ts | 15 +++++++ 5 files changed, 132 insertions(+) diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt index d54ab24c095b3..b2083c5d04443 100644 --- a/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt @@ -79,8 +79,18 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,5): erro tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,8): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,9): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,9): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts(1,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts(1,2): error TS2304: Cannot find name '_'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/48.ts(1,2): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/48.ts(1,2): error TS2304: Cannot find name '\u005F01234'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/49.ts(1,5): error TS1124: Digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/49.ts(1,5): error TS2304: Cannot find name '_'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,3): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/50.ts(1,5): error TS1124: Digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/50.ts(1,5): error TS2304: Cannot find name '_'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/51.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/51.ts(1,3): error TS2304: Cannot find name '_'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS2304: Cannot find name '_0'. @@ -413,4 +423,39 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error !!! error TS1005: ';' expected. ~~ !!! error TS2304: Cannot find name '_0'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts (2 errors) ==== + ._ + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS2304: Cannot find name '_'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/48.ts (2 errors) ==== + 1\u005F01234 + ~~~~~~~~~~~ +!!! error TS1005: ';' expected. + ~~~~~~~~~~~ +!!! error TS2304: Cannot find name '\u005F01234'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/49.ts (2 errors) ==== + 1.0e_+10 + +!!! error TS1124: Digit expected. + ~ +!!! error TS2304: Cannot find name '_'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/50.ts (2 errors) ==== + 1.0e_-10 + +!!! error TS1124: Digit expected. + ~ +!!! error TS2304: Cannot find name '_'. + +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/51.ts (2 errors) ==== + 0._ + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS2304: Cannot find name '_'. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.js b/tests/baselines/reference/parser.numericSeparators.decmialNegative.js index cfe2b879cb6bb..ff80f50a536bf 100644 --- a/tests/baselines/reference/parser.numericSeparators.decmialNegative.js +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.js @@ -138,6 +138,21 @@ _0.0e-0 //// [46.ts] 0.00e-0__0 +//// [47.ts] +._ + +//// [48.ts] +1\u005F01234 + +//// [49.ts] +1.0e_+10 + +//// [50.ts] +1.0e_-10 + +//// [51.ts] +0._ + //// [1.js] _10; @@ -262,3 +277,17 @@ _0e - 0; //// [46.js] 0; _0; +//// [47.js] +_; +//// [48.js] +1; +\u005F01234; +//// [49.js] +1.0e; +_ + 10; +//// [50.js] +1.0e; +_ - 10; +//// [51.js] +0.; +_; diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.symbols b/tests/baselines/reference/parser.numericSeparators.decmialNegative.symbols index a6257790851c6..daa418358b988 100644 --- a/tests/baselines/reference/parser.numericSeparators.decmialNegative.symbols +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.symbols @@ -136,4 +136,19 @@ No type information for this code. No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts === 0.00e-0__0 No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts === +._ +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/48.ts === +1\u005F01234 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/49.ts === +1.0e_+10 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/50.ts === +1.0e_-10 +No type information for this code. +No type information for this code.=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/51.ts === +0._ +No type information for this code. No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.types b/tests/baselines/reference/parser.numericSeparators.decmialNegative.types index e0aa57e54683c..cd2845c4e2c89 100644 --- a/tests/baselines/reference/parser.numericSeparators.decmialNegative.types +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.types @@ -221,3 +221,31 @@ _0.0e-0 >0.00e-0_ : 0 >_0 : any +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts === +._ +>_ : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/48.ts === +1\u005F01234 +>1 : 1 +>\u005F01234 : any + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/49.ts === +1.0e_+10 +>1.0e : 1 +>_+10 : any +>_ : any +>10 : 10 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/50.ts === +1.0e_-10 +>1.0e : 1 +>_-10 : number +>_ : any +>10 : 10 + +=== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/51.ts === +0._ +>0. : 0 +>_ : any + diff --git a/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decmialNegative.ts b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decmialNegative.ts index 5d088e34526af..3c294148c19e7 100644 --- a/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decmialNegative.ts +++ b/tests/cases/conformance/parser/ecmascriptnext/numericSeparators/parser.numericSeparators.decmialNegative.ts @@ -135,3 +135,18 @@ _0.0e-0 // @filename: 46.ts 0.00e-0__0 + +// @filename: 47.ts +._ + +// @filename: 48.ts +1\u005F01234 + +// @filename: 49.ts +1.0e_+10 + +// @filename: 50.ts +1.0e_-10 + +// @filename: 51.ts +0._ From 7ac914dc55687733758f4ef5c7314ceb76cd6705 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 29 Nov 2017 14:40:00 -0800 Subject: [PATCH 08/10] Permissive scanning of excess separators --- src/compiler/scanner.ts | 29 +- ...umericSeparators.binaryNegative.errors.txt | 52 ++- ...parser.numericSeparators.binaryNegative.js | 10 +- ...ser.numericSeparators.binaryNegative.types | 12 +- ...mericSeparators.decmialNegative.errors.txt | 328 ++++++------------ ...arser.numericSeparators.decmialNegative.js | 59 +--- ...er.numericSeparators.decmialNegative.types | 99 ++---- ...r.numericSeparators.hexNegative.errors.txt | 52 ++- .../parser.numericSeparators.hexNegative.js | 10 +- ...parser.numericSeparators.hexNegative.types | 12 +- ...numericSeparators.octalNegative.errors.txt | 52 ++- .../parser.numericSeparators.octalNegative.js | 10 +- ...rser.numericSeparators.octalNegative.types | 12 +- 13 files changed, 245 insertions(+), 492 deletions(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index ee64acae85ab8..93373dbf1f1e0 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -869,10 +869,15 @@ namespace ts { let result: string; while (true) { const ch = text.charCodeAt(pos); - if (allowSeparator && ch === CharacterCodes._) { - allowSeparator = false; + if (ch === CharacterCodes._) { tokenFlags |= TokenFlags.ContainsSeparator; - result = (result || "") + text.substring(start, pos); + if (allowSeparator) { + allowSeparator = false; + result = (result || "") + text.substring(start, pos); + } + else { + error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + } pos++; start = pos; continue; @@ -959,9 +964,14 @@ namespace ts { let allowSeparator = false; while (digits < minCount || scanAsManyAsPossible) { const ch = text.charCodeAt(pos); - if (allowSeparator && ch === CharacterCodes._) { - allowSeparator = false; + if (canHaveSeparators && ch === CharacterCodes._) { tokenFlags |= TokenFlags.ContainsSeparator; + if (allowSeparator) { + allowSeparator = false; + } + else { + error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + } pos++; continue; } @@ -1280,9 +1290,14 @@ namespace ts { while (true) { const ch = text.charCodeAt(pos); // Numeric seperators are allowed anywhere within a numeric literal, except not at the beginning, or following another separator - if (separatorAllowed && ch === CharacterCodes._) { - separatorAllowed = false; + if (ch === CharacterCodes._) { tokenFlags |= TokenFlags.ContainsSeparator; + if (separatorAllowed) { + separatorAllowed = false; + } + else { + error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + } pos++; continue; } diff --git a/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt index e3aea6ff094ba..afb39489b2b4a 100644 --- a/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt @@ -1,17 +1,13 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS1177: Binary digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS2304: Cannot find name '_110'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'B0101'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS2304: Cannot find name '_11'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS2304: Cannot find name '_'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS1177: Binary digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,4): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== @@ -19,12 +15,10 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (1 errors) ==== 0b_110 - -!!! error TS1177: Binary digit expected. - ~~~~ -!!! error TS2304: Cannot find name '_110'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== 0_B0101 @@ -35,28 +29,22 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ~~~~~ !!! error TS2304: Cannot find name 'B0101'. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (1 errors) ==== 0b01__11 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name '_11'. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (1 errors) ==== 0B0110_0110__ - ~ -!!! error TS6188: Numeric separators are not allowed here. - ~ -!!! error TS1005: ';' expected. ~ -!!! error TS2304: Cannot find name '_'. +!!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (3 errors) ==== 0b___0111010_0101_1 - -!!! error TS1177: Binary digit expected. - ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name '___0111010_0101_1'. + ~ +!!! error TS6188: Numeric separators are not allowed here. + ~ +!!! error TS6188: Numeric separators are not allowed here. + ~ +!!! error TS6188: Numeric separators are not allowed here. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.binaryNegative.js b/tests/baselines/reference/parser.numericSeparators.binaryNegative.js index 0b56b65cb7a4a..b6cce556f780d 100644 --- a/tests/baselines/reference/parser.numericSeparators.binaryNegative.js +++ b/tests/baselines/reference/parser.numericSeparators.binaryNegative.js @@ -22,17 +22,13 @@ //// [1.js] 0; //// [2.js] -0; -_110; +6; //// [3.js] 0; B0101; //// [4.js] -1; -_11; +7; //// [5.js] 102; -_; //// [6.js] -0; -___0111010_0101_1; +1867; diff --git a/tests/baselines/reference/parser.numericSeparators.binaryNegative.types b/tests/baselines/reference/parser.numericSeparators.binaryNegative.types index a6a70bf99daa3..14747bae17c38 100644 --- a/tests/baselines/reference/parser.numericSeparators.binaryNegative.types +++ b/tests/baselines/reference/parser.numericSeparators.binaryNegative.types @@ -4,8 +4,7 @@ === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === 0b_110 ->0b : 0 ->_110 : any +>0b_110 : 6 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === 0_B0101 @@ -14,16 +13,13 @@ === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === 0b01__11 ->0b01_ : 1 ->_11 : any +>0b01__11 : 7 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === 0B0110_0110__ ->0B0110_0110_ : 102 ->_ : any +>0B0110_0110__ : 102 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === 0b___0111010_0101_1 ->0b : 0 ->___0111010_0101_1 : any +>0b___0111010_0101_1 : 1867 diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt index b2083c5d04443..ab0262fd863b9 100644 --- a/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt @@ -1,105 +1,61 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,1): error TS2304: Cannot find name '_10'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts(1,4): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,4): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,5): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts(1,3): error TS2304: Cannot find name '_0e0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts(1,4): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts(1,5): error TS1124: Digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts(1,5): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts(1,1): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/17.ts(1,6): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,3): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,4): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,5): error TS2304: Cannot find name '_0e0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts(1,3): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts(1,7): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts(1,8): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts(1,8): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts(1,8): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts(1,4): error TS1124: Digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts(1,4): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts(1,5): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts(1,5): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts(1,6): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts(1,6): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts(1,6): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts(1,3): error TS2304: Cannot find name '_0e'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts(1,4): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts(1,6): error TS1124: Digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts(1,6): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts(1,6): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts(1,1): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/30.ts(1,7): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,3): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts(1,4): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts(1,5): error TS2304: Cannot find name '_0e'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts(1,8): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts(1,9): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts(1,9): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts(1,3): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts(1,5): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts(1,9): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts(1,4): error TS1124: Digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts(1,4): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts(1,5): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,5): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,6): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,6): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts(1,6): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts(1,3): error TS2304: Cannot find name '_0e'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts(1,4): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts(1,6): error TS1124: Digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts(1,6): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts(1,6): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts(1,1): error TS2304: Cannot find name '_0'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/43.ts(1,7): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,3): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,4): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,5): error TS2304: Cannot find name '_0e'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,8): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,9): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,9): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts(1,3): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts(1,5): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts(1,9): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts(1,1): error TS1128: Declaration or statement expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts(1,2): error TS2304: Cannot find name '_'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/48.ts(1,2): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/48.ts(1,2): error TS2304: Cannot find name '\u005F01234'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/49.ts(1,5): error TS1124: Digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/49.ts(1,5): error TS2304: Cannot find name '_'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,3): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/50.ts(1,5): error TS1124: Digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/50.ts(1,5): error TS2304: Cannot find name '_'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/51.ts(1,3): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/51.ts(1,3): error TS2304: Cannot find name '_'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,4): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,4): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,5): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,5): error TS2304: Cannot find name '_'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/49.ts(1,5): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/49.ts(1,6): error TS1124: Digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,3): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/50.ts(1,5): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/50.ts(1,6): error TS1124: Digit expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/51.ts(1,3): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error TS1124: Digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error TS2304: Cannot find name '_0'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== @@ -112,94 +68,70 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (1 errors) ==== 1__0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (1 errors) ==== 0_.0 ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (1 errors) ==== 0._0 - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. + ~ +!!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (1 errors) ==== 0.0__0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts (1 errors) ==== 0.0__ - ~ -!!! error TS6188: Numeric separators are not allowed here. ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS2304: Cannot find name '_'. +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts (1 errors) ==== 0_e0 ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts (1 errors) ==== 0e_0 - -!!! error TS1124: Digit expected. - ~~ -!!! error TS2304: Cannot find name '_0'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts (1 errors) ==== 0e0_ ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts (1 errors) ==== 0e0__0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts (1 errors) ==== 0_.0e0 ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts (1 errors) ==== 0._0e0 - ~~~~ -!!! error TS1005: ';' expected. - ~~~~ -!!! error TS2304: Cannot find name '_0e0'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts (1 errors) ==== 0.0_e0 ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts (1 errors) ==== 0.0e_0 - -!!! error TS1124: Digit expected. - ~~ -!!! error TS2304: Cannot find name '_0'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts (2 errors) ==== _0.0e0 @@ -213,84 +145,60 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts (4 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts (1 errors) ==== 0__0.0e0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. - ~~~~ -!!! error TS1005: ';' expected. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts (1 errors) ==== 0.0__0e0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~~~ -!!! error TS1005: ';' expected. - ~~~~ -!!! error TS2304: Cannot find name '_0e0'. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts (1 errors) ==== 0.00e0__0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts (1 errors) ==== 0_e+0 ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts (1 errors) ==== 0e+_0 - -!!! error TS1124: Digit expected. - ~~ -!!! error TS2304: Cannot find name '_0'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts (1 errors) ==== 0e+0_ ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts (1 errors) ==== 0e+0__0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts (1 errors) ==== 0_.0e+0 ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts (1 errors) ==== 0._0e+0 - ~~~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name '_0e'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts (1 errors) ==== 0.0_e+0 ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts (1 errors) ==== 0.0e+_0 - -!!! error TS1124: Digit expected. - ~~ -!!! error TS2304: Cannot find name '_0'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts (2 errors) ==== _0.0e+0 @@ -304,84 +212,60 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts (4 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts (1 errors) ==== 0__0.0e+0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. - ~~~~~ -!!! error TS1005: ';' expected. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts (1 errors) ==== 0.0__0e+0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name '_0e'. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts (1 errors) ==== 0.00e+0__0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts (1 errors) ==== 0_e+0 ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts (1 errors) ==== 0e-_0 - -!!! error TS1124: Digit expected. - ~~ -!!! error TS2304: Cannot find name '_0'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts (1 errors) ==== 0e-0_ ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts (1 errors) ==== 0e-0__0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts (1 errors) ==== 0_.0e-0 ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts (1 errors) ==== 0._0e-0 - ~~~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name '_0e'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts (1 errors) ==== 0.0_e-0 ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts (1 errors) ==== 0.0e-_0 - -!!! error TS1124: Digit expected. - ~~ -!!! error TS2304: Cannot find name '_0'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts (2 errors) ==== _0.0e-0 @@ -395,34 +279,20 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts (4 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts (1 errors) ==== 0__0.0e-0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. - ~~~~~ -!!! error TS1005: ';' expected. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts (1 errors) ==== 0.0__0e-0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name '_0e'. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts (1 errors) ==== 0.00e-0__0 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~ -!!! error TS1005: ';' expected. - ~~ -!!! error TS2304: Cannot find name '_0'. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts (2 errors) ==== ._ @@ -440,22 +310,20 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/49.ts (2 errors) ==== 1.0e_+10 - -!!! error TS1124: Digit expected. ~ -!!! error TS2304: Cannot find name '_'. +!!! error TS6188: Numeric separators are not allowed here. + +!!! error TS1124: Digit expected. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/50.ts (2 errors) ==== 1.0e_-10 - -!!! error TS1124: Digit expected. ~ -!!! error TS2304: Cannot find name '_'. +!!! error TS6188: Numeric separators are not allowed here. + +!!! error TS1124: Digit expected. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/51.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/51.ts (1 errors) ==== 0._ ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS2304: Cannot find name '_'. +!!! error TS6188: Numeric separators are not allowed here. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.js b/tests/baselines/reference/parser.numericSeparators.decmialNegative.js index ff80f50a536bf..2ccffcc146067 100644 --- a/tests/baselines/reference/parser.numericSeparators.decmialNegative.js +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.js @@ -159,39 +159,31 @@ _10; //// [2.js] 10; //// [3.js] -1; -_0; +10; //// [4.js] 0; //// [5.js] -0.; -_0; +0; //// [6.js] 0; -_0; //// [7.js] 0; -_; //// [8.js] 0; //// [9.js] -0e; -_0; +0; //// [10.js] 0; //// [11.js] 0; -_0; //// [12.js] 0; //// [13.js] -0.; -_0e0; +0; //// [14.js] 0; //// [15.js] -0.0e; -_0; +0; //// [16.js] _0; .0e0; @@ -199,34 +191,26 @@ _0; 0; //// [18.js] 0; -_0; -.0e0; //// [19.js] 0; -_0e0; //// [20.js] 0; -_0; //// [21.js] 0; //// [22.js] -0e+; -_0; +0; //// [23.js] 0; //// [24.js] 0; -_0; //// [25.js] 0; //// [26.js] -0.; -_0e + 0; +0; //// [27.js] 0; //// [28.js] -0.0e+; -_0; +0; //// [29.js] _0; .0e+0; @@ -234,34 +218,26 @@ _0; 0; //// [31.js] 0; -_0; -.0e+0; //// [32.js] 0; -_0e + 0; //// [33.js] 0; -_0; //// [34.js] 0; //// [35.js] -0e-; -_0; +0; //// [36.js] 0; //// [37.js] 0; -_0; //// [38.js] 0; //// [39.js] -0.; -_0e - 0; +0; //// [40.js] 0; //// [41.js] -0.0e-; -_0; +0; //// [42.js] _0; .0e-0; @@ -269,25 +245,18 @@ _0; 0; //// [44.js] 0; -_0; -.0e-0; //// [45.js] 0; -_0e - 0; //// [46.js] 0; -_0; //// [47.js] _; //// [48.js] 1; \u005F01234; //// [49.js] -1.0e; -_ + 10; +1 + 10; //// [50.js] -1.0e; -_ - 10; +1 - 10; //// [51.js] -0.; -_; +0; diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.types b/tests/baselines/reference/parser.numericSeparators.decmialNegative.types index cd2845c4e2c89..84ab9b585b90e 100644 --- a/tests/baselines/reference/parser.numericSeparators.decmialNegative.types +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.types @@ -8,8 +8,7 @@ _10 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === 1__0 ->1_ : 1 ->_0 : any +>1__0 : 10 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === 0_.0 @@ -17,18 +16,15 @@ _10 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === 0._0 ->0. : 0 ->_0 : any +>0._0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === 0.0__0 ->0.0_ : 0 ->_0 : any +>0.0__0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/7.ts === 0.0__ ->0.0_ : 0 ->_ : any +>0.0__ : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/8.ts === 0_e0 @@ -36,8 +32,7 @@ _10 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/9.ts === 0e_0 ->0e : 0 ->_0 : any +>0e_0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/10.ts === 0e0_ @@ -45,8 +40,7 @@ _10 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/11.ts === 0e0__0 ->0e0_ : 0 ->_0 : any +>0e0__0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/12.ts === 0_.0e0 @@ -54,8 +48,7 @@ _10 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/13.ts === 0._0e0 ->0. : 0 ->_0e0 : any +>0._0e0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/14.ts === 0.0_e0 @@ -63,8 +56,7 @@ _10 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/15.ts === 0.0e_0 ->0.0e : 0 ->_0 : any +>0.0e_0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/16.ts === _0.0e0 @@ -77,19 +69,15 @@ _0.0e0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/18.ts === 0__0.0e0 ->0_ : 0 ->_0 : any ->.0e0 : 0 +>0__0.0e0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/19.ts === 0.0__0e0 ->0.0_ : 0 ->_0e0 : any +>0.0__0e0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/20.ts === 0.00e0__0 ->0.00e0_ : 0 ->_0 : any +>0.00e0__0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/21.ts === 0_e+0 @@ -97,8 +85,7 @@ _0.0e0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/22.ts === 0e+_0 ->0e+ : 0 ->_0 : any +>0e+_0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/23.ts === 0e+0_ @@ -106,8 +93,7 @@ _0.0e0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/24.ts === 0e+0__0 ->0e+0_ : 0 ->_0 : any +>0e+0__0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/25.ts === 0_.0e+0 @@ -115,10 +101,7 @@ _0.0e0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/26.ts === 0._0e+0 ->0. : 0 ->_0e+0 : any ->_0e : any ->0 : 0 +>0._0e+0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/27.ts === 0.0_e+0 @@ -126,8 +109,7 @@ _0.0e0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/28.ts === 0.0e+_0 ->0.0e+ : 0 ->_0 : any +>0.0e+_0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/29.ts === _0.0e+0 @@ -140,21 +122,15 @@ _0.0e+0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/31.ts === 0__0.0e+0 ->0_ : 0 ->_0 : any ->.0e+0 : 0 +>0__0.0e+0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/32.ts === 0.0__0e+0 ->0.0_ : 0 ->_0e+0 : any ->_0e : any ->0 : 0 +>0.0__0e+0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/33.ts === 0.00e+0__0 ->0.00e+0_ : 0 ->_0 : any +>0.00e+0__0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/34.ts === 0_e+0 @@ -162,8 +138,7 @@ _0.0e+0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/35.ts === 0e-_0 ->0e- : 0 ->_0 : any +>0e-_0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/36.ts === 0e-0_ @@ -171,8 +146,7 @@ _0.0e+0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/37.ts === 0e-0__0 ->0e-0_ : 0 ->_0 : any +>0e-0__0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/38.ts === 0_.0e-0 @@ -180,10 +154,7 @@ _0.0e+0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/39.ts === 0._0e-0 ->0. : 0 ->_0e-0 : number ->_0e : any ->0 : 0 +>0._0e-0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/40.ts === 0.0_e-0 @@ -191,8 +162,7 @@ _0.0e+0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/41.ts === 0.0e-_0 ->0.0e- : 0 ->_0 : any +>0.0e-_0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/42.ts === _0.0e-0 @@ -205,21 +175,15 @@ _0.0e-0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/44.ts === 0__0.0e-0 ->0_ : 0 ->_0 : any ->.0e-0 : 0 +>0__0.0e-0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/45.ts === 0.0__0e-0 ->0.0_ : 0 ->_0e-0 : number ->_0e : any ->0 : 0 +>0.0__0e-0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/46.ts === 0.00e-0__0 ->0.00e-0_ : 0 ->_0 : any +>0.00e-0__0 : 0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/47.ts === ._ @@ -232,20 +196,17 @@ _0.0e-0 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/49.ts === 1.0e_+10 ->1.0e : 1 ->_+10 : any ->_ : any +>1.0e_+10 : number +>1.0e_ : 1 >10 : 10 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/50.ts === 1.0e_-10 ->1.0e : 1 ->_-10 : number ->_ : any +>1.0e_-10 : number +>1.0e_ : 1 >10 : 10 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/51.ts === 0._ ->0. : 0 ->_ : any +>0._ : 0 diff --git a/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt index f065a7db5ebd3..4fff6f288fb17 100644 --- a/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt @@ -1,17 +1,13 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS1125: Hexadecimal digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS2304: Cannot find name '_110'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'X0101'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS2304: Cannot find name '_11'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS2304: Cannot find name '_'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS1125: Hexadecimal digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,4): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== @@ -19,12 +15,10 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (1 errors) ==== 0x_110 - -!!! error TS1125: Hexadecimal digit expected. - ~~~~ -!!! error TS2304: Cannot find name '_110'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== 0_X0101 @@ -35,28 +29,22 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ~~~~~ !!! error TS2304: Cannot find name 'X0101'. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (1 errors) ==== 0x01__11 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name '_11'. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (1 errors) ==== 0X0110_0110__ - ~ -!!! error TS6188: Numeric separators are not allowed here. - ~ -!!! error TS1005: ';' expected. ~ -!!! error TS2304: Cannot find name '_'. +!!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (3 errors) ==== 0x___0111010_0101_1 - -!!! error TS1125: Hexadecimal digit expected. - ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name '___0111010_0101_1'. + ~ +!!! error TS6188: Numeric separators are not allowed here. + ~ +!!! error TS6188: Numeric separators are not allowed here. + ~ +!!! error TS6188: Numeric separators are not allowed here. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.hexNegative.js b/tests/baselines/reference/parser.numericSeparators.hexNegative.js index 81f1463fc919c..8ac48fcb144b1 100644 --- a/tests/baselines/reference/parser.numericSeparators.hexNegative.js +++ b/tests/baselines/reference/parser.numericSeparators.hexNegative.js @@ -22,17 +22,13 @@ //// [1.js] 0; //// [2.js] -0x; -_110; +272; //// [3.js] 0; X0101; //// [4.js] -1; -_11; +273; //// [5.js] 17826064; -_; //// [6.js] -0x; -___0111010_0101_1; +1172542853137; diff --git a/tests/baselines/reference/parser.numericSeparators.hexNegative.types b/tests/baselines/reference/parser.numericSeparators.hexNegative.types index f4ce73a05a4df..fa48c933bdc0a 100644 --- a/tests/baselines/reference/parser.numericSeparators.hexNegative.types +++ b/tests/baselines/reference/parser.numericSeparators.hexNegative.types @@ -4,8 +4,7 @@ === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === 0x_110 ->0x : 0 ->_110 : any +>0x_110 : 272 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === 0_X0101 @@ -14,16 +13,13 @@ === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === 0x01__11 ->0x01_ : 1 ->_11 : any +>0x01__11 : 273 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === 0X0110_0110__ ->0X0110_0110_ : 17826064 ->_ : any +>0X0110_0110__ : 17826064 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === 0x___0111010_0101_1 ->0x : 0 ->___0111010_0101_1 : any +>0x___0111010_0101_1 : 1172542853137 diff --git a/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt index 54f00e7465a65..6f877a6c75201 100644 --- a/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt @@ -1,17 +1,13 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS1178: Octal digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS2304: Cannot find name '_110'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'O0101'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,5): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS2304: Cannot find name '_11'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,12): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS1005: ';' expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS2304: Cannot find name '_'. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS1178: Octal digit expected. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS2304: Cannot find name '___0111010_0101_1'. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,4): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts (1 errors) ==== @@ -19,12 +15,10 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ~ !!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts (1 errors) ==== 0o_110 - -!!! error TS1178: Octal digit expected. - ~~~~ -!!! error TS2304: Cannot find name '_110'. + ~ +!!! error TS6188: Numeric separators are not allowed here. ==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts (3 errors) ==== 0_O0101 @@ -35,28 +29,22 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,3): error ~~~~~ !!! error TS2304: Cannot find name 'O0101'. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts (1 errors) ==== 0o01__11 - ~ + ~ !!! error TS6188: Numeric separators are not allowed here. - ~~~ -!!! error TS1005: ';' expected. - ~~~ -!!! error TS2304: Cannot find name '_11'. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts (1 errors) ==== 0O0110_0110__ - ~ -!!! error TS6188: Numeric separators are not allowed here. - ~ -!!! error TS1005: ';' expected. ~ -!!! error TS2304: Cannot find name '_'. +!!! error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts (3 errors) ==== 0o___0111010_0101_1 - -!!! error TS1178: Octal digit expected. - ~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name '___0111010_0101_1'. + ~ +!!! error TS6188: Numeric separators are not allowed here. + ~ +!!! error TS6188: Numeric separators are not allowed here. + ~ +!!! error TS6188: Numeric separators are not allowed here. \ No newline at end of file diff --git a/tests/baselines/reference/parser.numericSeparators.octalNegative.js b/tests/baselines/reference/parser.numericSeparators.octalNegative.js index 484833c11a02f..d265869d1e48a 100644 --- a/tests/baselines/reference/parser.numericSeparators.octalNegative.js +++ b/tests/baselines/reference/parser.numericSeparators.octalNegative.js @@ -22,17 +22,13 @@ //// [1.js] 0; //// [2.js] -0; -_110; +72; //// [3.js] 0; O0101; //// [4.js] -1; -_11; +73; //// [5.js] 294984; -_; //// [6.js] -0; -___0111010_0101_1; +1224999433; diff --git a/tests/baselines/reference/parser.numericSeparators.octalNegative.types b/tests/baselines/reference/parser.numericSeparators.octalNegative.types index bf614c0d2b2ac..5479030d794a5 100644 --- a/tests/baselines/reference/parser.numericSeparators.octalNegative.types +++ b/tests/baselines/reference/parser.numericSeparators.octalNegative.types @@ -4,8 +4,7 @@ === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts === 0o_110 ->0o : 0 ->_110 : any +>0o_110 : 72 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts === 0_O0101 @@ -14,16 +13,13 @@ === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts === 0o01__11 ->0o01_ : 1 ->_11 : any +>0o01__11 : 73 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts === 0O0110_0110__ ->0O0110_0110_ : 294984 ->_ : any +>0O0110_0110__ : 294984 === tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts === 0o___0111010_0101_1 ->0o : 0 ->___0111010_0101_1 : any +>0o___0111010_0101_1 : 1224999433 From 11dddbb91240a8f37ddaa9b2d3c0280d7ad01979 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 29 Nov 2017 14:42:17 -0800 Subject: [PATCH 09/10] Remove unnecessary assignment --- src/compiler/scanner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 93373dbf1f1e0..9c8635f6b3f60 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -892,7 +892,7 @@ namespace ts { if (text.charCodeAt(pos - 1) === CharacterCodes._) { error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); } - return result = (result || "") + text.substring(start, pos); + return (result || "") + text.substring(start, pos); } function scanNumber(): string { From c2b81ec6a577c26afadf5d81ab7d2c9ae22a79e6 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 29 Nov 2017 18:12:17 -0800 Subject: [PATCH 10/10] Make code easier to follow --- src/compiler/scanner.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 9c8635f6b3f60..43f8249790179 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -866,14 +866,14 @@ namespace ts { function scanNumberFragment(): string { let start = pos; let allowSeparator = false; - let result: string; + let result = ""; while (true) { const ch = text.charCodeAt(pos); if (ch === CharacterCodes._) { tokenFlags |= TokenFlags.ContainsSeparator; if (allowSeparator) { allowSeparator = false; - result = (result || "") + text.substring(start, pos); + result += text.substring(start, pos); } else { error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); @@ -892,7 +892,7 @@ namespace ts { if (text.charCodeAt(pos - 1) === CharacterCodes._) { error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); } - return (result || "") + text.substring(start, pos); + return result + text.substring(start, pos); } function scanNumber(): string {