mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-21 08:25:43 -05:00
Disallow old style octal literal types
This commit is contained in:
@@ -2,8 +2,8 @@ tests/cases/conformance/expressions/literals/literals.ts(9,10): error TS2362: Th
|
||||
tests/cases/conformance/expressions/literals/literals.ts(9,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(10,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(10,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/literals/literals.ts (6 errors) ====
|
||||
@@ -36,14 +36,14 @@ tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: O
|
||||
var n = 1e4;
|
||||
var n = 001; // Error in ES5
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. 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 TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'.
|
||||
var n = -0x1;
|
||||
|
||||
var s: string;
|
||||
|
||||
@@ -12,7 +12,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,21)
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(14,19): error TS2300: Duplicate identifier '0'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,19): error TS2300: Duplicate identifier '0'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS2300: Duplicate identifier '0x0'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS2300: Duplicate identifier '000'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,23): error TS2300: Duplicate identifier '1e2'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,22): error TS2300: Duplicate identifier '3.2e1'.
|
||||
@@ -125,7 +125,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,55)
|
||||
!!! error TS2300: Duplicate identifier '0x0'.
|
||||
var e14 = { 0: 0, 000: 0 };
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier '000'.
|
||||
var e15 = { "100": 0, 1e2: 0 };
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
tests/cases/compiler/oldStyleOctalLiteralTypes.ts(1,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'.
|
||||
tests/cases/compiler/oldStyleOctalLiteralTypes.ts(2,9): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o20'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/oldStyleOctalLiteralTypes.ts (2 errors) ====
|
||||
let x: 010;
|
||||
~~~
|
||||
!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'.
|
||||
let y: -020;
|
||||
~~~
|
||||
!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o20'.
|
||||
|
||||
8
tests/baselines/reference/oldStyleOctalLiteralTypes.js
Normal file
8
tests/baselines/reference/oldStyleOctalLiteralTypes.js
Normal file
@@ -0,0 +1,8 @@
|
||||
//// [oldStyleOctalLiteralTypes.ts]
|
||||
let x: 010;
|
||||
let y: -020;
|
||||
|
||||
|
||||
//// [oldStyleOctalLiteralTypes.js]
|
||||
var x;
|
||||
var y;
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral2.ts(1,1): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral2.ts(1,1): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral2.ts (1 errors) ====
|
||||
01
|
||||
~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts(1,2): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts(1,2): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts (1 errors) ====
|
||||
-03
|
||||
~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher.
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'.
|
||||
3
tests/cases/compiler/oldStyleOctalLiteralTypes.ts
Normal file
3
tests/cases/compiler/oldStyleOctalLiteralTypes.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// @target: ES3
|
||||
let x: 010;
|
||||
let y: -020;
|
||||
Reference in New Issue
Block a user