Commit e567467
Fix false positive error on isinstance with
Summary:
When `isinstance(x, type | int)` was used, pyrefly incorrectly reported
an error because the `type` metatype gets canonicalized to
`Type::Type(Any)` inside the union. The `as_class_info` function then
double-wrapped it with `mk_type_form`, producing `Type::Type(Type::Type(Any))`
which `unwrap_class_object_silently` could not handle.
Fix: in `as_class_info`, skip wrapping union members that are already
`Type::Type(...)` to avoid double-wrapping.
fixes #2871
Reviewed By: rchen152
Differential Revision: D98300571
fbshipit-source-id: ae264bdd9a5518baa62cb754ea1646e587b6ab4btype | T
1 parent a2aed80 commit e567467
2 files changed
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
153 | 158 | | |
154 | 159 | | |
155 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
727 | 727 | | |
728 | 728 | | |
729 | 729 | | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
730 | 749 | | |
731 | 750 | | |
732 | 751 | | |
| |||
0 commit comments