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
Here's what's happening here. When you declare a class called arg, you're telling the type checker that the type of the symbol arg is a class. You're later trying to assign that same symbol a value that is not a class, so it's a type violation. The type checker would normally report this as an error, but by default Pylance has typeCheckingMode set to 'off', so that error is suppressed. Because it's suppressed, subsequent errors based on this type assumption don't make sense.
I think the correct fix here is to allow assignments to override the declared type of a symbol if typeCheckingMode is 'off'. In your case, it would allow the arg symbol to take on the type of an instance even though it is declared as having a class type above.
This change will be in an upcoming version of Pylance.
hi,
following code:
produces errors in pylance:
Pylance do not see that class is instantiated. Changing class name to "Arg" solves the problems.
The text was updated successfully, but these errors were encountered: