mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-13 06:20:23 -06:00
Accepted new baselines
This commit is contained in:
parent
51d10ee4a0
commit
31fca3af4d
@ -1,18 +1,21 @@
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(3,27): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(4,36): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,25): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,22): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,29): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,39): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,48): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
|
||||
|
||||
==== tests/cases/compiler/bigIntWithTargetES3.ts (3 errors) ====
|
||||
==== tests/cases/compiler/bigIntWithTargetES3.ts (4 errors) ====
|
||||
const normalNumber = 123; // should not error
|
||||
let bigintType: bigint; // should not error
|
||||
let bigintLiteralType: 123n; // should not error when used as type
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
let bigintNegativeLiteralType: -123n; // should not error when used as type
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
~~~~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
~~~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
~~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
|
||||
@ -1,21 +1,19 @@
|
||||
tests/cases/compiler/a.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'.
|
||||
tests/cases/compiler/a.ts(8,11): error TS2538: Type '1n' cannot be used as an index type.
|
||||
tests/cases/compiler/a.ts(8,12): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/a.ts(14,1): error TS2322: Type '123n' is not assignable to type 'string | number | symbol'.
|
||||
tests/cases/compiler/a.ts(14,10): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/a.ts(17,25): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/a.ts(19,12): error TS2538: Type 'bigint' cannot be used as an index type.
|
||||
tests/cases/compiler/b.ts(2,12): error TS1136: Property assignment expected.
|
||||
tests/cases/compiler/b.ts(2,13): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/b.ts(2,14): error TS1005: ';' expected.
|
||||
tests/cases/compiler/b.ts(2,19): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/b.ts(3,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
tests/cases/compiler/b.ts(3,14): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/b.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.ts (6 errors) ====
|
||||
==== tests/cases/compiler/a.ts (4 errors) ====
|
||||
interface BigIntIndex<E> {
|
||||
[index: bigint]: E; // should error
|
||||
~~~~~
|
||||
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
|
||||
}
|
||||
|
||||
const arr: number[] = [1, 2, 3];
|
||||
@ -24,8 +22,6 @@ tests/cases/compiler/b.ts(4,12): error TS2464: A computed property name must be
|
||||
num = arr[1n]; // should error
|
||||
~~
|
||||
!!! error TS2538: Type '1n' cannot be used as an index type.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
|
||||
let key: keyof any; // should be type "string | number | symbol"
|
||||
key = 123;
|
||||
@ -34,13 +30,9 @@ tests/cases/compiler/b.ts(4,12): error TS2464: A computed property name must be
|
||||
key = 123n; // should error
|
||||
~~~
|
||||
!!! error TS2322: Type '123n' is not assignable to type 'string | number | symbol'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
|
||||
// Show correct usage of bigint index: explicitly convert to string
|
||||
const bigNum: bigint = 0n;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const typedArray = new Uint8Array(3);
|
||||
typedArray[bigNum] = 0xAA; // should error
|
||||
~~~~~~
|
||||
@ -50,13 +42,11 @@ tests/cases/compiler/b.ts(4,12): error TS2464: A computed property name must be
|
||||
typedArray[2] = 0xCC;
|
||||
|
||||
// {1n: 123} is a syntax error; must go in separate file so BigIntIndex error is shown
|
||||
==== tests/cases/compiler/b.ts (7 errors) ====
|
||||
==== tests/cases/compiler/b.ts (5 errors) ====
|
||||
// BigInt cannot be used as an object literal property
|
||||
const a = {1n: 123};
|
||||
~~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
@ -64,8 +54,6 @@ tests/cases/compiler/b.ts(4,12): error TS2464: A computed property name must be
|
||||
const b = {[1n]: 456};
|
||||
~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const c = {[bigNum]: 789};
|
||||
~~~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
@ -1,30 +1,15 @@
|
||||
tests/cases/compiler/bigintWithLib.ts(4,1): error TS2350: Only a void function can be called with the 'new' keyword.
|
||||
tests/cases/compiler/bigintWithLib.ts(15,35): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(15,39): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(15,43): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(16,33): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
|
||||
Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag]
|
||||
tests/cases/compiler/bigintWithLib.ts(21,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
|
||||
tests/cases/compiler/bigintWithLib.ts(27,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(27,41): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(27,45): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(28,35): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
|
||||
Type 'number[]' is not assignable to type 'SharedArrayBuffer'.
|
||||
tests/cases/compiler/bigintWithLib.ts(33,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
|
||||
tests/cases/compiler/bigintWithLib.ts(38,27): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(39,27): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(40,25): error TS2345: Argument of type '-1' is not assignable to parameter of type 'bigint'.
|
||||
tests/cases/compiler/bigintWithLib.ts(41,29): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(42,29): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '123' is not assignable to parameter of type 'bigint'.
|
||||
tests/cases/compiler/bigintWithLib.ts(50,13): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(51,14): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(52,12): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(52,18): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithLib.ts(53,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
|
||||
|
||||
==== tests/cases/compiler/bigintWithLib.ts (22 errors) ====
|
||||
==== tests/cases/compiler/bigintWithLib.ts (7 errors) ====
|
||||
// Test BigInt functions
|
||||
let bigintVal: bigint = BigInt(123);
|
||||
bigintVal = BigInt("456");
|
||||
@ -42,12 +27,6 @@ tests/cases/compiler/bigintWithLib.ts(53,11): error TS1351: An identifier cannot
|
||||
let bigIntArray: BigInt64Array = new BigInt64Array();
|
||||
bigIntArray = new BigInt64Array(10);
|
||||
bigIntArray = new BigInt64Array([1n, 2n, 3n]);
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigIntArray = new BigInt64Array([1, 2, 3]); // should error
|
||||
~~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
|
||||
@ -65,12 +44,6 @@ tests/cases/compiler/bigintWithLib.ts(53,11): error TS1351: An identifier cannot
|
||||
let bigUintArray: BigUint64Array = new BigUint64Array();
|
||||
bigUintArray = new BigUint64Array(10);
|
||||
bigUintArray = new BigUint64Array([1n, 2n, 3n]);
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigUintArray = new BigUint64Array([1, 2, 3]); // should error
|
||||
~~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
|
||||
@ -87,20 +60,12 @@ tests/cases/compiler/bigintWithLib.ts(53,11): error TS1351: An identifier cannot
|
||||
// Test added DataView methods
|
||||
const dataView = new DataView(new ArrayBuffer(80));
|
||||
dataView.setBigInt64(1, -1n);
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
dataView.setBigInt64(1, -1n, true);
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
dataView.setBigInt64(1, -1); // should error
|
||||
~~
|
||||
!!! error TS2345: Argument of type '-1' is not assignable to parameter of type 'bigint'.
|
||||
dataView.setBigUint64(2, 123n);
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
dataView.setBigUint64(2, 123n, true);
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
dataView.setBigUint64(2, 123); // should error
|
||||
~~~
|
||||
!!! error TS2345: Argument of type '123' is not assignable to parameter of type 'bigint'.
|
||||
@ -111,16 +76,6 @@ tests/cases/compiler/bigintWithLib.ts(53,11): error TS1351: An identifier cannot
|
||||
|
||||
// Test emitted declarations files
|
||||
const w = 12n; // should emit as const w = 12n
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const x = -12n; // should emit as const x = -12n
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const y: 12n = 12n; // should emit type 12n
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
let z = 12n; // should emit type bigint in declaration file
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
let z = 12n; // should emit type bigint in declaration file
|
||||
@ -2,16 +2,18 @@ tests/cases/compiler/bigintWithoutLib.ts(4,25): error TS2304: Cannot find name '
|
||||
tests/cases/compiler/bigintWithoutLib.ts(5,13): error TS2304: Cannot find name 'BigInt'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(6,5): error TS2304: Cannot find name 'BigInt'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(7,13): error TS2304: Cannot find name 'BigInt'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(7,30): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(8,13): error TS2304: Cannot find name 'BigInt'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(8,31): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(9,1): error TS2322: Type 'Object' is not assignable to type 'bigint'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(11,13): error TS2554: Expected 0 arguments, but got 1.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(15,18): error TS2304: Cannot find name 'BigInt64Array'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(15,38): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
|
||||
tests/cases/compiler/bigintWithoutLib.ts(16,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
|
||||
tests/cases/compiler/bigintWithoutLib.ts(17,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
|
||||
tests/cases/compiler/bigintWithoutLib.ts(17,35): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(17,39): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(17,43): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(17,34): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(17,38): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(17,42): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(18,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
|
||||
tests/cases/compiler/bigintWithoutLib.ts(19,19): error TS2304: Cannot find name 'BigInt64Array'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(20,19): error TS2304: Cannot find name 'BigInt64Array'.
|
||||
@ -20,22 +22,22 @@ tests/cases/compiler/bigintWithoutLib.ts(27,19): error TS2304: Cannot find name
|
||||
tests/cases/compiler/bigintWithoutLib.ts(27,40): error TS2304: Cannot find name 'BigUint64Array'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(28,20): error TS2304: Cannot find name 'BigUint64Array'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(29,20): error TS2304: Cannot find name 'BigUint64Array'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(29,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(29,41): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(29,45): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(29,36): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(29,40): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(29,44): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(30,20): error TS2304: Cannot find name 'BigUint64Array'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(31,20): error TS2304: Cannot find name 'BigUint64Array'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(32,20): error TS2304: Cannot find name 'BigUint64Array'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(33,20): error TS2304: Cannot find name 'BigUint64Array'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(40,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(40,27): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(40,26): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(41,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(41,27): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(41,26): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(42,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(43,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(43,29): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(43,26): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(44,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(44,29): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(44,26): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(45,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(46,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(47,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'.
|
||||
@ -43,7 +45,7 @@ tests/cases/compiler/bigintWithoutLib.ts(48,22): error TS2339: Property 'getBigU
|
||||
tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/bigintWithoutLib.ts (43 errors) ====
|
||||
==== tests/cases/compiler/bigintWithoutLib.ts (45 errors) ====
|
||||
// Every line should error because these builtins are not declared
|
||||
|
||||
// Test BigInt functions
|
||||
@ -59,9 +61,13 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
|
||||
bigintVal = BigInt.asIntN(8, 0xFFFFn);
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'BigInt'.
|
||||
~~~~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
bigintVal = BigInt.asUintN(8, 0xFFFFn);
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'BigInt'.
|
||||
~~~~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {}
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'bigint'.
|
||||
@ -86,12 +92,12 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
|
||||
!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:15:5: 'bigIntArray' is declared here.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
bigIntArray = new BigInt64Array([1, 2, 3]);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
|
||||
@ -121,12 +127,12 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
|
||||
bigUintArray = new BigUint64Array([1n, 2n, 3n]);
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'BigUint64Array'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
bigUintArray = new BigUint64Array([1, 2, 3]);
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'BigUint64Array'.
|
||||
@ -148,26 +154,26 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
|
||||
dataView.setBigInt64(1, -1n);
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
dataView.setBigInt64(1, -1n, true);
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
dataView.setBigInt64(1, -1);
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
|
||||
dataView.setBigUint64(2, 123n);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
dataView.setBigUint64(2, 123n, true);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
dataView.setBigUint64(2, 123);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
|
||||
|
||||
@ -11,15 +11,12 @@ tests/cases/compiler/identifierStartAfterNumericLiteral.ts(7,2): error TS2304: C
|
||||
tests/cases/compiler/identifierStartAfterNumericLiteral.ts(8,3): error TS1124: Digit expected.
|
||||
tests/cases/compiler/identifierStartAfterNumericLiteral.ts(10,3): error TS1124: Digit expected.
|
||||
tests/cases/compiler/identifierStartAfterNumericLiteral.ts(10,3): error TS2304: Cannot find name 'e'.
|
||||
tests/cases/compiler/identifierStartAfterNumericLiteral.ts(11,2): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/identifierStartAfterNumericLiteral.ts(12,2): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/identifierStartAfterNumericLiteral.ts(12,3): error TS1005: ';' expected.
|
||||
tests/cases/compiler/identifierStartAfterNumericLiteral.ts(13,2): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/identifierStartAfterNumericLiteral.ts(13,3): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/identifierStartAfterNumericLiteral.ts(13,3): error TS2304: Cannot find name 'a'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/identifierStartAfterNumericLiteral.ts (19 errors) ====
|
||||
==== tests/cases/compiler/identifierStartAfterNumericLiteral.ts (16 errors) ====
|
||||
let valueIn = 3in[null];
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
@ -57,16 +54,10 @@ tests/cases/compiler/identifierStartAfterNumericLiteral.ts(13,3): error TS2304:
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
||||
1n
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
2n2
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
2na
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
|
||||
@ -1,124 +1,51 @@
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(2,15): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(3,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(3,14): error TS2322: Type '2' is not assignable to type 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(3,26): error TS2322: Type '1n' is not assignable to type 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(3,33): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(4,12): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(4,15): error TS2365: Operator '+=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(4,28): error TS2365: Operator '+=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(4,36): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(5,12): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(5,15): error TS2365: Operator '-=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(5,28): error TS2365: Operator '-=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(5,36): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(6,12): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(6,15): error TS2365: Operator '*=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(6,28): error TS2365: Operator '*=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(6,36): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(7,12): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(7,15): error TS2365: Operator '/=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(7,28): error TS2365: Operator '/=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(7,36): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(8,12): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(8,15): error TS2365: Operator '%=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(8,28): error TS2365: Operator '%=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(8,36): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(9,13): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(9,16): error TS2365: Operator '**=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(9,30): error TS2365: Operator '**=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(9,39): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(10,13): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(10,16): error TS2365: Operator '<<=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(10,30): error TS2365: Operator '<<=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(10,39): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(11,13): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(11,16): error TS2365: Operator '>>=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(11,30): error TS2365: Operator '>>=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(11,39): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(12,12): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(12,15): error TS2365: Operator '&=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(12,28): error TS2365: Operator '&=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(12,36): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(13,12): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(13,15): error TS2365: Operator '^=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(13,28): error TS2365: Operator '^=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(13,36): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(14,12): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(14,15): error TS2365: Operator '|=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(14,28): error TS2365: Operator '|=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(14,36): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(15,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(15,16): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(15,32): error TS2365: Operator '+' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(15,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(15,40): error TS2365: Operator '+' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(15,41): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(16,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(16,16): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(16,32): error TS2365: Operator '-' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(16,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(16,40): error TS2365: Operator '-' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(16,41): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(17,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(17,16): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(17,32): error TS2365: Operator '*' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(17,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(17,40): error TS2365: Operator '*' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(17,41): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(18,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(18,16): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(18,32): error TS2365: Operator '/' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(18,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(18,40): error TS2365: Operator '/' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(18,41): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(19,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(19,16): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(19,32): error TS2365: Operator '%' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(19,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(19,40): error TS2365: Operator '%' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(19,41): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(20,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(20,17): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(20,34): error TS2365: Operator '**' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(20,40): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(20,43): error TS2365: Operator '**' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(20,44): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(21,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(21,16): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(21,32): error TS2365: Operator '&' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(21,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(21,40): error TS2365: Operator '&' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(21,41): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(22,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(22,16): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(22,32): error TS2365: Operator '|' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(22,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(22,40): error TS2365: Operator '|' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(22,41): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(23,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(23,16): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(23,32): error TS2365: Operator '^' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(23,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(23,40): error TS2365: Operator '^' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(23,41): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(24,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(24,17): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(24,34): error TS2365: Operator '<<' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(24,40): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(24,43): error TS2365: Operator '<<' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(24,44): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(25,11): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(25,17): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(25,34): error TS2365: Operator '>>' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(25,40): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(25,43): error TS2365: Operator '>>' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(25,44): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(29,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(29,68): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(38,1): error TS2365: Operator '>>>=' cannot be applied to types 'bigint' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(38,14): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(39,10): error TS2365: Operator '>>>' cannot be applied to types 'bigint' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(39,22): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(40,8): error TS2736: Operator '+' cannot be applied to type 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(50,10): error TS2367: This condition will always return 'false' since the types 'bigint' and 'number' have no overlap.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(51,10): error TS2367: This condition will always return 'true' since the types 'bigint' and 'number' have no overlap.
|
||||
@ -128,286 +55,137 @@ tests/cases/compiler/numberVsBigIntOperations.ts(56,7): error TS2362: The left-h
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(56,27): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(57,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(57,1): error TS2365: Operator '&' cannot be applied to types '"3"' and '5n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(57,8): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(57,11): error TS2365: Operator '**' cannot be applied to types '2n' and 'false'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(57,12): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(57,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(60,1): error TS2365: Operator '+' cannot be applied to types 'number | bigint' and 'number | bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(61,1): error TS2365: Operator '<<' cannot be applied to types 'number | bigint' and 'number | bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(70,2): error TS2736: Operator '+' cannot be applied to type 'number | bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(84,22): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(84,27): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(84,47): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(84,52): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(86,26): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(91,24): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(93,22): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(86,7): error TS1155: 'const' declarations must be initialized.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(93,7): error TS1155: 'const' declarations must be initialized.
|
||||
|
||||
|
||||
==== tests/cases/compiler/numberVsBigIntOperations.ts (144 errors) ====
|
||||
==== tests/cases/compiler/numberVsBigIntOperations.ts (64 errors) ====
|
||||
// Cannot mix bigints and numbers
|
||||
let bigInt = 1n, num = 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n; bigInt = 2; num = 1n; num = 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '2' is not assignable to type 'bigint'.
|
||||
~~~
|
||||
!!! error TS2322: Type '1n' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt += 1n; bigInt += 2; num += 1n; num += 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'bigint' and '2'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'number' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt -= 1n; bigInt -= 2; num -= 1n; num -= 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '-=' cannot be applied to types 'bigint' and '2'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '-=' cannot be applied to types 'number' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt *= 1n; bigInt *= 2; num *= 1n; num *= 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '*=' cannot be applied to types 'bigint' and '2'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '*=' cannot be applied to types 'number' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt /= 1n; bigInt /= 2; num /= 1n; num /= 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '/=' cannot be applied to types 'bigint' and '2'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '/=' cannot be applied to types 'number' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt %= 1n; bigInt %= 2; num %= 1n; num %= 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '%=' cannot be applied to types 'bigint' and '2'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '%=' cannot be applied to types 'number' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt **= 1n; bigInt **= 2; num **= 1n; num **= 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '**=' cannot be applied to types 'bigint' and '2'.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '**=' cannot be applied to types 'number' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt <<= 1n; bigInt <<= 2; num <<= 1n; num <<= 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '<<=' cannot be applied to types 'bigint' and '2'.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '<<=' cannot be applied to types 'number' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt >>= 1n; bigInt >>= 2; num >>= 1n; num >>= 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '>>=' cannot be applied to types 'bigint' and '2'.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '>>=' cannot be applied to types 'number' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt &= 1n; bigInt &= 2; num &= 1n; num &= 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '&=' cannot be applied to types 'bigint' and '2'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '&=' cannot be applied to types 'number' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt ^= 1n; bigInt ^= 2; num ^= 1n; num ^= 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '^=' cannot be applied to types 'bigint' and '2'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '^=' cannot be applied to types 'number' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt |= 1n; bigInt |= 2; num |= 1n; num |= 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '|=' cannot be applied to types 'bigint' and '2'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '|=' cannot be applied to types 'number' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n + 2n; num = 1 + 2; 1 + 2n; 1n + 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types '1' and '2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types '1n' and '2'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n - 2n; num = 1 - 2; 1 - 2n; 1n - 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '-' cannot be applied to types '1' and '2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '-' cannot be applied to types '1n' and '2'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n * 2n; num = 1 * 2; 1 * 2n; 1n * 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '*' cannot be applied to types '1' and '2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '*' cannot be applied to types '1n' and '2'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n / 2n; num = 1 / 2; 1 / 2n; 1n / 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '/' cannot be applied to types '1' and '2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '/' cannot be applied to types '1n' and '2'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n % 2n; num = 1 % 2; 1 % 2n; 1n % 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '%' cannot be applied to types '1' and '2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '%' cannot be applied to types '1n' and '2'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n ** 2n; num = 1 ** 2; 1 ** 2n; 1n ** 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '**' cannot be applied to types '1' and '2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '**' cannot be applied to types '1n' and '2'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n & 2n; num = 1 & 2; 1 & 2n; 1n & 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '&' cannot be applied to types '1' and '2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '&' cannot be applied to types '1n' and '2'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n | 2n; num = 1 | 2; 1 | 2n; 1n | 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '|' cannot be applied to types '1' and '2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '|' cannot be applied to types '1n' and '2'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n ^ 2n; num = 1 ^ 2; 1 ^ 2n; 1n ^ 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '^' cannot be applied to types '1' and '2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '^' cannot be applied to types '1n' and '2'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n << 2n; num = 1 << 2; 1 << 2n; 1n << 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '<<' cannot be applied to types '1' and '2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '<<' cannot be applied to types '1n' and '2'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = 1n >> 2n; num = 1 >> 2; 1 >> 2n; 1n >> 2;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '>>' cannot be applied to types '1' and '2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '>>' cannot be applied to types '1n' and '2'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
|
||||
// Plus should still coerce to strings
|
||||
let str: string;
|
||||
str = "abc" + 123; str = "abc" + 123n; str = 123 + "abc"; str = 123n + "abc";
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
|
||||
// Unary operations allowed on bigints and numbers
|
||||
bigInt = bigInt++; bigInt = ++bigInt; num = num++; num = ++num;
|
||||
@ -419,13 +197,9 @@ tests/cases/compiler/numberVsBigIntOperations.ts(93,22): error TS1351: An identi
|
||||
bigInt >>>= 1n; num >>>= 2;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '>>>=' cannot be applied to types 'bigint' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
bigInt = bigInt >>> 1n; num = num >>> 2;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '>>>' cannot be applied to types 'bigint' and '1n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
num = +bigInt; num = +num; num = +"3";
|
||||
~~~~~~
|
||||
!!! error TS2736: Operator '+' cannot be applied to type 'bigint'.
|
||||
@ -462,12 +236,8 @@ tests/cases/compiler/numberVsBigIntOperations.ts(93,22): error TS1351: An identi
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '&' cannot be applied to types '"3"' and '5n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '**' cannot be applied to types '2n' and 'false'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
num = ~"3"; num = -false; // should infer number
|
||||
@ -503,27 +273,17 @@ tests/cases/compiler/numberVsBigIntOperations.ts(93,22): error TS1351: An identi
|
||||
|
||||
// Distinguishing numbers from bigints with typeof
|
||||
const isBigInt: (x: 0n | 1n) => bigint = (x: 0n | 1n) => x;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const isNumber: (x: 0 | 1) => number = (x: 0 | 1) => x;
|
||||
const zeroOrBigOne: 0 | 1n;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1155: 'const' declarations must be initialized.
|
||||
if (typeof zeroOrBigOne === "bigint") isBigInt(zeroOrBigOne);
|
||||
else isNumber(zeroOrBigOne);
|
||||
|
||||
// Distinguishing truthy from falsy
|
||||
const isOne = (x: 1 | 1n) => x;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
if (zeroOrBigOne) isOne(zeroOrBigOne);
|
||||
const bigZeroOrOne: 0n | 1;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1155: 'const' declarations must be initialized.
|
||||
if (bigZeroOrOne) isOne(bigZeroOrOne);
|
||||
@ -1,13 +1,4 @@
|
||||
tests/cases/compiler/parseBigInt.ts(5,32): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(11,38): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(17,33): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(42,17): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(43,18): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(46,17): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(46,23): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(47,22): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(51,20): error TS2736: Operator '+' cannot be applied to type '123n'.
|
||||
tests/cases/compiler/parseBigInt.ts(51,23): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(52,23): error TS2736: Operator '+' cannot be applied to type '291n'.
|
||||
tests/cases/compiler/parseBigInt.ts(56,25): error TS1005: ',' expected.
|
||||
tests/cases/compiler/parseBigInt.ts(57,25): error TS1351: An identifier cannot follow a numeric literal.
|
||||
@ -18,48 +9,32 @@ tests/cases/compiler/parseBigInt.ts(61,20): error TS1178: Octal digit expected.
|
||||
tests/cases/compiler/parseBigInt.ts(62,20): error TS1125: Hexadecimal digit expected.
|
||||
tests/cases/compiler/parseBigInt.ts(63,26): error TS2304: Cannot find name '_123n'.
|
||||
tests/cases/compiler/parseBigInt.ts(64,30): error TS6188: Numeric separators are not allowed here.
|
||||
tests/cases/compiler/parseBigInt.ts(64,31): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(65,33): error TS6189: Multiple consecutive numeric separators are not permitted.
|
||||
tests/cases/compiler/parseBigInt.ts(65,37): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(68,28): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(68,33): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(68,38): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(68,58): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(69,15): error TS2345: Argument of type '0n' is not assignable to parameter of type '1n | 3n | 2n'.
|
||||
tests/cases/compiler/parseBigInt.ts(69,16): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(69,35): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(69,54): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(69,73): error TS1351: An identifier cannot follow a numeric literal.
|
||||
tests/cases/compiler/parseBigInt.ts(70,15): error TS2345: Argument of type '0' is not assignable to parameter of type '1n | 3n | 2n'.
|
||||
tests/cases/compiler/parseBigInt.ts(70,34): error TS2345: Argument of type '1' is not assignable to parameter of type '1n | 3n | 2n'.
|
||||
tests/cases/compiler/parseBigInt.ts(70,53): error TS2345: Argument of type '2' is not assignable to parameter of type '1n | 3n | 2n'.
|
||||
tests/cases/compiler/parseBigInt.ts(70,72): error TS2345: Argument of type '3' is not assignable to parameter of type '1n | 3n | 2n'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/parseBigInt.ts (36 errors) ====
|
||||
==== tests/cases/compiler/parseBigInt.ts (17 errors) ====
|
||||
// All bases should allow "n" suffix
|
||||
const bin = 0b101, binBig = 0b101n; // 5, 5n
|
||||
const oct = 0o567, octBig = 0o567n; // 375, 375n
|
||||
const hex = 0xC0B, hexBig = 0xC0Bn; // 3083, 3083n
|
||||
const dec = 123, decBig = 123n;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
|
||||
// Test literals whose values overflow a 53-bit integer
|
||||
// These should be represented exactly in the emitted JS
|
||||
const largeBin = 0b10101010101010101010101010101010101010101010101010101010101n; // 384307168202282325n
|
||||
const largeOct = 0o123456712345671234567n; // 1505852261029722487n
|
||||
const largeDec = 12345678091234567890n;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const largeHex = 0x1234567890abcdefn; // 1311768467294899695n
|
||||
|
||||
// Test literals with separators
|
||||
const separatedBin = 0b010_10_1n; // 21n
|
||||
const separatedOct = 0o1234_567n; // 342391n
|
||||
const separatedDec = 123_456_789n;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const separatedHex = 0x0_abcdefn; // 11259375n
|
||||
|
||||
// Test parsing literals of different bit sizes
|
||||
@ -85,29 +60,17 @@ tests/cases/compiler/parseBigInt.ts(70,72): error TS2345: Argument of type '3' i
|
||||
|
||||
// Test negative literals
|
||||
const neg = -123n;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const negHex: -16n = -0x10n;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
|
||||
// Test normalization of bigints -- all of these should succeed
|
||||
const negZero: 0n = -0n;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const baseChange: 255n = 0xFFn;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const leadingZeros: 0xFFn = 0x000000FFn;
|
||||
|
||||
// Plus not allowed on literals
|
||||
const unaryPlus = +123n;
|
||||
~~~~
|
||||
!!! error TS2736: Operator '+' cannot be applied to type '123n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const unaryPlusHex = +0x123n;
|
||||
~~~~~~
|
||||
!!! error TS2736: Operator '+' cannot be applied to type '291n'.
|
||||
@ -141,35 +104,15 @@ tests/cases/compiler/parseBigInt.ts(70,72): error TS2345: Argument of type '3' i
|
||||
const trailingSeparator = 123_n;
|
||||
~
|
||||
!!! error TS6188: Numeric separators are not allowed here.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
const doubleSeparator = 123_456__789n;
|
||||
~
|
||||
!!! error TS6189: Multiple consecutive numeric separators are not permitted.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
|
||||
// Using literals as types
|
||||
const oneTwoOrThree = (x: 1n | 2n | 3n): bigint => x ** 2n;
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
oneTwoOrThree(0n); oneTwoOrThree(1n); oneTwoOrThree(2n); oneTwoOrThree(3n);
|
||||
~~
|
||||
!!! error TS2345: Argument of type '0n' is not assignable to parameter of type '1n | 3n | 2n'.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
~
|
||||
!!! error TS1351: An identifier cannot follow a numeric literal.
|
||||
oneTwoOrThree(0); oneTwoOrThree(1); oneTwoOrThree(2); oneTwoOrThree(3);
|
||||
~
|
||||
!!! error TS2345: Argument of type '0' is not assignable to parameter of type '1n | 3n | 2n'.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user