-
Notifications
You must be signed in to change notification settings - Fork 12.8k
[WIP] Update parser and diagnostics for numbers starting with zero #39698
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
Conversation
@typescript-bot pack this |
Heya @DanielRosenwasser, I've started to run the tarball bundle task on this PR at 0d37497. You can monitor the build here. |
Heya @DanielRosenwasser, I've started to run the perf test suite on this PR at 0d37497. You can monitor the build here. Update: The results are in! |
Heya @DanielRosenwasser, I've started to run the extended test suite on this PR at 0d37497. You can monitor the build here. |
Heya @DanielRosenwasser, I've started to run the parallelized Definitely Typed test suite on this PR at 0d37497. You can monitor the build here. |
Heya @DanielRosenwasser, I've started to run the parallelized community code test suite on this PR at 0d37497. You can monitor the build here. |
Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build. |
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
@DanielRosenwasser Here they are:Comparison Report - master..39698
System
Hosts
Scenarios
|
@DanielRosenwasser thank you! Looks like there is only one new error specific to this PR and it's correct:
Reported line: |
To help with PR housekeeping, I'm going to close this draft PR. It's pretty old. |
Fixes #39563
Fixes other problems with numbers that start with
0
After couple attempts to improve over
scanOctalDigits
to handle numeric separators it looked easier to rework parser logic for all numbers that start with0
.Updated logic is applied only to cases that were previously handled with potential problems: numbers that has leading zero and more than one digit or has numeric separator right after leading zero.
Updated behavior (also see screenshots below):
007
- parsed as octal literal, reported as octal literal in strict mode (as before)009
- parsed as single numeric literal, reported as zero-leading in strict mode077_77
- parsed as single numeric literal (not octal), separator reported as not allowed, and reported as zero-leading in strict mode.0123n
- parsed as single BigInt literal (not octal), reported as invalid BigInt literal.0123identifier
- parsed as octal literal (as before), but now reports identifier that immediately follows numeric literal.I will add updated test later this week.
@DanielRosenwasser could you run extended test suite on this PR please? I think it worth to see if it's feasible to continue with expanded scope of this PR and what errors worth to add to tests.
Screenshots with new behavior
Before:

After:
