You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the match statement, the variable operation is correctly identified as (variable) operation: Literal['', 'ADD', 'SUBTRACT', 'MULTIPLY', 'DIVIDE']. So why is pylance reporting the following in the case _: case statement:
_: Unknown
Type captured by wildcard pattern is partially unknown
Type of "_" is "Unknown | Literal['']"
My expectation is that no error should be reported.
Please note that I am not implying that the code snippet shown above makes very much sense. The for loop is unnecessary; however, I found that it's the loop that creates this unwanted behavior in the case _: statement. The code snippet is just a minimal working example that showcases the issue that I have in a real-world piece of code.
Environment data
Code Snippet
In the match statement, the variable
operation
is correctly identified as(variable) operation: Literal['', 'ADD', 'SUBTRACT', 'MULTIPLY', 'DIVIDE']
. So why is pylance reporting the following in thecase _:
case statement:My expectation is that no error should be reported.
Please note that I am not implying that the code snippet shown above makes very much sense. The for loop is unnecessary; however, I found that it's the loop that creates this unwanted behavior in the
case _:
statement. The code snippet is just a minimal working example that showcases the issue that I have in a real-world piece of code.Logs
Attached.
log.txt
The text was updated successfully, but these errors were encountered: