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

Disallow confusing combinations of !in and !instanceof #60628

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bgenia
Copy link

@bgenia bgenia commented Nov 27, 2024

Fixes #60518

Disallows !in and !instanceof sequences.

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Nov 27, 2024
@@ -1967,7 +1967,18 @@ export function createScanner(
}
return pos += 2, token = SyntaxKind.ExclamationEqualsToken;
}
const hasLeadingWhitespace = charCodeChecked(pos - 1) === CharacterCodes.space;
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem like the right check; the character could be a tab or other character. I think we have a helper for this sort of check.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Member

Choose a reason for hiding this comment

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

Thanks; you'll probably want a test with a tab in it just to verify.

@jakebailey
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Nov 27, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started ✅ Results
user test this ✅ Started ✅ Results
run dt ✅ Started ✅ Results
perf test this faster ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user tests with tsc comparing main and refs/pull/60628/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@jakebailey
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 34 34 ~ ~ ~ p=1.000 n=6
Symbols 62,363 62,363 ~ ~ ~ p=1.000 n=6
Types 50,395 50,395 ~ ~ ~ p=1.000 n=6
Memory used 193,039k (± 0.01%) 194,276k (± 0.97%) +1,236k (+ 0.64%) 193,051k 196,714k p=0.013 n=6
Parse Time 1.30s (± 0.94%) 1.33s (± 0.88%) +0.03s (+ 2.04%) 1.31s 1.34s p=0.012 n=6
Bind Time 0.72s 0.72s ~ ~ ~ p=1.000 n=6
Check Time 9.79s (± 0.25%) 9.82s (± 0.27%) ~ 9.78s 9.85s p=0.145 n=6
Emit Time 2.73s (± 0.50%) 2.74s (± 0.89%) ~ 2.71s 2.78s p=0.682 n=6
Total Time 14.55s (± 0.12%) 14.61s (± 0.08%) +0.05s (+ 0.37%) 14.59s 14.62s p=0.005 n=6
angular-1 - node (v18.15.0, x64)
Errors 37 37 ~ ~ ~ p=1.000 n=6
Symbols 947,936 947,936 ~ ~ ~ p=1.000 n=6
Types 410,955 410,955 ~ ~ ~ p=1.000 n=6
Memory used 1,226,015k (± 0.00%) 1,226,020k (± 0.00%) ~ 1,225,972k 1,226,082k p=0.936 n=6
Parse Time 6.65s (± 0.71%) 6.62s (± 0.46%) ~ 6.57s 6.66s p=0.419 n=6
Bind Time 1.89s (± 0.27%) 1.89s (± 0.22%) ~ 1.88s 1.89s p=0.595 n=6
Check Time 32.03s (± 0.28%) 32.06s (± 0.27%) ~ 31.96s 32.17s p=0.575 n=6
Emit Time 15.15s (± 0.61%) 15.20s (± 0.49%) ~ 15.10s 15.28s p=0.575 n=6
Total Time 55.72s (± 0.30%) 55.77s (± 0.19%) ~ 55.67s 55.96s p=0.748 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,500,182 2,500,182 ~ ~ ~ p=1.000 n=6
Types 909,474 909,474 ~ ~ ~ p=1.000 n=6
Memory used 2,318,036k (± 0.00%) 2,318,034k (± 0.00%) ~ 2,317,999k 2,318,056k p=0.630 n=6
Parse Time 9.28s (± 0.40%) 9.29s (± 0.13%) ~ 9.27s 9.30s p=0.089 n=6
Bind Time 2.17s (± 0.71%) 2.16s (± 0.68%) ~ 2.15s 2.19s p=0.401 n=6
Check Time 74.82s (± 0.43%) 74.72s (± 0.54%) ~ 74.01s 75.16s p=0.810 n=6
Emit Time 0.29s (± 2.61%) 0.29s (± 4.22%) ~ 0.27s 0.30s p=0.867 n=6
Total Time 86.56s (± 0.38%) 86.46s (± 0.45%) ~ 85.75s 86.88s p=0.748 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,251 1,225,281 +30 (+ 0.00%) ~ ~ p=0.001 n=6
Types 266,546 266,563 +17 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 2,354,228k (± 0.02%) 2,354,585k (± 0.02%) ~ 2,353,834k 2,355,244k p=0.173 n=6
Parse Time 5.23s (± 0.99%) 5.29s (± 0.95%) ~ 5.22s 5.37s p=0.093 n=6
Bind Time 1.76s (± 1.21%) 1.76s (± 1.24%) ~ 1.73s 1.79s p=1.000 n=6
Check Time 35.17s (± 0.22%) 35.19s (± 0.25%) ~ 35.08s 35.30s p=0.936 n=6
Emit Time 2.98s (± 0.64%) 2.97s (± 1.14%) ~ 2.92s 3.01s p=1.000 n=6
Total Time 45.16s (± 0.16%) 45.22s (± 0.27%) ~ 45.08s 45.37s p=0.689 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,251 1,225,281 +30 (+ 0.00%) ~ ~ p=0.001 n=6
Types 266,546 266,563 +17 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 2,907,664k (±12.88%) 3,149,840k (± 0.02%) ~ 3,149,113k 3,151,110k p=0.230 n=6
Parse Time 6.94s (± 1.91%) 7.05s (± 0.74%) ~ 7.00s 7.14s p=0.078 n=6
Bind Time 2.15s (± 1.83%) 2.14s (± 1.70%) ~ 2.09s 2.18s p=0.872 n=6
Check Time 42.80s (± 0.58%) 42.90s (± 0.25%) ~ 42.79s 43.06s p=0.471 n=6
Emit Time 3.44s (± 2.01%) 3.48s (± 1.64%) ~ 3.40s 3.54s p=0.336 n=6
Total Time 55.33s (± 0.58%) 55.57s (± 0.32%) ~ 55.36s 55.81s p=0.230 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 262,223 262,231 +8 (+ 0.00%) ~ ~ p=0.001 n=6
Types 106,607 106,622 +15 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 439,818k (± 0.01%) 439,867k (± 0.02%) ~ 439,749k 439,954k p=0.336 n=6
Parse Time 3.56s (± 1.22%) 3.58s (± 0.94%) ~ 3.56s 3.65s p=0.107 n=6
Bind Time 1.32s (± 1.39%) 1.32s (± 0.78%) ~ 1.30s 1.33s p=1.000 n=6
Check Time 18.99s (± 0.55%) 18.98s (± 0.47%) ~ 18.87s 19.08s p=1.000 n=6
Emit Time 1.52s (± 0.80%) 1.52s (± 0.93%) ~ 1.50s 1.54s p=0.615 n=6
Total Time 25.39s (± 0.24%) 25.40s (± 0.33%) ~ 25.29s 25.48s p=0.936 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 70 70 ~ ~ ~ p=1.000 n=6
Symbols 226,062 226,062 ~ ~ ~ p=1.000 n=6
Types 94,488 94,488 ~ ~ ~ p=1.000 n=6
Memory used 371,581k (± 0.01%) 371,620k (± 0.02%) ~ 371,540k 371,704k p=0.378 n=6
Parse Time 2.89s (± 1.27%) 2.90s (± 1.14%) ~ 2.86s 2.94s p=0.685 n=6
Bind Time 1.59s (± 0.62%) 1.59s (± 0.89%) ~ 1.57s 1.61s p=0.869 n=6
Check Time 16.46s (± 0.44%) 16.57s (± 1.18%) ~ 16.38s 16.93s p=0.423 n=6
Emit Time 0.00s (±244.70%) 0.00s ~ ~ ~ p=0.405 n=6
Total Time 20.95s (± 0.40%) 21.07s (± 0.92%) ~ 20.85s 21.40s p=0.261 n=6
vscode - node (v18.15.0, x64)
Errors 4 4 ~ ~ ~ p=1.000 n=6
Symbols 3,184,671 3,184,671 ~ ~ ~ p=1.000 n=6
Types 1,095,225 1,095,225 ~ ~ ~ p=1.000 n=6
Memory used 3,259,086k (± 0.01%) 3,259,026k (± 0.01%) ~ 3,258,414k 3,259,551k p=0.810 n=6
Parse Time 14.02s (± 0.34%) 14.10s (± 0.69%) ~ 14.02s 14.27s p=0.109 n=6
Bind Time 4.49s (± 2.73%) 4.56s (± 2.92%) ~ 4.47s 4.74s p=0.169 n=6
Check Time 86.54s (± 1.65%) 86.11s (± 1.19%) ~ 85.06s 88.08s p=0.810 n=6
Emit Time 27.80s (± 2.86%) 27.84s (± 3.05%) ~ 26.89s 28.77s p=0.810 n=6
Total Time 132.85s (± 0.92%) 132.61s (± 0.78%) ~ 130.95s 133.78s p=0.689 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 288,684 288,684 ~ ~ ~ p=1.000 n=6
Types 117,136 117,136 ~ ~ ~ p=1.000 n=6
Memory used 440,801k (± 0.02%) 440,939k (± 0.04%) ~ 440,717k 441,218k p=0.378 n=6
Parse Time 4.06s (± 0.82%) 4.09s (± 0.83%) ~ 4.06s 4.13s p=0.090 n=6
Bind Time 1.74s (± 1.66%) 1.74s (± 0.60%) ~ 1.72s 1.75s p=0.462 n=6
Check Time 18.79s (± 0.36%) 18.89s (± 0.73%) ~ 18.72s 19.04s p=0.146 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.58s (± 0.37%) 24.72s (± 0.56%) ~ 24.53s 24.85s p=0.128 n=6
xstate-main - node (v18.15.0, x64)
Errors 8 8 ~ ~ ~ p=1.000 n=6
Symbols 551,583 551,583 ~ ~ ~ p=1.000 n=6
Types 184,808 184,808 ~ ~ ~ p=1.000 n=6
Memory used 491,885k (± 0.02%) 491,915k (± 0.03%) ~ 491,688k 492,130k p=0.689 n=6
Parse Time 3.42s (± 0.84%) 3.46s (± 0.84%) +0.04s (+ 1.12%) 3.42s 3.50s p=0.043 n=6
Bind Time 1.18s (± 0.93%) 1.18s (± 1.16%) ~ 1.16s 1.19s p=0.933 n=6
Check Time 19.81s (± 2.30%) 19.78s (± 2.06%) ~ 19.57s 20.61s p=0.936 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.42s (± 1.84%) 24.42s (± 1.65%) ~ 24.21s 25.24s p=0.689 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the top 400 repos with tsc comparing main and refs/pull/60628/merge:

Everything looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Status: Not started
Development

Successfully merging this pull request may close these issues.

Non-null assertion operator whitespace allowances can create confusing conditional statements
3 participants