Skip to content
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

Do not use BigInt literal without features: [BigInt] #1253

Merged
merged 1 commit into from
Oct 3, 2017
Merged

Do not use BigInt literal without features: [BigInt] #1253

merged 1 commit into from
Oct 3, 2017

Conversation

Constellation
Copy link
Member

typeCoercion.js is included in several tests which are not marked as features: [BigInt].
Since BigInt is new feature, we should not make the above unrelated tests failed due to
lack of BigInt syntax support.

Close #1252.

typeCoercion.js is included in several tests which are not marked as `features: [BigInt]`.
Since BigInt is new feature, we should not make the above unrelated tests failed due to
lack of BigInt syntax support.

Close #1252.
@leobalter
Copy link
Member

#1252 (comment)

Can you point any test including typeCoercion.js and not adding a feature tag for BigInt? This would be a linter problem we also need to solve.

I'm not sure replacing the literal value by the constructor is the best solution if neither are implemented. Anyway, I'm inclined to use this proposed change to at least avoid a parsing error. My only blocking question is: should we allow the test runner to fail at the end (using BigInt ctor) or early (using the literal form)?

Maybe the constructor allows a better handling for the unsupported feature and reading the features tags, but I'm afraid this might open a path for a bad practice.

I'll revisit this issue on the week days.

@Constellation
Copy link
Member Author

Oops, sorry, test/built-ins/String/prototype/indexOf/position-tointeger.js includes feature flag BigInt since it includes this file.

But I think this file should not require BigInt because this test is not using it.
Actually, this test is not marked as BigInt feature when this test is created at 29938e9.

In addition, some places of typeCoercion.js take care of the environments missing BigInt. For example,
https://github.com/Constellation/test262/blob/d2724b9f438cbd79789bb2c41cdd219944e48217/harness/typeCoercion.js#L234-L237 is,

  if (typeof BigInt !== "undefined") {
    // ToNumber: BigInt -> TypeError
    testPrimitiveValue(BigInt(0));
  }

Since typeCoercion.js is a set of utilities to test type coercion, I expect that we can replace existing type coercion tests with this file's utility. But I don't think it is good that making these tests failed if we do not support BigInt. This is because these tests are not for BigInt.

So, I think we need to take care of using new syntax feature (like BigInt literal) in a utitlty file.
I think either (1) using typeof BigInt check when using BigInt in typeCoercion.js, or (2) separating BigInt feature from typeCoercion.js is better.

@leobalter
Copy link
Member

leobalter commented Oct 3, 2017 via email

@leobalter leobalter merged commit ba891c7 into tc39:master Oct 3, 2017
@Constellation
Copy link
Member Author

Thank you :D

@Constellation Constellation deleted the bigint branch October 4, 2017 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants