Skip to content

BigInt shouldn't be considered experimental #28456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 0 additions & 6 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
10 changes: 1 addition & 9 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
},
Expand Down Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4495,7 +4495,6 @@ namespace ts {
downlevelIteration?: boolean;
emitBOM?: boolean;
emitDecoratorMetadata?: boolean;
experimentalBigInt?: boolean;
experimentalDecorators?: boolean;
forceConsistentCasingInFileNames?: boolean;
/*@internal*/help?: boolean;
Expand Down
18 changes: 10 additions & 8 deletions tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt
Original file line number Diff line number Diff line change
@@ -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) ====
Expand All @@ -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.
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.


14 changes: 8 additions & 6 deletions tests/baselines/reference/warnExperimentalBigIntLiteral.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these warnExperimentalBigIntLiteral.* baselines be removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed warnExperimentalBigIntLiteral.errors.txt but not the .js, the .symbols, and the .types files

Original file line number Diff line number Diff line change
Expand Up @@ -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))


Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should err
>0o444n : 292n
>0x7fn : 127n


5 changes: 3 additions & 2 deletions tests/cases/compiler/warnExperimentalBigIntLiteral.ts
Original file line number Diff line number Diff line change
@@ -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
const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you added 2 newlines here, but probably only meant to add 1