From f7ad54b432c2fc0fc437f3e25be03c34a2040e4f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 9 Nov 2018 16:20:54 -0800 Subject: [PATCH 1/8] Only complain about BigInt literals in pre-ESNext targets. --- src/compiler/checker.ts | 5 +---- src/compiler/commandLineParser.ts | 6 ------ src/compiler/diagnosticMessages.json | 10 +--------- src/compiler/types.ts | 1 - 4 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f06a284a72918..1ae0817358ace 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -30528,13 +30528,10 @@ namespace ts { isPrefixUnaryExpression(node.parent) && isLiteralTypeNode(node.parent.parent); if (!literalType) { if (languageVersion < ScriptTarget.ESNext) { - if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targetting_lower_than_ESNext)) { + if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) { return true; } } - if (!compilerOptions.experimentalBigInt) { - return grammarErrorOnNode(node, Diagnostics.Experimental_support_for_BigInt_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalBigInt_option_to_remove_this_warning); - } } return false; } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index e3b6fe69d219e..972336967dcae 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -584,12 +584,6 @@ namespace ts { category: Diagnostics.Experimental_Options, description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators }, - { - name: "experimentalBigInt", - type: "boolean", - category: Diagnostics.Experimental_Options, - description: Diagnostics.Enables_experimental_support_for_ESNext_BigInt_literals - }, // Advanced { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 3ba74f0307317..b8509cae1e5b2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1011,10 +1011,6 @@ "category": "Message", "code": 1350 }, - "Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning.": { - "category": "Error", - "code": 1351 - }, "Duplicate identifier '{0}'.": { "category": "Error", @@ -2505,7 +2501,7 @@ "category": "Error", "code": 2736 }, - "BigInt literals are not available when targetting lower than ESNext.": { + "BigInt literals are not available when targeting lower than ESNext.": { "category": "Error", "code": 2737 }, @@ -3921,10 +3917,6 @@ "category": "Error", "code": 6370 }, - "Enables experimental support for ESNext BigInt literals.": { - "category": "Message", - "code": 6371 - }, "The expected type comes from property '{0}' which is declared here on type '{1}'": { "category": "Message", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 45e63475924ee..65a04d4394917 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4495,7 +4495,6 @@ namespace ts { downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; - experimentalBigInt?: boolean; experimentalDecorators?: boolean; forceConsistentCasingInFileNames?: boolean; /*@internal*/help?: boolean; From 15f2f047f8e1d28d004fcc5c0772dff94c45582d Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 9 Nov 2018 16:21:06 -0800 Subject: [PATCH 2/8] Updated test case. --- tests/cases/compiler/warnExperimentalBigIntLiteral.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/cases/compiler/warnExperimentalBigIntLiteral.ts b/tests/cases/compiler/warnExperimentalBigIntLiteral.ts index c59bff0696ec3..6b09bf51241f8 100644 --- a/tests/cases/compiler/warnExperimentalBigIntLiteral.ts +++ b/tests/cases/compiler/warnExperimentalBigIntLiteral.ts @@ -1,7 +1,8 @@ -// @target: esnext +// @target: es3 const normalNumber = 123; // should not error let bigintType: bigint; // should not error let bigintLiteralType: 123n; // should not error when used as type let bigintNegativeLiteralType: -123n; // should not error when used as type -const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error \ No newline at end of file +const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error + From 17b77dfdced91a910bdcb2a4dc68e02345528699 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 9 Nov 2018 16:21:16 -0800 Subject: [PATCH 3/8] Accepted baselines. --- .../warnExperimentalBigIntLiteral.errors.txt | 18 ++++++++++-------- .../reference/warnExperimentalBigIntLiteral.js | 14 ++++++++------ .../warnExperimentalBigIntLiteral.symbols | 1 + .../warnExperimentalBigIntLiteral.types | 1 + 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt b/tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt index 3e8e50d148ceb..5b442c746b91e 100644 --- a/tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt +++ b/tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,22): error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,29): error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,39): error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,48): error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. +tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,22): error TS2737: BigInt literals are not available when targeting lower than ESNext. +tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,29): error TS2737: BigInt literals are not available when targeting lower than ESNext. +tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,39): error TS2737: BigInt literals are not available when targeting lower than ESNext. +tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,48): error TS2737: BigInt literals are not available when targeting lower than ESNext. ==== tests/cases/compiler/warnExperimentalBigIntLiteral.ts (4 errors) ==== @@ -11,10 +11,12 @@ tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,48): error TS1351: Exper let bigintNegativeLiteralType: -123n; // should not error when used as type const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error ~~~~ -!!! error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. ~~~~~~~ -!!! error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. ~~~~~~ -!!! error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. ~~~~~ -!!! error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. \ No newline at end of file +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. + + \ No newline at end of file diff --git a/tests/baselines/reference/warnExperimentalBigIntLiteral.js b/tests/baselines/reference/warnExperimentalBigIntLiteral.js index 2a1ee53b2c039..e07407bc1c298 100644 --- a/tests/baselines/reference/warnExperimentalBigIntLiteral.js +++ b/tests/baselines/reference/warnExperimentalBigIntLiteral.js @@ -3,11 +3,13 @@ const normalNumber = 123; // should not error let bigintType: bigint; // should not error let bigintLiteralType: 123n; // should not error when used as type let bigintNegativeLiteralType: -123n; // should not error when used as type -const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error +const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error + + //// [warnExperimentalBigIntLiteral.js] -const normalNumber = 123; // should not error -let bigintType; // should not error -let bigintLiteralType; // should not error when used as type -let bigintNegativeLiteralType; // should not error when used as type -const bigintNumber = 123n * 15n + 292n * 0x7fn; // each literal should error +var normalNumber = 123; // should not error +var bigintType; // should not error +var bigintLiteralType; // should not error when used as type +var bigintNegativeLiteralType; // should not error when used as type +var bigintNumber = 123n * 15n + 292n * 0x7fn; // each literal should error diff --git a/tests/baselines/reference/warnExperimentalBigIntLiteral.symbols b/tests/baselines/reference/warnExperimentalBigIntLiteral.symbols index 1ea1c380601fd..94cc867b42eca 100644 --- a/tests/baselines/reference/warnExperimentalBigIntLiteral.symbols +++ b/tests/baselines/reference/warnExperimentalBigIntLiteral.symbols @@ -14,3 +14,4 @@ let bigintNegativeLiteralType: -123n; // should not error when used as type const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error >bigintNumber : Symbol(bigintNumber, Decl(warnExperimentalBigIntLiteral.ts, 4, 5)) + diff --git a/tests/baselines/reference/warnExperimentalBigIntLiteral.types b/tests/baselines/reference/warnExperimentalBigIntLiteral.types index a0ba0a9564b19..607c2aa9115e7 100644 --- a/tests/baselines/reference/warnExperimentalBigIntLiteral.types +++ b/tests/baselines/reference/warnExperimentalBigIntLiteral.types @@ -24,3 +24,4 @@ const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should err >0o444n : 292n >0x7fn : 127n + From 146afddae1121e26166968ec6e6208a9cc212844 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 9 Nov 2018 17:09:16 -0800 Subject: [PATCH 4/8] Accepted baselines. --- tests/baselines/reference/api/tsserverlibrary.d.ts | 1 - tests/baselines/reference/api/typescript.d.ts | 1 - .../tsConfig/Default initialized TSConfig/tsconfig.json | 1 - .../Initialized TSConfig with advanced options/tsconfig.json | 1 - .../tsconfig.json | 1 - .../tsconfig.json | 1 - .../Initialized TSConfig with files options/tsconfig.json | 1 - .../tsconfig.json | 1 - .../tsconfig.json | 1 - .../tsconfig.json | 1 - .../tsconfig.json | 1 - 11 files changed, 11 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index c024d92620747..ac36533a09454 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2450,7 +2450,6 @@ declare namespace ts { downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; - experimentalBigInt?: boolean; experimentalDecorators?: boolean; forceConsistentCasingInFileNames?: boolean; importHelpers?: boolean; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 335283ce43f0b..83a5cab6a596e 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2450,7 +2450,6 @@ declare namespace ts { downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; - experimentalBigInt?: boolean; experimentalDecorators?: boolean; forceConsistentCasingInFileNames?: boolean; importHelpers?: boolean; diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index 7d444ecc45fa4..e4e3d7b8ec424 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index 43836a779ad50..1919671c48975 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -56,7 +56,6 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ /* Advanced Options */ "noErrorTruncation": true, /* Do not truncate error messages. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index 73e0564f2ad99..3b49dee6e3d6f 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 51fd4e44cf901..d91e167877d37 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index dd8f183c32eeb..e6107b29b4c47 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -56,7 +56,6 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ }, "files": [ "file0.st", diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index de16ddfba0c90..7c18b695c7b9d 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index 7d444ecc45fa4..e4e3d7b8ec424 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 587d9941a70ec..eedcc357043af 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index 75621cafebc53..6fc7833730f7f 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file From e4bb1973ed97023546d983c1b07f22c335610e8a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 12 Nov 2018 14:05:01 -0800 Subject: [PATCH 5/8] Fixed up flags on test cases and stray newline. --- tests/cases/compiler/bigintIndex.ts | 1 - tests/cases/compiler/bigintWithLib.ts | 1 - tests/cases/compiler/bigintWithoutLib.ts | 1 - tests/cases/compiler/numberVsBigIntOperations.ts | 1 - tests/cases/compiler/parseBigInt.ts | 1 - tests/cases/compiler/warnExperimentalBigIntLiteral.ts | 1 - 6 files changed, 6 deletions(-) diff --git a/tests/cases/compiler/bigintIndex.ts b/tests/cases/compiler/bigintIndex.ts index 78bb24be44110..624ede199cae6 100644 --- a/tests/cases/compiler/bigintIndex.ts +++ b/tests/cases/compiler/bigintIndex.ts @@ -1,5 +1,4 @@ // @target: esnext -// @experimentalBigInt: true // @filename: a.ts interface BigIntIndex { diff --git a/tests/cases/compiler/bigintWithLib.ts b/tests/cases/compiler/bigintWithLib.ts index 0cefd3094d4b7..6160ecab75cc0 100644 --- a/tests/cases/compiler/bigintWithLib.ts +++ b/tests/cases/compiler/bigintWithLib.ts @@ -1,4 +1,3 @@ -// @experimentalBigInt: true // @target: esnext // @declaration: true diff --git a/tests/cases/compiler/bigintWithoutLib.ts b/tests/cases/compiler/bigintWithoutLib.ts index 94d77ffa6f411..6ebb8630b7e82 100644 --- a/tests/cases/compiler/bigintWithoutLib.ts +++ b/tests/cases/compiler/bigintWithoutLib.ts @@ -1,4 +1,3 @@ -// @experimentalBigInt: true // @target: es5 // Every line should error because these builtins are not declared diff --git a/tests/cases/compiler/numberVsBigIntOperations.ts b/tests/cases/compiler/numberVsBigIntOperations.ts index e6b87e57e1391..74b1cea81f202 100644 --- a/tests/cases/compiler/numberVsBigIntOperations.ts +++ b/tests/cases/compiler/numberVsBigIntOperations.ts @@ -1,4 +1,3 @@ -// @experimentalBigInt: true // @target: esnext // Cannot mix bigints and numbers diff --git a/tests/cases/compiler/parseBigInt.ts b/tests/cases/compiler/parseBigInt.ts index 05ee6bfd7aca6..e50fbb06c9820 100644 --- a/tests/cases/compiler/parseBigInt.ts +++ b/tests/cases/compiler/parseBigInt.ts @@ -1,4 +1,3 @@ -// @experimentalBigInt: true // @target: esnext // All bases should allow "n" suffix diff --git a/tests/cases/compiler/warnExperimentalBigIntLiteral.ts b/tests/cases/compiler/warnExperimentalBigIntLiteral.ts index 6b09bf51241f8..95753904f4bf7 100644 --- a/tests/cases/compiler/warnExperimentalBigIntLiteral.ts +++ b/tests/cases/compiler/warnExperimentalBigIntLiteral.ts @@ -5,4 +5,3 @@ let bigintType: bigint; // should not error let bigintLiteralType: 123n; // should not error when used as type let bigintNegativeLiteralType: -123n; // should not error when used as type const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error - From 9e92597ae76524778037b627d76c5a10d9040f6a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 12 Nov 2018 14:06:09 -0800 Subject: [PATCH 6/8] More general test case name. --- .../{warnExperimentalBigIntLiteral.ts => bigIntWithTargetES3.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/cases/compiler/{warnExperimentalBigIntLiteral.ts => bigIntWithTargetES3.ts} (100%) diff --git a/tests/cases/compiler/warnExperimentalBigIntLiteral.ts b/tests/cases/compiler/bigIntWithTargetES3.ts similarity index 100% rename from tests/cases/compiler/warnExperimentalBigIntLiteral.ts rename to tests/cases/compiler/bigIntWithTargetES3.ts From cd5928a98046583145d7bf713e4516bb0ddd968e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 12 Nov 2018 14:52:13 -0800 Subject: [PATCH 7/8] Accepted baselines. --- .../reference/bigIntWithTargetES3.errors.txt | 21 ++++++++ .../reference/bigIntWithTargetES3.js | 14 ++++++ .../reference/bigIntWithTargetES3.symbols | 16 +++++++ .../reference/bigIntWithTargetES3.types | 26 ++++++++++ .../reference/bigintWithoutLib.errors.txt | 48 +++++++++---------- 5 files changed, 101 insertions(+), 24 deletions(-) create mode 100644 tests/baselines/reference/bigIntWithTargetES3.errors.txt create mode 100644 tests/baselines/reference/bigIntWithTargetES3.js create mode 100644 tests/baselines/reference/bigIntWithTargetES3.symbols create mode 100644 tests/baselines/reference/bigIntWithTargetES3.types diff --git a/tests/baselines/reference/bigIntWithTargetES3.errors.txt b/tests/baselines/reference/bigIntWithTargetES3.errors.txt new file mode 100644 index 0000000000000..6fa938535f11d --- /dev/null +++ b/tests/baselines/reference/bigIntWithTargetES3.errors.txt @@ -0,0 +1,21 @@ +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 (4 errors) ==== + const normalNumber = 123; // should not error + let bigintType: bigint; // should not error + let bigintLiteralType: 123n; // should not error when used as type + let bigintNegativeLiteralType: -123n; // should not error when used as type + const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error + ~~~~ +!!! 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. + \ No newline at end of file diff --git a/tests/baselines/reference/bigIntWithTargetES3.js b/tests/baselines/reference/bigIntWithTargetES3.js new file mode 100644 index 0000000000000..ad6f25a767139 --- /dev/null +++ b/tests/baselines/reference/bigIntWithTargetES3.js @@ -0,0 +1,14 @@ +//// [bigIntWithTargetES3.ts] +const normalNumber = 123; // should not error +let bigintType: bigint; // should not error +let bigintLiteralType: 123n; // should not error when used as type +let bigintNegativeLiteralType: -123n; // should not error when used as type +const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error + + +//// [bigIntWithTargetES3.js] +var normalNumber = 123; // should not error +var bigintType; // should not error +var bigintLiteralType; // should not error when used as type +var bigintNegativeLiteralType; // should not error when used as type +var bigintNumber = 123n * 15n + 292n * 0x7fn; // each literal should error diff --git a/tests/baselines/reference/bigIntWithTargetES3.symbols b/tests/baselines/reference/bigIntWithTargetES3.symbols new file mode 100644 index 0000000000000..b4415dca87fd4 --- /dev/null +++ b/tests/baselines/reference/bigIntWithTargetES3.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/bigIntWithTargetES3.ts === +const normalNumber = 123; // should not error +>normalNumber : Symbol(normalNumber, Decl(bigIntWithTargetES3.ts, 0, 5)) + +let bigintType: bigint; // should not error +>bigintType : Symbol(bigintType, Decl(bigIntWithTargetES3.ts, 1, 3)) + +let bigintLiteralType: 123n; // should not error when used as type +>bigintLiteralType : Symbol(bigintLiteralType, Decl(bigIntWithTargetES3.ts, 2, 3)) + +let bigintNegativeLiteralType: -123n; // should not error when used as type +>bigintNegativeLiteralType : Symbol(bigintNegativeLiteralType, Decl(bigIntWithTargetES3.ts, 3, 3)) + +const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error +>bigintNumber : Symbol(bigintNumber, Decl(bigIntWithTargetES3.ts, 4, 5)) + diff --git a/tests/baselines/reference/bigIntWithTargetES3.types b/tests/baselines/reference/bigIntWithTargetES3.types new file mode 100644 index 0000000000000..ff9b8d80c3d34 --- /dev/null +++ b/tests/baselines/reference/bigIntWithTargetES3.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/bigIntWithTargetES3.ts === +const normalNumber = 123; // should not error +>normalNumber : 123 +>123 : 123 + +let bigintType: bigint; // should not error +>bigintType : bigint + +let bigintLiteralType: 123n; // should not error when used as type +>bigintLiteralType : 123n + +let bigintNegativeLiteralType: -123n; // should not error when used as type +>bigintNegativeLiteralType : -123n +>-123n : -123n +>123n : 123n + +const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error +>bigintNumber : bigint +>123n * 0b1111n + 0o444n * 0x7fn : bigint +>123n * 0b1111n : bigint +>123n : 123n +>0b1111n : 15n +>0o444n * 0x7fn : bigint +>0o444n : 292n +>0x7fn : 127n + diff --git a/tests/baselines/reference/bigintWithoutLib.errors.txt b/tests/baselines/reference/bigintWithoutLib.errors.txt index 2647a06634ff4..7d2c38b29df56 100644 --- a/tests/baselines/reference/bigintWithoutLib.errors.txt +++ b/tests/baselines/reference/bigintWithoutLib.errors.txt @@ -2,18 +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 targetting lower than ESNext. +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 targetting lower than ESNext. +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,34): error TS2737: BigInt literals are not available when targetting lower than ESNext. -tests/cases/compiler/bigintWithoutLib.ts(17,38): error TS2737: BigInt literals are not available when targetting lower than ESNext. -tests/cases/compiler/bigintWithoutLib.ts(17,42): error TS2737: BigInt literals are not available when targetting lower than ESNext. +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'. @@ -22,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,36): error TS2737: BigInt literals are not available when targetting lower than ESNext. -tests/cases/compiler/bigintWithoutLib.ts(29,40): error TS2737: BigInt literals are not available when targetting lower than ESNext. -tests/cases/compiler/bigintWithoutLib.ts(29,44): error TS2737: BigInt literals are not available when targetting lower than ESNext. +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,26): error TS2737: BigInt literals are not available when targetting lower than ESNext. +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,26): error TS2737: BigInt literals are not available when targetting lower than ESNext. +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,26): error TS2737: BigInt literals are not available when targetting lower than ESNext. +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,26): error TS2737: BigInt literals are not available when targetting lower than ESNext. +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'. @@ -62,12 +62,12 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU ~~~~~~ !!! error TS2304: Cannot find name 'BigInt'. ~~~~~~~ -!!! error TS2737: BigInt literals are not available when targetting lower than ESNext. +!!! 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 targetting lower than ESNext. +!!! 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'. @@ -93,11 +93,11 @@ 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 TS2737: BigInt literals are not available when targetting lower than ESNext. +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. ~~ -!!! error TS2737: BigInt literals are not available when targetting lower than ESNext. +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. ~~ -!!! error TS2737: BigInt literals are not available when targetting 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'? @@ -128,11 +128,11 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU ~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'BigUint64Array'. ~~ -!!! error TS2737: BigInt literals are not available when targetting lower than ESNext. +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. ~~ -!!! error TS2737: BigInt literals are not available when targetting lower than ESNext. +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. ~~ -!!! error TS2737: BigInt literals are not available when targetting 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'. @@ -155,12 +155,12 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU ~~~~~~~~~~~ !!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'. ~~ -!!! error TS2737: BigInt literals are not available when targetting lower than ESNext. +!!! 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 TS2737: BigInt literals are not available when targetting lower than ESNext. +!!! 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'. @@ -168,12 +168,12 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU ~~~~~~~~~~~~ !!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. ~~~~ -!!! error TS2737: BigInt literals are not available when targetting lower than ESNext. +!!! 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 TS2737: BigInt literals are not available when targetting lower than ESNext. +!!! 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'. From 624fdcb0bdb9d0e332c4b9538daeb5d5b0da55c9 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 12 Nov 2018 15:30:06 -0800 Subject: [PATCH 8/8] git rm file; not sure how we missed that. --- .../warnExperimentalBigIntLiteral.errors.txt | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt diff --git a/tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt b/tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt deleted file mode 100644 index 5b442c746b91e..0000000000000 --- a/tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,22): error TS2737: BigInt literals are not available when targeting lower than ESNext. -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,29): error TS2737: BigInt literals are not available when targeting lower than ESNext. -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,39): error TS2737: BigInt literals are not available when targeting lower than ESNext. -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,48): error TS2737: BigInt literals are not available when targeting lower than ESNext. - - -==== tests/cases/compiler/warnExperimentalBigIntLiteral.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 - let bigintNegativeLiteralType: -123n; // should not error when used as type - const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error - ~~~~ -!!! 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. - - \ No newline at end of file