Commit b769b67
Simplify cast unwrapping in comparisons to always unwrap
The previous approach only unwrapped cast expressions when the cast
type equaled the inner type (redundant cast). This failed for cases
where the variable had a union type with non-integer parts (e.g.
int|numeric-string after ctype_digit), because the cast was not
redundant and the narrowing was never applied.
The narrowing type (e.g. mixed~(0.0|int<min, 2021>|false|null))
already correctly preserves non-integer parts of the type through
intersection, so unconditional unwrapping produces correct results
for all cases.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent d60cc3d commit b769b67
1 file changed
Lines changed: 2 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
| 497 | + | |
502 | 498 | | |
503 | 499 | | |
504 | 500 | | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
| 501 | + | |
510 | 502 | | |
511 | 503 | | |
512 | 504 | | |
| |||
0 commit comments