From 0f211b754110257c3b8c9259f4e8183372828931 Mon Sep 17 00:00:00 2001 From: graphemecluster Date: Wed, 14 Dec 2022 07:48:13 +0800 Subject: [PATCH] Bug Fix Fix Numeric Literals Emission --- src/compiler/emitter.ts | 8 +- src/compiler/parser.ts | 4 +- src/compiler/scanner.ts | 27 ++-- src/compiler/transformers/taggedTemplate.ts | 2 +- src/compiler/types.ts | 28 ++-- src/compiler/utilities.ts | 9 +- tests/baselines/reference/isLiteral1.js | 2 +- tests/baselines/reference/isLiteral2.js | 2 +- tests/baselines/reference/literals.errors.txt | 8 +- tests/baselines/reference/literals.js | 4 +- .../numberLiteralsWithLeadingZeros.errors.txt | 56 +++---- .../numberLiteralsWithLeadingZeros.js | 82 +++++------ .../reference/objectLiteralErrors.errors.txt | 139 ++++++++++++++++-- .../reference/objectLiteralErrors.js | 8 +- .../reference/objectLiteralErrors.symbols | 10 +- .../reference/objectLiteralErrors.types | 12 +- ...bjectTypeWithStringNamedNumericProperty.js | 16 +- ...TypeWithStringNamedNumericProperty.symbols | 4 + .../octalLiteralAndEscapeSequence.errors.txt | 24 +-- .../octalLiteralAndEscapeSequence.js | 30 ++-- .../reference/octalLiteralInStrictModeES3.js | 2 +- tests/baselines/reference/parseBigInt.js | 2 +- .../reference/plainJSBinderErrors.errors.txt | 25 +++- .../reference/plainJSBinderErrors.js | 4 +- .../reference/plainJSBinderErrors.symbols | 2 +- .../reference/plainJSBinderErrors.types | 4 +- .../propertyAccessNumericLiterals.errors.txt | 25 +++- .../propertyAccessNumericLiterals.js | 18 ++- .../propertyAccessNumericLiterals.symbols | 28 ++++ .../propertyAccessNumericLiterals.types | 42 ++++++ .../reference/scannerES3NumericLiteral2.js | 2 +- .../reference/scannerES3NumericLiteral3.js | 2 +- .../reference/scannerNumericLiteral2.js | 2 +- .../reference/scannerNumericLiteral3.js | 2 +- .../reference/scannerNumericLiteral8.js | 2 +- .../reference/scannerNumericLiteral9.js | 2 +- .../reference/strictModeOctalLiterals.js | 2 +- .../templateLiteralEscapeSequence.errors.txt | 16 +- .../templateLiteralEscapeSequence.js | 20 +-- .../objectLiterals/objectLiteralErrors.ts | 4 +- .../propertyAccessNumericLiterals.ts | 10 +- .../conformance/salsa/plainJSBinderErrors.ts | 2 +- 42 files changed, 476 insertions(+), 217 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d753f1b7e4c36..d66ad3bbb5797 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -411,6 +411,7 @@ import { TemplateSpan, TextRange, ThrowStatement, + TokenFlags, tokenToString, tracing, TransformationResult, @@ -2995,9 +2996,12 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri if (isNumericLiteral(expression)) { // check if numeric literal is a decimal literal that was originally written with a dot const text = getLiteralTextOfNode(expression as LiteralExpression, /*neverAsciiEscape*/ true, /*jsxAttributeEscape*/ false); - // If he number will be printed verbatim and it doesn't already contain a dot, add one + // If the number will be printed verbatim and it doesn't already contain a dot or an exponent indicator, add one // if the expression doesn't have any comments that will be emitted. - return !expression.numericLiteralFlags && !stringContains(text, tokenToString(SyntaxKind.DotToken)!); + return !(expression.numericLiteralFlags & TokenFlags.WithSpecifier) + && !stringContains(text, tokenToString(SyntaxKind.DotToken)!) + && !stringContains(text, String.fromCharCode(CharacterCodes.E)) + && !stringContains(text, String.fromCharCode(CharacterCodes.e)); } else if (isAccessExpression(expression)) { // check if constant enum value is integer diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index e8de1c366ba20..ac4bea404c820 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3607,7 +3607,7 @@ namespace Parser { } function parseTemplateHead(isTaggedTemplate: boolean): TemplateHead { - if (!isTaggedTemplate && scanner.getTokenFlags() & TokenFlags.ContainsInvalidEscape) { + if (!isTaggedTemplate && scanner.getTokenFlags() & TokenFlags.IsInvalid) { reScanTemplateHeadOrNoSubstitutionTemplate(); } const fragment = parseLiteralLikeNode(token()); @@ -6415,7 +6415,7 @@ namespace Parser { function parsePrimaryExpression(): PrimaryExpression { switch (token()) { case SyntaxKind.NoSubstitutionTemplateLiteral: - if (scanner.getTokenFlags() & TokenFlags.ContainsInvalidEscape) { + if (scanner.getTokenFlags() & TokenFlags.IsInvalid) { reScanTemplateHeadOrNoSubstitutionTemplate(); } // falls through diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 805dd25bc9c30..0122385730e14 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -1073,11 +1073,14 @@ export function createScanner(languageVersion: ScriptTarget, isPreviousTokenSeparator = true; result += text.substring(start, pos); } - else if (isPreviousTokenSeparator) { - error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); - } else { - error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + tokenFlags |= TokenFlags.ContainsInvalidSeparator; + if (isPreviousTokenSeparator) { + error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); + } + else { + error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + } } pos++; start = pos; @@ -1092,6 +1095,7 @@ export function createScanner(languageVersion: ScriptTarget, break; } if (text.charCodeAt(pos - 1) === CharacterCodes._) { + tokenFlags |= TokenFlags.ContainsInvalidSeparator; error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); } return result + text.substring(start, pos); @@ -1120,10 +1124,10 @@ export function createScanner(languageVersion: ScriptTarget, function scanNumber(): { type: SyntaxKind, value: string } { let start = pos; let mainFragment: string; - let emitLeadingZeroError = false; if (text.charCodeAt(pos) === CharacterCodes._0) { pos++; if (text.charCodeAt(pos) === CharacterCodes._) { + tokenFlags |= TokenFlags.ContainsSeparator | TokenFlags.ContainsInvalidSeparator; error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); // treat it as a normal number literal pos--; @@ -1133,8 +1137,8 @@ export function createScanner(languageVersion: ScriptTarget, else if (!scanDigits()) { // NonOctalDecimalIntegerLiteral, emit error later // Separators in decimal and exponent parts are still allowed according to the spec - emitLeadingZeroError = true; - mainFragment = tokenValue; + tokenFlags |= TokenFlags.ContainsLeadingZero; + mainFragment = "" + +tokenValue; } else if (!tokenValue) { // a single zero @@ -1142,11 +1146,12 @@ export function createScanner(languageVersion: ScriptTarget, } else { // LegacyOctalIntegerLiteral - tokenValue = "0o" + tokenValue; + tokenValue = "" + parseInt(tokenValue, 8); tokenFlags |= TokenFlags.Octal; const withMinus = token === SyntaxKind.MinusToken; + const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8); start -= +withMinus; - error(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start, pos - start, (withMinus ? "-" : "") + tokenValue); + error(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start, pos - start, literal); return { type: SyntaxKind.NumericLiteral, value: tokenValue }; } } @@ -1188,10 +1193,10 @@ export function createScanner(languageVersion: ScriptTarget, result = text.substring(start, end); // No need to use all the fragments; no _ removal needed } - if (emitLeadingZeroError) { + if (tokenFlags & TokenFlags.ContainsLeadingZero) { error(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start, end - start); // if a literal has a leading zero, it must not be bigint - return { type: SyntaxKind.NumericLiteral, value: result }; + return { type: SyntaxKind.NumericLiteral, value: "" + +result }; } if (decimalFragment !== undefined || tokenFlags & TokenFlags.Scientific) { diff --git a/src/compiler/transformers/taggedTemplate.ts b/src/compiler/transformers/taggedTemplate.ts index c7a6e61da94da..b2e2f9298ae5d 100644 --- a/src/compiler/transformers/taggedTemplate.ts +++ b/src/compiler/transformers/taggedTemplate.ts @@ -94,7 +94,7 @@ export function processTaggedTemplateExpression( } function createTemplateCooked(template: TemplateHead | TemplateMiddle | TemplateTail | NoSubstitutionTemplateLiteral) { - return template.templateFlags! & TokenFlags.ContainsInvalidEscape ? factory.createVoidZero() : factory.createStringLiteral(template.text); + return template.templateFlags! & TokenFlags.IsInvalid ? factory.createVoidZero() : factory.createStringLiteral(template.text); } /** diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 319a22a5748fd..1fb6ed23f6b0c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2793,28 +2793,36 @@ export const enum TokenFlags { /** @internal */ Unterminated = 1 << 2, /** @internal */ - ExtendedUnicodeEscape = 1 << 3, - Scientific = 1 << 4, // e.g. `10e2` - Octal = 1 << 5, // e.g. `0777` - HexSpecifier = 1 << 6, // e.g. `0x00000000` - BinarySpecifier = 1 << 7, // e.g. `0b0110010000000000` - OctalSpecifier = 1 << 8, // e.g. `0o777` + ExtendedUnicodeEscape = 1 << 3, // e.g. `\u{10ffff}` + Scientific = 1 << 4, // e.g. `10e2` + Octal = 1 << 5, // e.g. `0777` + HexSpecifier = 1 << 6, // e.g. `0x00000000` + BinarySpecifier = 1 << 7, // e.g. `0b0110010000000000` + OctalSpecifier = 1 << 8, // e.g. `0o777` /** @internal */ - ContainsSeparator = 1 << 9, // e.g. `0b1100_0101` + ContainsSeparator = 1 << 9, // e.g. `0b1100_0101` /** @internal */ - UnicodeEscape = 1 << 10, // e.g. `\u00a0` + UnicodeEscape = 1 << 10, // e.g. `\u00a0` /** @internal */ ContainsInvalidEscape = 1 << 11, // e.g. `\uhello` /** @internal */ - HexEscape = 1 << 12, // e.g. `\xa0` + HexEscape = 1 << 12, // e.g. `\xa0` + /** @internal */ + ContainsLeadingZero = 1 << 13, // e.g. `0888` + /** @internal */ + ContainsInvalidSeparator = 1 << 14, // e.g. `0_1` /** @internal */ BinaryOrOctalSpecifier = BinarySpecifier | OctalSpecifier, /** @internal */ + WithSpecifier = HexSpecifier | BinaryOrOctalSpecifier, + /** @internal */ StringLiteralFlags = HexEscape | UnicodeEscape | ExtendedUnicodeEscape | ContainsInvalidEscape, /** @internal */ - NumericLiteralFlags = Scientific | Octal | HexSpecifier | BinaryOrOctalSpecifier | ContainsSeparator, + NumericLiteralFlags = Scientific | Octal | ContainsLeadingZero | WithSpecifier | ContainsSeparator | ContainsInvalidSeparator, /** @internal */ TemplateLiteralLikeFlags = HexEscape | UnicodeEscape | ExtendedUnicodeEscape | ContainsInvalidEscape, + /** @internal */ + IsInvalid = Octal | ContainsLeadingZero | ContainsInvalidSeparator | ContainsInvalidEscape, } export interface NumericLiteral extends LiteralExpression, Declaration { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 826f6e663b2ff..58748669dc2f6 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1331,8 +1331,13 @@ function canUseOriginalText(node: LiteralLikeNode, flags: GetLiteralTextFlags): return false; } - if (isNumericLiteral(node) && node.numericLiteralFlags & TokenFlags.ContainsSeparator) { - return !!(flags & GetLiteralTextFlags.AllowNumericSeparator); + if (isNumericLiteral(node)) { + if (node.numericLiteralFlags & TokenFlags.IsInvalid) { + return false; + } + if (node.numericLiteralFlags & TokenFlags.ContainsSeparator) { + return !!(flags & GetLiteralTextFlags.AllowNumericSeparator); + } } return !isBigIntLiteral(node); diff --git a/tests/baselines/reference/isLiteral1.js b/tests/baselines/reference/isLiteral1.js index e688eef72c3c7..6e5b6fbe77e8a 100644 --- a/tests/baselines/reference/isLiteral1.js +++ b/tests/baselines/reference/isLiteral1.js @@ -2,4 +2,4 @@ var x: number = 02343; //// [isLiteral1.js] -var x = 02343; +var x = 1251; diff --git a/tests/baselines/reference/isLiteral2.js b/tests/baselines/reference/isLiteral2.js index 3987c4e89b453..5d8aae2a8381b 100644 --- a/tests/baselines/reference/isLiteral2.js +++ b/tests/baselines/reference/isLiteral2.js @@ -2,4 +2,4 @@ var x: number = 02343 //// [isLiteral2.js] -var x = 02343; +var x = 1251; diff --git a/tests/baselines/reference/literals.errors.txt b/tests/baselines/reference/literals.errors.txt index 0d434c1fa5ead..027aca69a63c8 100644 --- a/tests/baselines/reference/literals.errors.txt +++ b/tests/baselines/reference/literals.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/expressions/literals/literals.ts(8,10): error TS18050: T tests/cases/conformance/expressions/literals/literals.ts(8,17): error TS18050: The value 'null' cannot be used here. tests/cases/conformance/expressions/literals/literals.ts(9,9): error TS18050: The value 'undefined' cannot be used here. tests/cases/conformance/expressions/literals/literals.ts(9,21): error TS18050: The value 'undefined' cannot be used here. -tests/cases/conformance/expressions/literals/literals.ts(19,9): error TS1121: Octal literals are not allowed. Use the syntax '0o01'. -tests/cases/conformance/expressions/literals/literals.ts(24,9): error TS1121: Octal literals are not allowed. Use the syntax '-0o03'. +tests/cases/conformance/expressions/literals/literals.ts(19,9): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. +tests/cases/conformance/expressions/literals/literals.ts(24,9): error TS1121: Octal literals are not allowed. Use the syntax '-0o3'. ==== tests/cases/conformance/expressions/literals/literals.ts (6 errors) ==== @@ -35,14 +35,14 @@ tests/cases/conformance/expressions/literals/literals.ts(24,9): error TS1121: Oc var n = 1e4; var n = 001; // Error in ES5 ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o1'. var n = 0x1; var n = -1; var n = -1.0; var n = -1e-4; var n = -003; // Error in ES5 ~~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '-0o03'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '-0o3'. var n = -0x1; var s: string; diff --git a/tests/baselines/reference/literals.js b/tests/baselines/reference/literals.js index 9f8d8f56be925..c5280f10f423e 100644 --- a/tests/baselines/reference/literals.js +++ b/tests/baselines/reference/literals.js @@ -54,12 +54,12 @@ var n; var n = 1; var n = 1.0; var n = 1e4; -var n = 001; // Error in ES5 +var n = 1; // Error in ES5 var n = 0x1; var n = -1; var n = -1.0; var n = -1e-4; -var n = -003; // Error in ES5 +var n = -3; // Error in ES5 var n = -0x1; var s; var s = ''; diff --git a/tests/baselines/reference/numberLiteralsWithLeadingZeros.errors.txt b/tests/baselines/reference/numberLiteralsWithLeadingZeros.errors.txt index 6068c33c41348..9677a9707015b 100644 --- a/tests/baselines/reference/numberLiteralsWithLeadingZeros.errors.txt +++ b/tests/baselines/reference/numberLiteralsWithLeadingZeros.errors.txt @@ -1,74 +1,74 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(1,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(2,1): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(2,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(3,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(4,1): error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(4,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(5,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(6,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(8,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(8,3): error TS1005: ';' expected. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(9,1): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(9,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(9,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(10,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(10,3): error TS1005: ';' expected. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(11,1): error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(11,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(11,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(12,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(13,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(15,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(15,3): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(15,3): error TS2304: Cannot find name 'e5'. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(16,1): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(16,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(16,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(16,4): error TS2304: Cannot find name 'e5'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(17,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(17,3): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(17,3): error TS2304: Cannot find name 'e5'. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(18,1): error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(18,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(18,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(18,4): error TS2304: Cannot find name 'e5'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(19,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(20,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(22,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(22,3): error TS1005: ';' expected. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(23,1): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(23,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(23,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(24,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(24,3): error TS1005: ';' expected. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(25,1): error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(25,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(25,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(26,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(27,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(29,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(29,3): error TS1005: ';' expected. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(30,1): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(30,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(30,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(31,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(31,3): error TS1005: ';' expected. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(32,1): error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(32,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(32,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(33,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(34,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(36,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(36,3): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(36,3): error TS2304: Cannot find name 'e5_5'. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(37,1): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(37,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(37,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(37,4): error TS2304: Cannot find name 'e5_5'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(38,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(38,3): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(38,3): error TS2304: Cannot find name 'e5_5'. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(39,1): error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(39,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(39,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(39,4): error TS2304: Cannot find name 'e5_5'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(40,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(41,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(43,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(43,3): error TS1005: ';' expected. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(44,1): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(44,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(44,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(45,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(45,3): error TS1005: ';' expected. -tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(46,1): error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(46,1): error TS1121: Octal literals are not allowed. Use the syntax '0o1'. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(46,4): error TS1005: ';' expected. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(47,1): error TS1486: Decimals with leading zeros are not allowed. tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(48,1): error TS1486: Decimals with leading zeros are not allowed. @@ -107,13 +107,13 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. 000; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. 01; ~~ !!! error TS1121: Octal literals are not allowed. Use the syntax '0o1'. 001; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o1'. 08; ~~ !!! error TS1486: Decimals with leading zeros are not allowed. @@ -128,7 +128,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS1005: ';' expected. 000.5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. ~~ !!! error TS1005: ';' expected. 01.5; @@ -138,7 +138,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS1005: ';' expected. 001.5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o1'. ~~ !!! error TS1005: ';' expected. 08.5; @@ -157,7 +157,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS2304: Cannot find name 'e5'. 000e5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. ~~ !!! error TS1005: ';' expected. ~~ @@ -171,7 +171,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS2304: Cannot find name 'e5'. 001e5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o1'. ~~ !!! error TS1005: ';' expected. ~~ @@ -190,7 +190,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS1005: ';' expected. 000.5e5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. ~~~~ !!! error TS1005: ';' expected. 01.5e5; @@ -200,7 +200,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS1005: ';' expected. 001.5e5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o1'. ~~~~ !!! error TS1005: ';' expected. 08.5e5; @@ -217,7 +217,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS1005: ';' expected. 000.5_5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. ~~~~ !!! error TS1005: ';' expected. 01.5_5; @@ -227,7 +227,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS1005: ';' expected. 001.5_5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o1'. ~~~~ !!! error TS1005: ';' expected. 08.5_5; @@ -246,7 +246,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS2304: Cannot find name 'e5_5'. 000e5_5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. ~~~~ !!! error TS1005: ';' expected. ~~~~ @@ -260,7 +260,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS2304: Cannot find name 'e5_5'. 001e5_5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o1'. ~~~~ !!! error TS1005: ';' expected. ~~~~ @@ -279,7 +279,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS1005: ';' expected. 000.5_5e5_5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. ~~~~~~~~ !!! error TS1005: ';' expected. 01.5_5e5_5; @@ -289,7 +289,7 @@ tests/cases/compiler/numberLiteralsWithLeadingZeros.ts(78,2): error TS6188: Nume !!! error TS1005: ';' expected. 001.5_5e5_5; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o01'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o1'. ~~~~~~~~ !!! error TS1005: ';' expected. 08.5_5e5_5; diff --git a/tests/baselines/reference/numberLiteralsWithLeadingZeros.js b/tests/baselines/reference/numberLiteralsWithLeadingZeros.js index 967e6602bd865..8bd236ef57ec9 100644 --- a/tests/baselines/reference/numberLiteralsWithLeadingZeros.js +++ b/tests/baselines/reference/numberLiteralsWithLeadingZeros.js @@ -80,72 +80,72 @@ //// [numberLiteralsWithLeadingZeros.js] -00; -000; -01; -001; -08; -008; -00; +0; +0; +1; +1; +8; +8; +0; .5; -000; +0; .5; -01; +1; .5; -001; +1; .5; -08.5; -008.5; -00; +8.5; +8.5; +0; e5; -000; +0; e5; -01; +1; e5; -001; +1; e5; -08e5; -008e5; -00; +800000; +800000; +0; .5e5; -000; +0; .5e5; -01; +1; .5e5; -001; +1; .5e5; -08.5e5; -008.5e5; -00; +850000; +850000; +0; 0.55; -000; +0; 0.55; -01; +1; 0.55; -001; +1; 0.55; 8.55; -08.55; -00; +8.55; +0; e5_5; -000; +0; e5_5; -01; +1; e5_5; -001; +1; e5_5; -8e55; -08e55; -00; +8e+55; +8e+55; +0; 5.5e+54; -000; +0; 5.5e+54; -01; +1; 5.5e+54; -001; +1; 5.5e+54; -8.55e55; -08.55e55; +8.55e+55; +8.55e+55; 0.55; 0.55; 0.55; diff --git a/tests/baselines/reference/objectLiteralErrors.errors.txt b/tests/baselines/reference/objectLiteralErrors.errors.txt index 2ad0919898813..d753695e6aa10 100644 --- a/tests/baselines/reference/objectLiteralErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralErrors.errors.txt @@ -1,163 +1,266 @@ -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'e14' must be of type '{ 0: number; }', but here has type '{ 0: number; "0o00": number; }'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(2,18): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,19): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(4,18): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(5,21): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(6,19): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(7,18): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(8,20): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(9,20): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(10,20): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(11,21): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(12,21): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,19): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(14,19): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,19): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,23): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,22): error TS1117: An object literal cannot have multiple properties with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,25): error TS1117: An object literal cannot have multiple properties with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(22,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(22,22): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(22,22): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,23): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,22): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,22): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,25): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,25): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,23): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,22): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,22): error TS2300: Duplicate identifier ''a''. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,24): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,24): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS2300: Duplicate identifier '"a"'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS2300: Duplicate identifier ''a''. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,13): error TS2300: Duplicate identifier '"a"'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,25): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,25): error TS2300: Duplicate identifier ''a''. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,13): error TS2300: Duplicate identifier '1.0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS2300: Duplicate identifier ''1''. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,23): error TS2300: Duplicate identifier '0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS2300: Duplicate identifier '0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS2300: Duplicate identifier '0x0'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f14' must be of type '{ readonly 0: number; }', but here has type '{ 0: number; readonly "0o00": number; }'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS1119: An object literal cannot have property and accessor with the same name. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS2300: Duplicate identifier '0o0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,13): error TS2300: Duplicate identifier '"100"'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,27): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,27): error TS2300: Duplicate identifier '1e2'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,13): error TS2300: Duplicate identifier '0x20'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,26): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,26): error TS2300: Duplicate identifier '3.2e1'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,13): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,46): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,46): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(42,16): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,22): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,16): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(48,7): error TS1312: Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(49,7): error TS1312: Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(50,5): error TS18016: Private identifiers are not allowed outside class bodies. -==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (41 errors) ==== +==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (78 errors) ==== // Multiple properties with the same name var e1 = { a: 0, a: 0 }; + ~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e2 = { a: '', a: '' }; + ~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e3 = { a: 0, a: '' }; + ~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e4 = { a: true, a: false }; + ~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e5 = { a: {}, a: {} }; + ~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e6 = { a: 0, 'a': 0 }; + ~~~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e7 = { 'a': 0, a: 0 }; + ~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e8 = { 'a': 0, "a": 0 }; + ~~~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e9 = { 'a': 0, 'a': 0 }; + ~~~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e10 = { "a": 0, 'a': 0 }; + ~~~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e11 = { 1.0: 0, '1': 0 }; + ~~~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e12 = { 0: 0, 0: 0 }; + ~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e13 = { 0: 0, 0: 0 }; + ~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e14 = { 0: 0, 0x0: 0 }; - var e14 = { 0: 0, 000: 0 }; - ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'e14' must be of type '{ 0: number; }', but here has type '{ 0: number; "0o00": number; }'. -!!! related TS6203 tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts:15:5: 'e14' was also declared here. ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1117: An object literal cannot have multiple properties with the same name. + var e14 = { 0: 0, 0o0: 0 }; + ~~~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e15 = { "100": 0, 1e2: 0 }; + ~~~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e16 = { 0x20: 0, 3.2e1: 0 }; + ~~~~~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. var e17 = { a: 0, b: 1, a: 0 }; + ~ +!!! error TS1117: An object literal cannot have multiple properties with the same name. // Accessor and property with the same name var f1 = { a: 0, get a() { return 0; } }; ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f2 = { a: '', get a() { return ''; } }; ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f3 = { a: 0, get a() { return ''; } }; ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f4 = { a: true, get a() { return false; } }; ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f5 = { a: {}, get a() { return {}; } }; ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f6 = { a: 0, get 'a'() { return 0; } }; ~ !!! error TS2300: Duplicate identifier 'a'. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier ''a''. var f7 = { 'a': 0, get a() { return 0; } }; ~~~ !!! error TS2300: Duplicate identifier ''a''. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f8 = { 'a': 0, get "a"() { return 0; } }; ~~~ !!! error TS2300: Duplicate identifier ''a''. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier '"a"'. var f9 = { 'a': 0, get 'a'() { return 0; } }; ~~~ !!! error TS2300: Duplicate identifier ''a''. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier ''a''. var f10 = { "a": 0, get 'a'() { return 0; } }; ~~~ !!! error TS2300: Duplicate identifier '"a"'. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier ''a''. var f11 = { 1.0: 0, get '1'() { return 0; } }; ~~~ !!! error TS2300: Duplicate identifier '1.0'. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier ''1''. var f12 = { 0: 0, get 0() { return 0; } }; ~ !!! error TS2300: Duplicate identifier '0'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier '0'. var f13 = { 0: 0, get 0() { return 0; } }; ~ !!! error TS2300: Duplicate identifier '0'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier '0'. var f14 = { 0: 0, get 0x0() { return 0; } }; ~ !!! error TS2300: Duplicate identifier '0'. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier '0x0'. - var f14 = { 0: 0, get 000() { return 0; } }; - ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f14' must be of type '{ readonly 0: number; }', but here has type '{ 0: number; readonly "0o00": number; }'. -!!! related TS6203 tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts:35:5: 'f14' was also declared here. + var f14 = { 0: 0, get 0o0() { return 0; } }; + ~ +!!! error TS2300: Duplicate identifier '0'. + ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS2300: Duplicate identifier '0o0'. var f15 = { "100": 0, get 1e2() { return 0; } }; ~~~~~ !!! error TS2300: Duplicate identifier '"100"'. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier '1e2'. var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; ~~~~ !!! error TS2300: Duplicate identifier '0x20'. ~~~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~~~ !!! error TS2300: Duplicate identifier '3.2e1'. var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. // Get and set accessor with mismatched type annotations @@ -174,7 +277,13 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,16) // did you mean colon errors var h1 = { x = 1, + ~ +!!! error TS1312: Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern. y = 2, + ~ +!!! error TS1312: Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern. #z: 3 + ~~ +!!! error TS18016: Private identifiers are not allowed outside class bodies. } \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralErrors.js b/tests/baselines/reference/objectLiteralErrors.js index 576e23b0b78d0..4da3e1bd5d564 100644 --- a/tests/baselines/reference/objectLiteralErrors.js +++ b/tests/baselines/reference/objectLiteralErrors.js @@ -14,7 +14,7 @@ var e11 = { 1.0: 0, '1': 0 }; var e12 = { 0: 0, 0: 0 }; var e13 = { 0: 0, 0: 0 }; var e14 = { 0: 0, 0x0: 0 }; -var e14 = { 0: 0, 000: 0 }; +var e14 = { 0: 0, 0o0: 0 }; var e15 = { "100": 0, 1e2: 0 }; var e16 = { 0x20: 0, 3.2e1: 0 }; var e17 = { a: 0, b: 1, a: 0 }; @@ -34,7 +34,7 @@ var f11 = { 1.0: 0, get '1'() { return 0; } }; var f12 = { 0: 0, get 0() { return 0; } }; var f13 = { 0: 0, get 0() { return 0; } }; var f14 = { 0: 0, get 0x0() { return 0; } }; -var f14 = { 0: 0, get 000() { return 0; } }; +var f14 = { 0: 0, get 0o0() { return 0; } }; var f15 = { "100": 0, get 1e2() { return 0; } }; var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; @@ -68,7 +68,7 @@ var e11 = { 1.0: 0, '1': 0 }; var e12 = { 0: 0, 0: 0 }; var e13 = { 0: 0, 0: 0 }; var e14 = { 0: 0, 0x0: 0 }; -var e14 = { 0: 0, 000: 0 }; +var e14 = { 0: 0, 0: 0 }; var e15 = { "100": 0, 1e2: 0 }; var e16 = { 0x20: 0, 3.2e1: 0 }; var e17 = { a: 0, b: 1, a: 0 }; @@ -87,7 +87,7 @@ var f11 = { 1.0: 0, get '1'() { return 0; } }; var f12 = { 0: 0, get 0() { return 0; } }; var f13 = { 0: 0, get 0() { return 0; } }; var f14 = { 0: 0, get 0x0() { return 0; } }; -var f14 = { 0: 0, get 000() { return 0; } }; +var f14 = { 0: 0, get 0o0() { return 0; } }; var f15 = { "100": 0, get 1e2() { return 0; } }; var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; diff --git a/tests/baselines/reference/objectLiteralErrors.symbols b/tests/baselines/reference/objectLiteralErrors.symbols index 020fb20dbc9bf..b31666caafb91 100644 --- a/tests/baselines/reference/objectLiteralErrors.symbols +++ b/tests/baselines/reference/objectLiteralErrors.symbols @@ -70,10 +70,10 @@ var e14 = { 0: 0, 0x0: 0 }; >0 : Symbol(0, Decl(objectLiteralErrors.ts, 14, 11), Decl(objectLiteralErrors.ts, 14, 17)) >0x0 : Symbol(0, Decl(objectLiteralErrors.ts, 14, 11), Decl(objectLiteralErrors.ts, 14, 17)) -var e14 = { 0: 0, 000: 0 }; +var e14 = { 0: 0, 0o0: 0 }; >e14 : Symbol(e14, Decl(objectLiteralErrors.ts, 14, 3), Decl(objectLiteralErrors.ts, 15, 3)) ->0 : Symbol(0, Decl(objectLiteralErrors.ts, 15, 11)) ->000 : Symbol(000, Decl(objectLiteralErrors.ts, 15, 17)) +>0 : Symbol(0, Decl(objectLiteralErrors.ts, 15, 11), Decl(objectLiteralErrors.ts, 15, 17)) +>0o0 : Symbol(0, Decl(objectLiteralErrors.ts, 15, 11), Decl(objectLiteralErrors.ts, 15, 17)) var e15 = { "100": 0, 1e2: 0 }; >e15 : Symbol(e15, Decl(objectLiteralErrors.ts, 16, 3)) @@ -162,10 +162,10 @@ var f14 = { 0: 0, get 0x0() { return 0; } }; >0 : Symbol(0, Decl(objectLiteralErrors.ts, 34, 11)) >0x0 : Symbol(0x0, Decl(objectLiteralErrors.ts, 34, 17)) -var f14 = { 0: 0, get 000() { return 0; } }; +var f14 = { 0: 0, get 0o0() { return 0; } }; >f14 : Symbol(f14, Decl(objectLiteralErrors.ts, 34, 3), Decl(objectLiteralErrors.ts, 35, 3)) >0 : Symbol(0, Decl(objectLiteralErrors.ts, 35, 11)) ->000 : Symbol(000, Decl(objectLiteralErrors.ts, 35, 17)) +>0o0 : Symbol(0o0, Decl(objectLiteralErrors.ts, 35, 17)) var f15 = { "100": 0, get 1e2() { return 0; } }; >f15 : Symbol(f15, Decl(objectLiteralErrors.ts, 36, 3)) diff --git a/tests/baselines/reference/objectLiteralErrors.types b/tests/baselines/reference/objectLiteralErrors.types index 59fbc7c18af56..e3ff3cf613c5e 100644 --- a/tests/baselines/reference/objectLiteralErrors.types +++ b/tests/baselines/reference/objectLiteralErrors.types @@ -112,12 +112,12 @@ var e14 = { 0: 0, 0x0: 0 }; >0x0 : number >0 : 0 -var e14 = { 0: 0, 000: 0 }; +var e14 = { 0: 0, 0o0: 0 }; >e14 : { 0: number; } ->{ 0: 0, 000: 0 } : { 0: number; "0o00": number; } +>{ 0: 0, 0o0: 0 } : { 0: number; } >0 : number >0 : 0 ->000 : number +>0o0 : number >0 : 0 var e15 = { "100": 0, 1e2: 0 }; @@ -259,12 +259,12 @@ var f14 = { 0: 0, get 0x0() { return 0; } }; >0x0 : number >0 : 0 -var f14 = { 0: 0, get 000() { return 0; } }; +var f14 = { 0: 0, get 0o0() { return 0; } }; >f14 : { readonly 0: number; } ->{ 0: 0, get 000() { return 0; } } : { 0: number; readonly "0o00": number; } +>{ 0: 0, get 0o0() { return 0; } } : { readonly 0: number; } >0 : number >0 : 0 ->000 : number +>0o0 : number >0 : 0 var f15 = { "100": 0, get 1e2() { return 0; } }; diff --git a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.js b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.js index f5ac9f9821a4b..837a57aed52c7 100644 --- a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.js +++ b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.js @@ -152,8 +152,8 @@ var r8 = i["-1.0"]; var r9 = i["-1"]; var r10 = i[0x1]; var r11 = i[-0x1]; -var r12 = i[01]; -var r13 = i[-01]; +var r12 = i[1]; +var r13 = i[-1]; var i; var r1 = i['0.1']; var r2 = i['.1']; @@ -171,8 +171,8 @@ var r8 = i["-1.0"]; var r9 = i["-1"]; var r10 = i[0x1]; var r11 = i[-0x1]; -var r12 = i[01]; -var r13 = i[-01]; +var r12 = i[1]; +var r13 = i[-1]; var a; var r1 = a['0.1']; var r2 = a['.1']; @@ -190,8 +190,8 @@ var r8 = i["-1.0"]; var r9 = i["-1"]; var r10 = i[0x1]; var r11 = i[-0x1]; -var r12 = i[01]; -var r13 = i[-01]; +var r12 = i[1]; +var r13 = i[-1]; var b = { "0.1": null, ".1": new Object(), @@ -218,5 +218,5 @@ var r8 = i["-1.0"]; var r9 = i["-1"]; var r10 = i[0x1]; var r11 = i[-0x1]; -var r12 = i[01]; -var r13 = i[-01]; +var r12 = i[1]; +var r13 = i[-1]; diff --git a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols index bbb6a6cd0db26..2479804f7e4cd 100644 --- a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols +++ b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols @@ -115,6 +115,7 @@ var r11 = i[-0x1] var r12 = i[01] >r12 : Symbol(r12, Decl(objectTypeWithStringNamedNumericProperty.ts, 32, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 63, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 93, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 123, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 46, 3)) +>01 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 37, 17)) var r13 = i[-01] >r13 : Symbol(r13, Decl(objectTypeWithStringNamedNumericProperty.ts, 33, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 64, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 94, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 124, 3)) @@ -232,6 +233,7 @@ var r11 = i[-0x1] var r12 = i[01] >r12 : Symbol(r12, Decl(objectTypeWithStringNamedNumericProperty.ts, 32, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 63, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 93, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 123, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 46, 3)) +>01 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 37, 17)) var r13 = i[-01] >r13 : Symbol(r13, Decl(objectTypeWithStringNamedNumericProperty.ts, 33, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 64, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 94, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 124, 3)) @@ -345,6 +347,7 @@ var r11 = i[-0x1] var r12 = i[01] >r12 : Symbol(r12, Decl(objectTypeWithStringNamedNumericProperty.ts, 32, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 63, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 93, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 123, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 46, 3)) +>01 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 37, 17)) var r13 = i[-01] >r13 : Symbol(r13, Decl(objectTypeWithStringNamedNumericProperty.ts, 33, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 64, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 94, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 124, 3)) @@ -458,6 +461,7 @@ var r11 = i[-0x1] var r12 = i[01] >r12 : Symbol(r12, Decl(objectTypeWithStringNamedNumericProperty.ts, 32, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 63, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 93, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 123, 3)) >i : Symbol(i, Decl(objectTypeWithStringNamedNumericProperty.ts, 46, 3)) +>01 : Symbol(I["1"], Decl(objectTypeWithStringNamedNumericProperty.ts, 37, 17)) var r13 = i[-01] >r13 : Symbol(r13, Decl(objectTypeWithStringNamedNumericProperty.ts, 33, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 64, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 94, 3), Decl(objectTypeWithStringNamedNumericProperty.ts, 124, 3)) diff --git a/tests/baselines/reference/octalLiteralAndEscapeSequence.errors.txt b/tests/baselines/reference/octalLiteralAndEscapeSequence.errors.txt index 3037a62ac6212..65851a3c1d18a 100644 --- a/tests/baselines/reference/octalLiteralAndEscapeSequence.errors.txt +++ b/tests/baselines/reference/octalLiteralAndEscapeSequence.errors.txt @@ -1,17 +1,17 @@ tests/cases/compiler/octalLiteralAndEscapeSequence.ts(1,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/octalLiteralAndEscapeSequence.ts(2,1): error TS1121: Octal literals are not allowed. Use the syntax '0o5'. -tests/cases/compiler/octalLiteralAndEscapeSequence.ts(3,1): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. -tests/cases/compiler/octalLiteralAndEscapeSequence.ts(4,1): error TS1121: Octal literals are not allowed. Use the syntax '0o05'. +tests/cases/compiler/octalLiteralAndEscapeSequence.ts(3,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. +tests/cases/compiler/octalLiteralAndEscapeSequence.ts(4,1): error TS1121: Octal literals are not allowed. Use the syntax '0o5'. tests/cases/compiler/octalLiteralAndEscapeSequence.ts(5,1): error TS1121: Octal literals are not allowed. Use the syntax '0o55'. tests/cases/compiler/octalLiteralAndEscapeSequence.ts(6,5): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/octalLiteralAndEscapeSequence.ts(7,5): error TS1121: Octal literals are not allowed. Use the syntax '0o5'. -tests/cases/compiler/octalLiteralAndEscapeSequence.ts(8,5): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. -tests/cases/compiler/octalLiteralAndEscapeSequence.ts(9,5): error TS1121: Octal literals are not allowed. Use the syntax '0o05'. +tests/cases/compiler/octalLiteralAndEscapeSequence.ts(8,5): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. +tests/cases/compiler/octalLiteralAndEscapeSequence.ts(9,5): error TS1121: Octal literals are not allowed. Use the syntax '0o5'. tests/cases/compiler/octalLiteralAndEscapeSequence.ts(10,5): error TS1121: Octal literals are not allowed. Use the syntax '0o55'. tests/cases/compiler/octalLiteralAndEscapeSequence.ts(11,4): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/octalLiteralAndEscapeSequence.ts(12,4): error TS1121: Octal literals are not allowed. Use the syntax '0o5'. -tests/cases/compiler/octalLiteralAndEscapeSequence.ts(13,4): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. -tests/cases/compiler/octalLiteralAndEscapeSequence.ts(14,4): error TS1121: Octal literals are not allowed. Use the syntax '0o05'. +tests/cases/compiler/octalLiteralAndEscapeSequence.ts(13,4): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. +tests/cases/compiler/octalLiteralAndEscapeSequence.ts(14,4): error TS1121: Octal literals are not allowed. Use the syntax '0o5'. tests/cases/compiler/octalLiteralAndEscapeSequence.ts(15,4): error TS1121: Octal literals are not allowed. Use the syntax '0o55'. tests/cases/compiler/octalLiteralAndEscapeSequence.ts(18,2): error TS1484: Octal escape sequences are not allowed. Use the syntax '\x05'. tests/cases/compiler/octalLiteralAndEscapeSequence.ts(19,2): error TS1484: Octal escape sequences are not allowed. Use the syntax '\x00'. @@ -118,10 +118,10 @@ tests/cases/compiler/octalLiteralAndEscapeSequence.ts(118,6): error TS1484: Octa !!! error TS1121: Octal literals are not allowed. Use the syntax '0o5'. 000; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. 005; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o05'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o5'. 055; ~~~ !!! error TS1121: Octal literals are not allowed. Use the syntax '0o55'. @@ -133,10 +133,10 @@ tests/cases/compiler/octalLiteralAndEscapeSequence.ts(118,6): error TS1484: Octa !!! error TS1121: Octal literals are not allowed. Use the syntax '0o5'. `0${000}`; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. `0${005}`; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o05'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o5'. `0${055}`; ~~~ !!! error TS1121: Octal literals are not allowed. Use the syntax '0o55'. @@ -148,10 +148,10 @@ tests/cases/compiler/octalLiteralAndEscapeSequence.ts(118,6): error TS1484: Octa !!! error TS1121: Octal literals are not allowed. Use the syntax '0o5'. `${000}0`; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. `${005}0`; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o05'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o5'. `${055}0`; ~~~ !!! error TS1121: Octal literals are not allowed. Use the syntax '0o55'. diff --git a/tests/baselines/reference/octalLiteralAndEscapeSequence.js b/tests/baselines/reference/octalLiteralAndEscapeSequence.js index a15318605089a..9199452ff916e 100644 --- a/tests/baselines/reference/octalLiteralAndEscapeSequence.js +++ b/tests/baselines/reference/octalLiteralAndEscapeSequence.js @@ -120,21 +120,21 @@ //// [octalLiteralAndEscapeSequence.js] -00; -05; -000; -005; -055; -"0".concat(00); -"0".concat(05); -"0".concat(000); -"0".concat(005); -"0".concat(055); -"".concat(00, "0"); -"".concat(05, "0"); -"".concat(000, "0"); -"".concat(005, "0"); -"".concat(055, "0"); +0; +5; +0; +5; +45; +"0".concat(0); +"0".concat(5); +"0".concat(0); +"0".concat(5); +"0".concat(45); +"".concat(0, "0"); +"".concat(5, "0"); +"".concat(0, "0"); +"".concat(5, "0"); +"".concat(45, "0"); "\0"; "\5"; "\00"; diff --git a/tests/baselines/reference/octalLiteralInStrictModeES3.js b/tests/baselines/reference/octalLiteralInStrictModeES3.js index 9519503ed360d..4c6928c7e6990 100644 --- a/tests/baselines/reference/octalLiteralInStrictModeES3.js +++ b/tests/baselines/reference/octalLiteralInStrictModeES3.js @@ -4,4 +4,4 @@ //// [octalLiteralInStrictModeES3.js] "use strict"; -03; +3; diff --git a/tests/baselines/reference/parseBigInt.js b/tests/baselines/reference/parseBigInt.js index 1ffccb11e64fe..5ed586352bd50 100644 --- a/tests/baselines/reference/parseBigInt.js +++ b/tests/baselines/reference/parseBigInt.js @@ -120,7 +120,7 @@ const unaryPlusHex = +0x123n; // Parsing errors // In separate blocks because they each declare an "n" variable { - const legacyOct = 0123, n; + const legacyOct = 83, n; } { const scientific = 1e2n; diff --git a/tests/baselines/reference/plainJSBinderErrors.errors.txt b/tests/baselines/reference/plainJSBinderErrors.errors.txt index c6210e5f1a244..e2badf9a8083b 100644 --- a/tests/baselines/reference/plainJSBinderErrors.errors.txt +++ b/tests/baselines/reference/plainJSBinderErrors.errors.txt @@ -1,18 +1,23 @@ tests/cases/conformance/salsa/plainJSBinderErrors.js(1,1): error TS2528: A module cannot have multiple default exports. tests/cases/conformance/salsa/plainJSBinderErrors.js(2,1): error TS2528: A module cannot have multiple default exports. +tests/cases/conformance/salsa/plainJSBinderErrors.js(3,7): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module. +tests/cases/conformance/salsa/plainJSBinderErrors.js(4,7): error TS1214: Identifier expected. 'yield' is a reserved word in strict mode. Modules are automatically in strict mode. +tests/cases/conformance/salsa/plainJSBinderErrors.js(6,11): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. +tests/cases/conformance/salsa/plainJSBinderErrors.js(9,11): error TS1214: Identifier expected. 'yield' is a reserved word in strict mode. Modules are automatically in strict mode. +tests/cases/conformance/salsa/plainJSBinderErrors.js(12,5): error TS18012: '#constructor' is a reserved word. tests/cases/conformance/salsa/plainJSBinderErrors.js(15,20): error TS1102: 'delete' cannot be called on an identifier in strict mode. tests/cases/conformance/salsa/plainJSBinderErrors.js(18,16): error TS1102: 'delete' cannot be called on an identifier in strict mode. tests/cases/conformance/salsa/plainJSBinderErrors.js(19,16): error TS1102: 'delete' cannot be called on an identifier in strict mode. tests/cases/conformance/salsa/plainJSBinderErrors.js(22,15): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'eval'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. tests/cases/conformance/salsa/plainJSBinderErrors.js(23,15): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. -tests/cases/conformance/salsa/plainJSBinderErrors.js(26,27): error TS1121: Octal literals are not allowed. Use the syntax '0o10'. tests/cases/conformance/salsa/plainJSBinderErrors.js(27,9): error TS1101: 'with' statements are not allowed in strict mode. tests/cases/conformance/salsa/plainJSBinderErrors.js(33,13): error TS1344: 'A label is not allowed here. +tests/cases/conformance/salsa/plainJSBinderErrors.js(34,13): error TS1107: Jump target cannot cross function boundary. tests/cases/conformance/salsa/plainJSBinderErrors.js(39,7): error TS1215: Invalid use of 'eval'. Modules are automatically in strict mode. tests/cases/conformance/salsa/plainJSBinderErrors.js(40,7): error TS1215: Invalid use of 'arguments'. Modules are automatically in strict mode. -==== tests/cases/conformance/salsa/plainJSBinderErrors.js (12 errors) ==== +==== tests/cases/conformance/salsa/plainJSBinderErrors.js (17 errors) ==== export default 12 ~~~~~~~~~~~~~~~~~ !!! error TS2528: A module cannot have multiple default exports. @@ -22,15 +27,25 @@ tests/cases/conformance/salsa/plainJSBinderErrors.js(40,7): error TS1215: Invali !!! error TS2528: A module cannot have multiple default exports. !!! related TS2752 tests/cases/conformance/salsa/plainJSBinderErrors.js:1:1: The first export default is here. const await = 1 + ~~~~~ +!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module. const yield = 2 + ~~~~~ +!!! error TS1214: Identifier expected. 'yield' is a reserved word in strict mode. Modules are automatically in strict mode. async function f() { const await = 3 + ~~~~~ +!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. } function* g() { const yield = 4 + ~~~~~ +!!! error TS1214: Identifier expected. 'yield' is a reserved word in strict mode. Modules are automatically in strict mode. } class C { #constructor = 5 + ~~~~~~~~~~~~ +!!! error TS18012: '#constructor' is a reserved word. deleted() { function container(f) { delete f @@ -54,9 +69,7 @@ tests/cases/conformance/salsa/plainJSBinderErrors.js(40,7): error TS1215: Invali !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. } withOctal() { - const redundant = 010 - ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o10'. + const redundant = 0o10 with (redundant) { ~~~~ !!! error TS1101: 'with' statements are not allowed in strict mode. @@ -69,6 +82,8 @@ tests/cases/conformance/salsa/plainJSBinderErrors.js(40,7): error TS1215: Invali ~~~~~ !!! error TS1344: 'A label is not allowed here. break label + ~~~~~~~~~~~ +!!! error TS1107: Jump target cannot cross function boundary. } return x } diff --git a/tests/baselines/reference/plainJSBinderErrors.js b/tests/baselines/reference/plainJSBinderErrors.js index 5f8f3138a64c5..e08e041127e6a 100644 --- a/tests/baselines/reference/plainJSBinderErrors.js +++ b/tests/baselines/reference/plainJSBinderErrors.js @@ -24,7 +24,7 @@ class C { const arguments = 8 } withOctal() { - const redundant = 010 + const redundant = 0o10 with (redundant) { return toFixed() } @@ -67,7 +67,7 @@ class C { const arguments = 8; } withOctal() { - const redundant = 010; + const redundant = 0o10; with (redundant) { return toFixed(); } diff --git a/tests/baselines/reference/plainJSBinderErrors.symbols b/tests/baselines/reference/plainJSBinderErrors.symbols index 55b2866141718..3e0b96dc73dc6 100644 --- a/tests/baselines/reference/plainJSBinderErrors.symbols +++ b/tests/baselines/reference/plainJSBinderErrors.symbols @@ -56,7 +56,7 @@ class C { withOctal() { >withOctal : Symbol(C.withOctal, Decl(plainJSBinderErrors.js, 23, 5)) - const redundant = 010 + const redundant = 0o10 >redundant : Symbol(redundant, Decl(plainJSBinderErrors.js, 25, 13)) with (redundant) { diff --git a/tests/baselines/reference/plainJSBinderErrors.types b/tests/baselines/reference/plainJSBinderErrors.types index 7ae226e300c93..1b704fb3aff58 100644 --- a/tests/baselines/reference/plainJSBinderErrors.types +++ b/tests/baselines/reference/plainJSBinderErrors.types @@ -67,9 +67,9 @@ class C { withOctal() { >withOctal : () => any - const redundant = 010 + const redundant = 0o10 >redundant : 8 ->010 : 8 +>0o10 : 8 with (redundant) { >redundant : 8 diff --git a/tests/baselines/reference/propertyAccessNumericLiterals.errors.txt b/tests/baselines/reference/propertyAccessNumericLiterals.errors.txt index e462eccfa68ec..c4312ee2de48d 100644 --- a/tests/baselines/reference/propertyAccessNumericLiterals.errors.txt +++ b/tests/baselines/reference/propertyAccessNumericLiterals.errors.txt @@ -1,7 +1,11 @@ -tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts(6,1): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts(6,1): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. +tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts(7,1): error TS1486: Decimals with leading zeros are not allowed. +tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts(8,2): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts(10,1): error TS1486: Decimals with leading zeros are not allowed. +tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts(11,3): error TS6188: Numeric separators are not allowed here. -==== tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts (1 errors) ==== +==== tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts (5 errors) ==== 0xffffffff.toString(); 0o01234.toString(); 0b01101101.toString(); @@ -9,4 +13,19 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals 1e0.toString(); 000.toString(); ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. \ No newline at end of file +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. + 08.8e5.toString(); + ~~~~~~ +!!! error TS1486: Decimals with leading zeros are not allowed. + 0_8.8e5.toString(); + ~ +!!! error TS6188: Numeric separators are not allowed here. + 8.8e5.toString(); + 088e4.toString(); + ~~~~~ +!!! error TS1486: Decimals with leading zeros are not allowed. + 88_e4.toString(); + ~ +!!! error TS6188: Numeric separators are not allowed here. + 88e4.toString(); + 8_8e4.toString(); \ No newline at end of file diff --git a/tests/baselines/reference/propertyAccessNumericLiterals.js b/tests/baselines/reference/propertyAccessNumericLiterals.js index 1a7eb6c0a2113..c5b223fa7c42e 100644 --- a/tests/baselines/reference/propertyAccessNumericLiterals.js +++ b/tests/baselines/reference/propertyAccessNumericLiterals.js @@ -4,7 +4,14 @@ 0b01101101.toString(); 1234..toString(); 1e0.toString(); -000.toString(); +000.toString(); +08.8e5.toString(); +0_8.8e5.toString(); +8.8e5.toString(); +088e4.toString(); +88_e4.toString(); +88e4.toString(); +8_8e4.toString(); //// [propertyAccessNumericLiterals.js] 0xffffffff.toString(); @@ -12,4 +19,11 @@ 109..toString(); 1234..toString(); 1e0.toString(); -000.toString(); +0..toString(); +880000..toString(); +880000..toString(); +8.8e5.toString(); +880000..toString(); +880000..toString(); +88e4.toString(); +880000..toString(); diff --git a/tests/baselines/reference/propertyAccessNumericLiterals.symbols b/tests/baselines/reference/propertyAccessNumericLiterals.symbols index 4f1d5e6fa220b..15001d9ee6269 100644 --- a/tests/baselines/reference/propertyAccessNumericLiterals.symbols +++ b/tests/baselines/reference/propertyAccessNumericLiterals.symbols @@ -23,3 +23,31 @@ >000.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) >toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) +08.8e5.toString(); +>08.8e5.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) + +0_8.8e5.toString(); +>0_8.8e5.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) + +8.8e5.toString(); +>8.8e5.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) + +088e4.toString(); +>088e4.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) + +88_e4.toString(); +>88_e4.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) + +88e4.toString(); +>88e4.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) + +8_8e4.toString(); +>8_8e4.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/propertyAccessNumericLiterals.types b/tests/baselines/reference/propertyAccessNumericLiterals.types index a2567ff253716..0fd88ed1b634b 100644 --- a/tests/baselines/reference/propertyAccessNumericLiterals.types +++ b/tests/baselines/reference/propertyAccessNumericLiterals.types @@ -35,3 +35,45 @@ >000 : 0 >toString : (radix?: number) => string +08.8e5.toString(); +>08.8e5.toString() : string +>08.8e5.toString : (radix?: number) => string +>08.8e5 : 880000 +>toString : (radix?: number) => string + +0_8.8e5.toString(); +>0_8.8e5.toString() : string +>0_8.8e5.toString : (radix?: number) => string +>0_8.8e5 : 880000 +>toString : (radix?: number) => string + +8.8e5.toString(); +>8.8e5.toString() : string +>8.8e5.toString : (radix?: number) => string +>8.8e5 : 880000 +>toString : (radix?: number) => string + +088e4.toString(); +>088e4.toString() : string +>088e4.toString : (radix?: number) => string +>088e4 : 880000 +>toString : (radix?: number) => string + +88_e4.toString(); +>88_e4.toString() : string +>88_e4.toString : (radix?: number) => string +>88_e4 : 880000 +>toString : (radix?: number) => string + +88e4.toString(); +>88e4.toString() : string +>88e4.toString : (radix?: number) => string +>88e4 : 880000 +>toString : (radix?: number) => string + +8_8e4.toString(); +>8_8e4.toString() : string +>8_8e4.toString : (radix?: number) => string +>8_8e4 : 880000 +>toString : (radix?: number) => string + diff --git a/tests/baselines/reference/scannerES3NumericLiteral2.js b/tests/baselines/reference/scannerES3NumericLiteral2.js index ddb237e30062c..ca3d4084cc99c 100644 --- a/tests/baselines/reference/scannerES3NumericLiteral2.js +++ b/tests/baselines/reference/scannerES3NumericLiteral2.js @@ -2,4 +2,4 @@ 01 //// [scannerES3NumericLiteral2.js] -01; +1; diff --git a/tests/baselines/reference/scannerES3NumericLiteral3.js b/tests/baselines/reference/scannerES3NumericLiteral3.js index 544953a1134ac..7642ec1ef0b5f 100644 --- a/tests/baselines/reference/scannerES3NumericLiteral3.js +++ b/tests/baselines/reference/scannerES3NumericLiteral3.js @@ -2,5 +2,5 @@ 01.0 //// [scannerES3NumericLiteral3.js] -01; +1; .0; diff --git a/tests/baselines/reference/scannerNumericLiteral2.js b/tests/baselines/reference/scannerNumericLiteral2.js index 382f1e6e4dffd..cbd3445e9eb31 100644 --- a/tests/baselines/reference/scannerNumericLiteral2.js +++ b/tests/baselines/reference/scannerNumericLiteral2.js @@ -2,4 +2,4 @@ 01 //// [scannerNumericLiteral2.js] -01; +1; diff --git a/tests/baselines/reference/scannerNumericLiteral3.js b/tests/baselines/reference/scannerNumericLiteral3.js index 8e751bbd841b7..6124375ce86f1 100644 --- a/tests/baselines/reference/scannerNumericLiteral3.js +++ b/tests/baselines/reference/scannerNumericLiteral3.js @@ -2,5 +2,5 @@ 01.0 //// [scannerNumericLiteral3.js] -01; +1; .0; diff --git a/tests/baselines/reference/scannerNumericLiteral8.js b/tests/baselines/reference/scannerNumericLiteral8.js index 6d5cf860d6c5c..9b4b9ba472dba 100644 --- a/tests/baselines/reference/scannerNumericLiteral8.js +++ b/tests/baselines/reference/scannerNumericLiteral8.js @@ -2,4 +2,4 @@ -03 //// [scannerNumericLiteral8.js] --03; +-3; diff --git a/tests/baselines/reference/scannerNumericLiteral9.js b/tests/baselines/reference/scannerNumericLiteral9.js index bf650744ecfdc..42174678cb375 100644 --- a/tests/baselines/reference/scannerNumericLiteral9.js +++ b/tests/baselines/reference/scannerNumericLiteral9.js @@ -2,4 +2,4 @@ 009 //// [scannerNumericLiteral9.js] -009; +9; diff --git a/tests/baselines/reference/strictModeOctalLiterals.js b/tests/baselines/reference/strictModeOctalLiterals.js index df3f9acfe5496..4ac5cc1767890 100644 --- a/tests/baselines/reference/strictModeOctalLiterals.js +++ b/tests/baselines/reference/strictModeOctalLiterals.js @@ -10,4 +10,4 @@ export var E; (function (E) { E[E["A"] = 13] = "A"; })(E || (E = {})); -const orbitol = 01; +const orbitol = 1; diff --git a/tests/baselines/reference/templateLiteralEscapeSequence.errors.txt b/tests/baselines/reference/templateLiteralEscapeSequence.errors.txt index 8937bb38079be..4cbadff3d8f36 100644 --- a/tests/baselines/reference/templateLiteralEscapeSequence.errors.txt +++ b/tests/baselines/reference/templateLiteralEscapeSequence.errors.txt @@ -32,13 +32,13 @@ tests/cases/compiler/templateLiteralEscapeSequence.ts(40,8): error TS1125: Hexad tests/cases/compiler/templateLiteralEscapeSequence.ts(41,9): error TS1125: Hexadecimal digit expected. tests/cases/compiler/templateLiteralEscapeSequence.ts(85,8): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/templateLiteralEscapeSequence.ts(86,8): error TS1121: Octal literals are not allowed. Use the syntax '0o5'. -tests/cases/compiler/templateLiteralEscapeSequence.ts(87,8): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. -tests/cases/compiler/templateLiteralEscapeSequence.ts(88,8): error TS1121: Octal literals are not allowed. Use the syntax '0o05'. +tests/cases/compiler/templateLiteralEscapeSequence.ts(87,8): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. +tests/cases/compiler/templateLiteralEscapeSequence.ts(88,8): error TS1121: Octal literals are not allowed. Use the syntax '0o5'. tests/cases/compiler/templateLiteralEscapeSequence.ts(89,8): error TS1121: Octal literals are not allowed. Use the syntax '0o55'. tests/cases/compiler/templateLiteralEscapeSequence.ts(90,7): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tests/cases/compiler/templateLiteralEscapeSequence.ts(91,7): error TS1121: Octal literals are not allowed. Use the syntax '0o5'. -tests/cases/compiler/templateLiteralEscapeSequence.ts(92,7): error TS1121: Octal literals are not allowed. Use the syntax '0o00'. -tests/cases/compiler/templateLiteralEscapeSequence.ts(93,7): error TS1121: Octal literals are not allowed. Use the syntax '0o05'. +tests/cases/compiler/templateLiteralEscapeSequence.ts(92,7): error TS1121: Octal literals are not allowed. Use the syntax '0o0'. +tests/cases/compiler/templateLiteralEscapeSequence.ts(93,7): error TS1121: Octal literals are not allowed. Use the syntax '0o5'. tests/cases/compiler/templateLiteralEscapeSequence.ts(94,7): error TS1121: Octal literals are not allowed. Use the syntax '0o55'. @@ -199,10 +199,10 @@ tests/cases/compiler/templateLiteralEscapeSequence.ts(94,7): error TS1121: Octal !!! error TS1121: Octal literals are not allowed. Use the syntax '0o5'. tag`0${000}`; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tag`0${005}`; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o05'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o5'. tag`0${055}`; ~~~ !!! error TS1121: Octal literals are not allowed. Use the syntax '0o55'. @@ -214,10 +214,10 @@ tests/cases/compiler/templateLiteralEscapeSequence.ts(94,7): error TS1121: Octal !!! error TS1121: Octal literals are not allowed. Use the syntax '0o5'. tag`${000}0`; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o00'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o0'. tag`${005}0`; ~~~ -!!! error TS1121: Octal literals are not allowed. Use the syntax '0o05'. +!!! error TS1121: Octal literals are not allowed. Use the syntax '0o5'. tag`${055}0`; ~~~ !!! error TS1121: Octal literals are not allowed. Use the syntax '0o55'. diff --git a/tests/baselines/reference/templateLiteralEscapeSequence.js b/tests/baselines/reference/templateLiteralEscapeSequence.js index c65717deb91d9..0e4ec23f6c5cc 100644 --- a/tests/baselines/reference/templateLiteralEscapeSequence.js +++ b/tests/baselines/reference/templateLiteralEscapeSequence.js @@ -239,16 +239,16 @@ tag(__makeTemplateObject(["", void 0, ""], ["", "\\u{ffffff}", ""]), 0, 0); tag(__makeTemplateObject(["", void 0, ""], ["", "\\x", ""]), 0, 0); tag(__makeTemplateObject(["", void 0, ""], ["", "\\x0", ""]), 0, 0); tag(__makeTemplateObject(["", "\0", ""], ["", "\\x00", ""]), 0, 0); -tag(__makeTemplateObject(["0", ""], ["0", ""]), 00); -tag(__makeTemplateObject(["0", ""], ["0", ""]), 05); -tag(__makeTemplateObject(["0", ""], ["0", ""]), 000); -tag(__makeTemplateObject(["0", ""], ["0", ""]), 005); -tag(__makeTemplateObject(["0", ""], ["0", ""]), 055); -tag(__makeTemplateObject(["", "0"], ["", "0"]), 00); -tag(__makeTemplateObject(["", "0"], ["", "0"]), 05); -tag(__makeTemplateObject(["", "0"], ["", "0"]), 000); -tag(__makeTemplateObject(["", "0"], ["", "0"]), 005); -tag(__makeTemplateObject(["", "0"], ["", "0"]), 055); +tag(__makeTemplateObject(["0", ""], ["0", ""]), 0); +tag(__makeTemplateObject(["0", ""], ["0", ""]), 5); +tag(__makeTemplateObject(["0", ""], ["0", ""]), 0); +tag(__makeTemplateObject(["0", ""], ["0", ""]), 5); +tag(__makeTemplateObject(["0", ""], ["0", ""]), 45); +tag(__makeTemplateObject(["", "0"], ["", "0"]), 0); +tag(__makeTemplateObject(["", "0"], ["", "0"]), 5); +tag(__makeTemplateObject(["", "0"], ["", "0"]), 0); +tag(__makeTemplateObject(["", "0"], ["", "0"]), 5); +tag(__makeTemplateObject(["", "0"], ["", "0"]), 45); tag(__makeTemplateObject(["\0"], ["\\0"])); tag(__makeTemplateObject([void 0], ["\\5"])); tag(__makeTemplateObject([void 0], ["\\00"])); diff --git a/tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts b/tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts index b95f12b6d14cf..8e8d33e78aaf0 100644 --- a/tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts +++ b/tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts @@ -15,7 +15,7 @@ var e11 = { 1.0: 0, '1': 0 }; var e12 = { 0: 0, 0: 0 }; var e13 = { 0: 0, 0: 0 }; var e14 = { 0: 0, 0x0: 0 }; -var e14 = { 0: 0, 000: 0 }; +var e14 = { 0: 0, 0o0: 0 }; var e15 = { "100": 0, 1e2: 0 }; var e16 = { 0x20: 0, 3.2e1: 0 }; var e17 = { a: 0, b: 1, a: 0 }; @@ -35,7 +35,7 @@ var f11 = { 1.0: 0, get '1'() { return 0; } }; var f12 = { 0: 0, get 0() { return 0; } }; var f13 = { 0: 0, get 0() { return 0; } }; var f14 = { 0: 0, get 0x0() { return 0; } }; -var f14 = { 0: 0, get 000() { return 0; } }; +var f14 = { 0: 0, get 0o0() { return 0; } }; var f15 = { "100": 0, get 1e2() { return 0; } }; var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; diff --git a/tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts b/tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts index 318b05fc0b50a..11feb1932b46d 100644 --- a/tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts +++ b/tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts @@ -1,7 +1,13 @@ -// @target: es3 0xffffffff.toString(); 0o01234.toString(); 0b01101101.toString(); 1234..toString(); 1e0.toString(); -000.toString(); \ No newline at end of file +000.toString(); +08.8e5.toString(); +0_8.8e5.toString(); +8.8e5.toString(); +088e4.toString(); +88_e4.toString(); +88e4.toString(); +8_8e4.toString(); \ No newline at end of file diff --git a/tests/cases/conformance/salsa/plainJSBinderErrors.ts b/tests/cases/conformance/salsa/plainJSBinderErrors.ts index d2019e3f78b2f..7be47be3f7566 100644 --- a/tests/cases/conformance/salsa/plainJSBinderErrors.ts +++ b/tests/cases/conformance/salsa/plainJSBinderErrors.ts @@ -27,7 +27,7 @@ class C { const arguments = 8 } withOctal() { - const redundant = 010 + const redundant = 0o10 with (redundant) { return toFixed() }