Short-circuit isTypeVarSame subtype checks - #11681
Short-circuit isTypeVarSame subtype checks#11681Bill Schnurr (bschnurr) wants to merge 1 commit into
Conversation
|
/benchmark |
|
🔒 Automated review in progress — Rich Chiodo (@rchiodo) is auto-reviewing this PR. |
This comment has been minimized.
This comment has been minimized.
|
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified. |
Rich Chiodo (rchiodo)
left a comment
There was a problem hiding this comment.
Approved via Review Center.
This comment has been minimized.
This comment has been minimized.
72e74f2 to
2901d5f
Compare
|
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified. |
This comment has been minimized.
This comment has been minimized.
2901d5f to
ce7460c
Compare
|
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified. |
This comment has been minimized.
This comment has been minimized.
|
/benchmark |
Fix allSubtypes callback handling and delegate union traversal directly to Array.every. Use it in isTypeVarSame to stop the subtype scan at the first incompatibility instead of invoking no-op callbacks for the remainder. Add direct allSubtypes and someSubtypes coverage.
ce7460c to
c49ce2f
Compare
|
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified. Result: Summary: Verification could not run because no trusted `microsoft/pyright` sandbox image was configured and local execution was unauthorized. The PR adds focused coverage for union short-circuiting and non-union callbacks in `allSubtypes` and `someSubtypes`. No meaningful test execution occurred, so the verdict is **could-not-verify**. Test runs: 1 not run
|
This comment has been minimized.
This comment has been minimized.
|
/benchmark |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
/benchmark |
Type checker benchmark🟢 No performance regressions detected. Regression threshold:
Pyright stats
|
✅ Pyright CLI QA —
|
Summary
allSubtypesso union checks return callback results.Array.everyfor allocation-free early termination.allSubtypesinisTypeVarSameto stop at the first incompatible subtype instead of walking the remaining union entries with no-op callbacks.someSubtypesand adds direct unit coverage for both helpers.This is the safe
typeUtilsportion split from #11419. It intentionally excludes the literal, tuple,derivesFromAnyOrUnknown, and NoReturn early exits that produced mypy_primer differences.Validation
pnpm exec jest typeUtils.test --forceExitpnpm run buildpnpm run check:prettierpnpm run check:eslint