Closed Ailitonia closed 1 month ago
Thanks for the bug report. I'm surprised this bug hasn't been reported previously. It will be fixed in the next release of pyright.
This issue has been fixed in prerelease version 2024.9.101, which we've just released. You can find the changelog here: CHANGELOG.md
Environment data
Code Snippet
Repro Steps
Expected behavior
The
int_or_str
variables in lines 33 and 40 both should be recognized asstr
typeActual behavior
The
int_or_str
variables in line 40 still be recognized asint | str
typeLogs
Logs
```log 2024-09-15 13:01:19.022 [info] (Client) Pylance async client (2024.9.1) started with python extension (2024.14.1) 2024-09-15 13:01:33.035 [info] (12492) [BG(1)] SemanticTokens full at file:///c%3A/Users/Ailit/Documents/GitHub/omega-miya/foo_decorator.py (0ms) 2024-09-15 13:01:33.272 [info] (12492) [BG(1)] indexing: file:///c%3A/Users/Ailit/Documents/GitHub/omega-miya/foo_decorator.py [found 6] (0ms) 2024-09-15 13:01:33.272 [info] (12492) Indexing Done: file:///c%3A/Users/Ailit/Documents/GitHub/omega-miya/foo_decorator.py 2024-09-15 13:01:33.272 [info] [Info - 13:01:33] (12492) Heap stats: total_memory_size=65345MB, total_free_size=51697MB, total_heap_size=121MB, used_heap_size=100MB, cross_worker_used_heap_size=100MB, total_physical_size=121MB, total_available_size=3992MB, heap_size_limit=4096MB 2024-09-15 13:01:33.294 [info] (12492) [BG(1)] InlayHints range 0:0 - 40:0 at file:///c%3A/Users/Ailit/Documents/GitHub/omega-miya/foo_decorator.py (0ms) 2024-09-15 13:01:33.775 [info] (12492) [BG(1)] InlayHints range 0:0 - 40:0 at file:///c%3A/Users/Ailit/Documents/GitHub/omega-miya/foo_decorator.py (0ms) 2024-09-15 13:01:33.842 [info] (12492) [BG(1)] InlayHints range 0:0 - 40:0 at file:///c%3A/Users/Ailit/Documents/GitHub/omega-miya/foo_decorator.py (0ms) 2024-09-15 13:01:36.728 [info] (12492) [BG(1)] InlayHints range 0:0 - 40:0 at file:///c%3A/Users/Ailit/Documents/GitHub/omega-miya/foo_decorator.py (0ms) 2024-09-15 13:01:38.547 [info] (12492) [BG(1)] InlayHints range 0:0 - 40:0 at file:///c%3A/Users/Ailit/Documents/GitHub/omega-miya/foo_decorator.py (1ms) 2024-09-15 13:01:39.026 [info] (12492) [BG(1)] InlayHints range 0:0 - 40:0 at file:///c%3A/Users/Ailit/Documents/GitHub/omega-miya/foo_decorator.py (0ms) 2024-09-15 13:01:39.303 [info] (12492) [BG(1)] InlayHints range 0:0 - 40:0 at file:///c%3A/Users/Ailit/Documents/GitHub/omega-miya/foo_decorator.py (0ms) 2024-09-15 13:01:39.369 [info] (12492) [BG(1)] InlayHints range 0:0 - 40:0 at file:///c%3A/Users/Ailit/Documents/GitHub/omega-miya/foo_decorator.py (0ms) ```