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 truthiness checks on certain literal kinds #59003

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RyanCavanaugh
Copy link
Member

@RyanCavanaugh RyanCavanaugh commented Jun 24, 2024

Seeing what a potential fix for #59001 turns up

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jun 24, 2024
@RyanCavanaugh RyanCavanaugh changed the title Investigatory patch for #59001 Disallow truthiness checks on certain literal kinds Jun 24, 2024
@RyanCavanaugh
Copy link
Member Author

@typescript-bot test this

@jakebailey
Copy link
Member

@typescript-bot test it

I guess I should make that an alias, as two people have done that today...

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 24, 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

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 Here are the results of running the user tests with tsc comparing main and refs/pull/59003/merge:

Everything looks good!

@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 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,242 ~ ~ ~ p=1.000 n=6
Memory used 192,143k (± 0.01%) 194,543k (± 0.97%) ~ 192,099k 195,793k p=0.298 n=6
Parse Time 1.31s (± 0.75%) 1.31s (± 0.39%) ~ 1.30s 1.31s p=0.504 n=6
Bind Time 0.71s (± 0.57%) 0.71s ~ ~ ~ p=0.405 n=6
Check Time 9.44s (± 0.44%) 9.42s (± 0.41%) ~ 9.38s 9.49s p=0.468 n=6
Emit Time 2.76s (± 0.63%) 2.75s (± 0.70%) ~ 2.72s 2.78s p=0.677 n=6
Total Time 14.21s (± 0.34%) 14.19s (± 0.22%) ~ 14.15s 14.23s p=0.629 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,114 944,114 ~ ~ ~ p=1.000 n=6
Types 407,051 407,051 ~ ~ ~ p=1.000 n=6
Memory used 1,218,343k (± 0.00%) 1,218,335k (± 0.00%) ~ 1,218,275k 1,218,396k p=0.810 n=6
Parse Time 6.68s (± 0.84%) 6.64s (± 0.69%) ~ 6.56s 6.69s p=0.228 n=6
Bind Time 1.87s (± 0.53%) 1.87s (± 1.69%) ~ 1.83s 1.92s p=0.442 n=6
Check Time 30.57s (± 0.32%) 30.60s (± 0.49%) ~ 30.43s 30.81s p=0.575 n=6
Emit Time 13.57s (± 0.40%) 13.51s (± 1.00%) ~ 13.24s 13.61s p=0.808 n=6
Total Time 52.68s (± 0.18%) 52.61s (± 0.47%) ~ 52.26s 52.91s p=0.810 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,135,096 2,135,096 ~ ~ ~ p=1.000 n=6
Types 927,167 927,167 ~ ~ ~ p=1.000 n=6
Memory used 2,117,442k (± 0.01%) 2,117,387k (± 0.00%) ~ 2,117,321k 2,117,507k p=1.000 n=6
Parse Time 6.65s (± 0.38%) 6.64s (± 0.29%) ~ 6.61s 6.66s p=0.622 n=6
Bind Time 2.33s (± 1.10%) 2.35s (± 0.58%) ~ 2.33s 2.37s p=0.558 n=6
Check Time 70.72s (± 0.33%) 70.75s (± 1.00%) ~ 69.35s 71.26s p=0.170 n=6
Emit Time 0.14s (± 4.05%) 0.13s (± 3.10%) ~ 0.13s 0.14s p=0.282 n=6
Total Time 79.84s (± 0.29%) 79.87s (± 0.87%) ~ 78.49s 80.40s p=0.173 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,230,971 1,230,984 +13 (+ 0.00%) ~ ~ p=0.001 n=6
Types 261,250 261,255 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,345,956k (± 0.05%) 2,346,105k (± 0.04%) ~ 2,344,533k 2,347,294k p=0.936 n=6
Parse Time 5.02s (± 0.71%) 5.02s (± 0.58%) ~ 4.97s 5.06s p=0.374 n=6
Bind Time 1.93s (± 0.54%) 1.91s (± 1.03%) ~ 1.88s 1.93s p=0.119 n=6
Check Time 33.80s (± 0.39%) 33.75s (± 0.33%) ~ 33.57s 33.89s p=0.689 n=6
Emit Time 2.69s (± 3.53%) 2.66s (± 2.14%) ~ 2.60s 2.75s p=0.521 n=6
Total Time 43.45s (± 0.31%) 43.36s (± 0.28%) ~ 43.17s 43.52s p=0.298 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,230,971 1,230,984 +13 (+ 0.00%) ~ ~ p=0.001 n=6
Types 261,250 261,255 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,432,471k (± 1.00%) 2,422,548k (± 0.04%) ~ 2,420,543k 2,423,489k p=0.810 n=6
Parse Time 6.16s (± 0.99%) 6.16s (± 0.37%) ~ 6.14s 6.20s p=0.573 n=6
Bind Time 2.01s (± 1.26%) 2.01s (± 0.58%) ~ 2.00s 2.03s p=0.808 n=6
Check Time 40.02s (± 0.24%) 39.98s (± 0.23%) ~ 39.90s 40.16s p=0.575 n=6
Emit Time 3.16s (± 1.36%) 3.17s (± 2.55%) ~ 3.08s 3.31s p=1.000 n=6
Total Time 51.35s (± 0.24%) 51.34s (± 0.28%) ~ 51.18s 51.49s p=1.000 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,575 258,577 +2 (+ 0.00%) ~ ~ p=0.001 n=6
Types 104,826 104,830 +4 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 428,194k (± 0.01%) 428,222k (± 0.00%) ~ 428,201k 428,246k p=0.471 n=6
Parse Time 3.31s (± 0.59%) 3.32s (± 1.14%) ~ 3.29s 3.39s p=0.629 n=6
Bind Time 1.32s (± 1.96%) 1.31s (± 1.08%) ~ 1.29s 1.33s p=0.686 n=6
Check Time 17.78s (± 0.46%) 17.78s (± 0.45%) ~ 17.64s 17.85s p=0.748 n=6
Emit Time 1.37s (± 2.06%) 1.39s (± 1.82%) ~ 1.35s 1.42s p=0.255 n=6
Total Time 23.78s (± 0.42%) 23.81s (± 0.44%) ~ 23.65s 23.96s p=0.630 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,565 ~ ~ ~ p=1.000 n=6
Types 93,734 93,734 ~ ~ ~ p=1.000 n=6
Memory used 369,417k (± 0.01%) 369,507k (± 0.03%) ~ 369,352k 369,718k p=0.093 n=6
Parse Time 3.43s (± 0.84%) 3.46s (± 0.28%) ~ 3.44s 3.47s p=0.086 n=6
Bind Time 1.95s (± 0.84%) 1.94s (± 0.96%) ~ 1.92s 1.97s p=0.806 n=6
Check Time 19.13s (± 0.45%) 19.11s (± 0.34%) ~ 19.01s 19.21s p=0.686 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.51s (± 0.29%) 24.51s (± 0.27%) ~ 24.40s 24.61s p=1.000 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,881,942 2,881,942 ~ ~ ~ p=1.000 n=6
Types 975,887 975,887 ~ ~ ~ p=1.000 n=6
Memory used 3,043,249k (± 0.00%) 3,043,285k (± 0.00%) ~ 3,043,231k 3,043,334k p=0.093 n=6
Parse Time 13.53s (± 0.45%) 13.52s (± 0.41%) ~ 13.46s 13.62s p=1.000 n=6
Bind Time 4.19s (± 0.30%) 4.20s (± 0.75%) ~ 4.16s 4.24s p=1.000 n=6
Check Time 73.44s (± 0.30%) 73.70s (± 0.92%) ~ 73.13s 75.02s p=0.688 n=6
Emit Time 24.06s (± 0.59%) 23.70s (± 3.18%) ~ 22.19s 24.24s p=0.336 n=6
Total Time 115.21s (± 0.29%) 115.12s (± 0.25%) ~ 114.74s 115.42s p=0.575 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,117 267,117 ~ ~ ~ p=1.000 n=6
Types 108,775 108,775 ~ ~ ~ p=1.000 n=6
Memory used 411,546k (± 0.01%) 411,579k (± 0.03%) ~ 411,431k 411,757k p=0.810 n=6
Parse Time 3.80s (± 0.17%) 3.83s (± 0.54%) +0.03s (+ 0.66%) 3.80s 3.86s p=0.020 n=6
Bind Time 1.69s (± 0.48%) 1.68s (± 0.32%) ~ 1.68s 1.69s p=0.859 n=6
Check Time 16.67s (± 0.38%) 16.72s (± 0.29%) ~ 16.63s 16.76s p=0.092 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.16s (± 0.26%) 22.23s (± 0.25%) ~ 22.15s 22.31s p=0.092 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 525,251 525,251 ~ ~ ~ p=1.000 n=6
Types 178,574 178,574 ~ ~ ~ p=1.000 n=6
Memory used 462,881k (± 0.06%) 462,833k (± 0.08%) ~ 462,316k 463,215k p=0.936 n=6
Parse Time 3.17s (± 0.92%) 3.18s (± 0.48%) ~ 3.16s 3.20s p=0.870 n=6
Bind Time 1.17s 1.17s (± 0.35%) ~ 1.16s 1.17s p=0.405 n=6
Check Time 17.95s (± 0.28%) 17.95s (± 0.21%) ~ 17.89s 17.99s p=1.000 n=6
Emit Time 0.00s (±244.70%) 0.00s ~ ~ ~ p=0.405 n=6
Total Time 22.29s (± 0.29%) 22.29s (± 0.19%) ~ 22.22s 22.33s p=0.688 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/59003/merge:

Everything looks good!


switch (condExpr.kind) {
case SyntaxKind.RegularExpressionLiteral:
case SyntaxKind.FunctionExpression:
Copy link
Contributor

Choose a reason for hiding this comment

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

Aware this is still a draft, but function expressions will almost certainly be a mistyped IIFE, so it might be helpful to separate out a specific error message for these – maybe some sort of "Did you mean to call..." message, à la 2774?

@DanielRosenwasser
Copy link
Member

Does this test for the negated forms too?

@RyanCavanaugh
Copy link
Member Author

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 25, 2024

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

Command Status Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 25, 2024

Hey @RyanCavanaugh, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/162408/artifacts?artifactName=tgz&fileId=B37B5F6DBD93FEDAE75AC76669049CB7917F87246C2464F52B776733B97BE4DB02&fileName=/typescript-5.6.0-insiders.20240625.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@RyanCavanaugh
Copy link
Member Author

!expr isn't considered a truthiness position today. Maybe for this check in particular it would make sense to generalize it to all boolean coercions

@RyanCavanaugh
Copy link
Member Author

Gonna find all the bad code now, I think

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 25, 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

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

There were interesting changes:

Branch only errors:

Package: ember/v2
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/ember/v2/test/component.ts
  105:13  error  TypeScript@local compile error: 
Truthiness test of this kind of expression appears unintentional  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: ember/v3
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/ember/v3/test/component.ts
  105:13  error  TypeScript@local compile error: 
Truthiness test of this kind of expression appears unintentional  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: react-native-joi
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/react-native-joi/react-native-joi-tests.ts
  53:25  error  TypeScript@local compile error: 
Truthiness test of this kind of expression appears unintentional  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: ember
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/ember/test/component.ts
  105:13  error  TypeScript@local compile error: 
Truthiness test of this kind of expression appears unintentional  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: ember__component
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/ember__component/test/component.ts
  104:13  error  TypeScript@local compile error: 
Truthiness test of this kind of expression appears unintentional  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: hapi__joi
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/hapi__joi/hapi__joi-tests.ts
  52:25  error  TypeScript@local compile error: 
Truthiness test of this kind of expression appears unintentional  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: karma-browserstack-launcher
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/karma-browserstack-launcher/karma-browserstack-launcher-tests.ts
   9:23  error  TypeScript@local compile error: 
Truthiness test of this kind of expression appears unintentional  @definitelytyped/expect
  10:24  error  TypeScript@local compile error: 
Truthiness test of this kind of expression appears unintentional  @definitelytyped/expect

✖ 2 problems (2 errors, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: rsvp
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/rsvp/rsvp-tests.ts
  104:13  error  TypeScript@local compile error: 
Truthiness test of this kind of expression appears unintentional  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: ember__component/v3
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/ember__component/v3/test/component.ts
  104:13  error  TypeScript@local compile error: 
Truthiness test of this kind of expression appears unintentional  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

You can check the log here.

@typescript-bot
Copy link
Collaborator

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

Something interesting changed - please have a look.

Details

webpack

tsconfig.types.json

  • [NEW] error TS2869: Truthiness test of this kind of expression appears unintentional

@typescript-bot
Copy link
Collaborator

@RyanCavanaugh
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 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,242 ~ ~ ~ p=1.000 n=6
Memory used 193,378k (± 0.98%) 194,071k (± 0.95%) ~ 192,175k 195,787k p=0.378 n=6
Parse Time 1.58s (± 0.62%) 1.57s (± 1.02%) ~ 1.56s 1.60s p=0.310 n=6
Bind Time 0.85s (± 0.96%) 0.86s (± 1.36%) ~ 0.84s 0.87s p=0.401 n=6
Check Time 11.20s (± 0.35%) 11.20s (± 0.33%) ~ 11.13s 11.23s p=0.806 n=6
Emit Time 3.28s (± 0.31%) 3.28s (± 0.50%) ~ 3.25s 3.29s p=0.869 n=6
Total Time 16.91s (± 0.26%) 16.91s (± 0.15%) ~ 16.87s 16.94s p=0.870 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,114 944,114 ~ ~ ~ p=1.000 n=6
Types 407,050 407,050 ~ ~ ~ p=1.000 n=6
Memory used 1,218,307k (± 0.00%) 1,218,331k (± 0.00%) ~ 1,218,309k 1,218,352k p=0.093 n=6
Parse Time 7.95s (± 0.32%) 7.96s (± 0.67%) ~ 7.90s 8.05s p=0.742 n=6
Bind Time 2.23s (± 0.52%) 2.23s (± 0.47%) ~ 2.21s 2.24s p=0.800 n=6
Check Time 35.69s (± 0.21%) 35.86s (± 0.51%) ~ 35.56s 36.04s p=0.109 n=6
Emit Time 16.10s (± 0.76%) 16.17s (± 0.46%) ~ 16.07s 16.24s p=0.336 n=6
Total Time 61.97s (± 0.17%) 62.21s (± 0.23%) +0.23s (+ 0.38%) 62.04s 62.42s p=0.016 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,135,096 2,135,096 ~ ~ ~ p=1.000 n=6
Types 927,168 927,168 ~ ~ ~ p=1.000 n=6
Memory used 2,117,319k (± 0.01%) 2,117,382k (± 0.01%) ~ 2,117,152k 2,117,562k p=0.575 n=6
Parse Time 7.91s (± 0.23%) 7.90s (± 0.51%) ~ 7.84s 7.94s p=1.000 n=6
Bind Time 2.77s (± 0.66%) 2.76s (± 0.88%) ~ 2.73s 2.79s p=0.328 n=6
Check Time 83.88s (± 0.33%) 84.05s (± 0.55%) ~ 83.47s 84.84s p=0.575 n=6
Emit Time 0.16s (± 4.75%) 0.16s (± 3.29%) ~ 0.15s 0.16s p=0.784 n=6
Total Time 94.72s (± 0.30%) 94.86s (± 0.48%) ~ 94.27s 95.59s p=0.689 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,231,459 1,231,472 +13 (+ 0.00%) ~ ~ p=0.001 n=6
Types 261,178 261,183 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,348,154k (± 0.01%) 2,348,799k (± 0.04%) ~ 2,347,854k 2,350,165k p=0.173 n=6
Parse Time 7.48s (± 0.52%) 7.47s (± 0.65%) ~ 7.39s 7.52s p=0.873 n=6
Bind Time 2.82s (± 0.47%) 2.85s (± 1.32%) ~ 2.79s 2.89s p=0.173 n=6
Check Time 49.57s (± 0.15%) 49.61s (± 0.13%) ~ 49.54s 49.71s p=0.423 n=6
Emit Time 3.90s (± 2.35%) 3.90s (± 3.24%) ~ 3.74s 4.09s p=1.000 n=6
Total Time 63.76s (± 0.20%) 63.86s (± 0.26%) ~ 63.67s 64.05s p=0.378 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,231,459 1,231,472 +13 (+ 0.00%) ~ ~ p=0.001 n=6
Types 261,178 261,183 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,424,447k (± 0.03%) 2,424,545k (± 0.04%) ~ 2,423,403k 2,426,137k p=1.000 n=6
Parse Time 7.74s (± 0.76%) 7.72s (± 0.91%) ~ 7.66s 7.85s p=0.688 n=6
Bind Time 2.52s (± 0.85%) 2.53s (± 1.29%) ~ 2.50s 2.59s p=0.747 n=6
Check Time 50.03s (± 0.29%) 50.07s (± 0.30%) ~ 49.82s 50.26s p=0.689 n=6
Emit Time 3.92s (± 1.09%) 3.95s (± 2.31%) ~ 3.87s 4.10s p=0.810 n=6
Total Time 64.24s (± 0.20%) 64.31s (± 0.38%) ~ 63.93s 64.53s p=0.575 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,577 258,579 +2 (+ 0.00%) ~ ~ p=0.001 n=6
Types 104,827 104,831 +4 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 428,198k (± 0.01%) 428,252k (± 0.01%) +54k (+ 0.01%) 428,201k 428,331k p=0.045 n=6
Parse Time 3.31s (± 0.52%) 3.32s (± 0.94%) ~ 3.28s 3.36s p=0.295 n=6
Bind Time 1.32s (± 0.91%) 1.31s (± 1.31%) ~ 1.29s 1.34s p=0.219 n=6
Check Time 17.80s (± 0.59%) 17.77s (± 0.31%) ~ 17.71s 17.85s p=0.630 n=6
Emit Time 1.38s (± 0.76%) 1.37s (± 0.75%) ~ 1.36s 1.39s p=0.801 n=6
Total Time 23.81s (± 0.43%) 23.78s (± 0.35%) ~ 23.70s 23.90s p=0.574 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,565 ~ ~ ~ p=1.000 n=6
Types 93,734 93,734 ~ ~ ~ p=1.000 n=6
Memory used 369,487k (± 0.02%) 369,477k (± 0.03%) ~ 369,362k 369,665k p=0.575 n=6
Parse Time 2.76s (± 1.32%) 2.77s (± 1.27%) ~ 2.72s 2.81s p=1.000 n=6
Bind Time 1.59s (± 0.79%) 1.59s (± 1.49%) ~ 1.57s 1.62s p=0.677 n=6
Check Time 15.50s (± 0.47%) 15.52s (± 0.27%) ~ 15.47s 15.57s p=0.628 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 19.85s (± 0.45%) 19.87s (± 0.23%) ~ 19.81s 19.93s p=0.688 n=6
vscode - node (v18.15.0, x64)
Errors 0 6 🔻+6 (+ ∞%) ~ ~ p=0.001 n=6
Symbols 2,878,705 2,878,705 ~ ~ ~ p=1.000 n=6
Types 975,213 975,213 ~ ~ ~ p=1.000 n=6
Memory used 3,042,026k (± 0.00%) 3,042,085k (± 0.00%) +59k (+ 0.00%) 3,042,034k 3,042,154k p=0.013 n=6
Parse Time 16.65s (± 0.30%) 16.68s (± 0.43%) ~ 16.60s 16.76s p=0.628 n=6
Bind Time 5.10s (± 0.33%) 5.10s (± 0.40%) ~ 5.07s 5.13s p=0.669 n=6
Check Time 88.89s (± 0.26%) 90.16s (± 2.16%) +1.27s (+ 1.43%) 88.58s 94.04s p=0.045 n=6
Emit Time 29.22s (± 0.34%) 28.43s (± 6.31%) ~ 24.77s 29.35s p=0.230 n=6
Total Time 139.87s (± 0.13%) 140.37s (± 0.37%) ~ 139.44s 140.96s p=0.066 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,117 267,117 ~ ~ ~ p=1.000 n=6
Types 108,775 108,775 ~ ~ ~ p=1.000 n=6
Memory used 411,583k (± 0.02%) 411,533k (± 0.01%) ~ 411,481k 411,605k p=0.378 n=6
Parse Time 3.18s (± 0.16%) 3.17s (± 0.47%) ~ 3.15s 3.19s p=0.672 n=6
Bind Time 1.41s 1.41s (± 0.97%) ~ 1.39s 1.43s p=0.293 n=6
Check Time 14.19s (± 0.13%) 14.18s (± 0.28%) ~ 14.12s 14.23s p=0.678 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 18.78s (± 0.10%) 18.77s (± 0.18%) ~ 18.72s 18.81s p=0.742 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 525,251 525,251 ~ ~ ~ p=1.000 n=6
Types 178,574 178,574 ~ ~ ~ p=1.000 n=6
Memory used 462,629k (± 0.06%) 462,826k (± 0.08%) ~ 462,381k 463,157k p=0.298 n=6
Parse Time 3.19s (± 0.32%) 3.18s (± 0.24%) ~ 3.17s 3.19s p=0.179 n=6
Bind Time 1.17s (± 1.04%) 1.17s (± 0.47%) ~ 1.16s 1.17s p=0.855 n=6
Check Time 17.92s (± 0.22%) 17.89s (± 0.44%) ~ 17.80s 18.03s p=0.335 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.27s (± 0.16%) 22.24s (± 0.34%) ~ 22.15s 22.37s p=0.228 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

@jakebailey
Copy link
Member

6 new errors in vscode based on the benchmarks; it's confusing why the user tests did not say anything there, but maybe top400 will say something.

@jakebailey
Copy link
Member

Tested manually:

src/vs/base/common/path.ts:335:4 - error TS2869: Truthiness test of this kind of expression appears unintentional

335    `${resolvedDevice}${resolvedTail}` || '.';
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/vs/editor/standalone/test/browser/monarch.test.ts:236:24 - error TS2869: Truthiness test of this kind of expression appears unintentional

236    uselessReplaceKey5: '@ham' || '',
                           ~~~~~~

src/vs/platform/files/test/browser/indexedDBFileService.integrationTest.ts:192:16 - error TS2869: Truthiness test of this kind of expression appears unintentional

192     assert.ok(!'Unexpected value ' + basename(value.resource));
                   ~~~~~~~~~~~~~~~~~~~

src/vs/platform/files/test/node/diskFileService.integrationTest.ts:276:16 - error TS2869: Truthiness test of this kind of expression appears unintentional

276     assert.ok(!'Unexpected value ' + basename(value.resource.fsPath));
                   ~~~~~~~~~~~~~~~~~~~

src/vs/platform/files/test/node/diskFileService.integrationTest.ts:320:16 - error TS2869: Truthiness test of this kind of expression appears unintentional

320     assert.ok(!'Unexpected value ' + basename(value.resource.fsPath));
                   ~~~~~~~~~~~~~~~~~~~

src/vs/workbench/contrib/terminal/browser/terminalInstance.ts:1615:14 - error TS2869: Truthiness test of this kind of expression appears unintentional

1615    tooltip: (`${exitMessage} ` ?? '') + nls.localize('launchFailed.exitCodeOnlyShellIntegration', 'Disabling shell integration in user settings might help.'),
                  ~~~~~~~~~~~~~~~~~


Found 6 errors in 5 files.

Errors  Files
     1  src/vs/base/common/path.ts:335
     1  src/vs/editor/standalone/test/browser/monarch.test.ts:236
     1  src/vs/platform/files/test/browser/indexedDBFileService.integrationTest.ts:192
     2  src/vs/platform/files/test/node/diskFileService.integrationTest.ts:276
     1  src/vs/workbench/contrib/terminal/browser/terminalInstance.ts:1615

@typescript-bot
Copy link
Collaborator

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

Something interesting changed - please have a look.

Details

ajv-validator/ajv

1 of 2 projects failed to build with the old tsc and were ignored

tsconfig.json

ChatGPTNextWeb/ChatGPT-Next-Web

tsconfig.json

clash-verge-rev/clash-verge-rev

tsconfig.json

facebook/lexical

5 of 12 projects failed to build with the old tsc and were ignored

tsconfig.json

tsconfig.build.json

labring/FastGPT

1 of 8 projects failed to build with the old tsc and were ignored

projects/app/tsconfig.json

microsoft/vscode

4 of 54 projects failed to build with the old tsc and were ignored

src/tsconfig.tsec.json

src/tsconfig.monaco.json

src/tsconfig.json

supabase/supabase

31 of 37 projects failed to build with the old tsc and were ignored

apps/studio/tsconfig.json

@RyanCavanaugh
Copy link
Member Author

Collated breaks

Clearly intentional, albeit weird:

  optimizeNodes(): this | undefined {
    return `${this.code}` ? this : undefined
  }

Very good find -- catching an operator precedence bug. The checking to allow e.g. while (0) means this isn't found for the common case of a > b ?? 0; I'll put up a second PR

if (historyMsgLength > modelConfig?.max_tokens ?? 4000) 

Good find, maybe someone thought {...null} was null (it isn't)? Two instances of this in the same project

 setTheme({ ...theme_setting } || {});

 {...prevStyles} || {}

Very good find: This project idiomatically does t("some str") || "fallback" but misplaced the parens in two places:

<QuestionTip ml={1} label={publishT('QPM Tips' || '')}></QuestionTip>
// and
              label={t('support.outlink.share.Response Quote tips' || '')}

??. Asked about it

        <Image
          src={`https://github.com/${profile?.username}.png` || ''}

??. Asked about it.

    {
      layout: 'vertical' || 'flex',
      labelLayout: undefined,
      flex: false,
      className: 'flex flex-row gap-2 justify-between',
    },

@DanielRosenwasser
Copy link
Member

For `${this.code}` ? this : undefined`, you can just check if any TemplateExpression has a non-empty literal span.

@fatcerberus
Copy link

The webpack one above looks like a bona fide bug:

if (typeof value === "string" && /^[+-]?\d*(\.\d*)[eE]\d+$/)

This was almost certainly meant to actually run that regex on something.

@jakebailey
Copy link
Member

Yep, though given the full code is:

		case "number":
			if (typeof value === "number") return value;
			if (typeof value === "string" && /^[+-]?\d*(\.\d*)[eE]\d+$/) {
				const n = +value;
				if (!isNaN(n)) return n;
			}

I would personally just remove the regex altogether; after all, this block says a number is being parsed, and there's already a saving isNaN that made this code not broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants