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
Expected Behavior
Correctly infer that T=str
No errors
Actual Behavior
Inferred T = nothing
Argument 1 to "sirRobin" of "Baz" has incompatible type "Bar"; expected "Foo[]" [arg-type]
Argument 2 to "sirRobin" of "Baz" has incompatible type "str"; expected < nothing > [arg-type]
Your Environment
Mypy version used: latest
Mypy command-line flags:
Mypy configuration options from mypy.ini (and other config files):
Bug Report
I created a generic class (Baz) which except an instance with a generic interface (Foo), and manipulates it.
I made a non-generic class (Bar), subclassing the interface with a concrete type (str).
Inside the class the types work, but when I use the non-generic class with the manipulator class, I have type errors.
I expected mypy to infer the concretization of the generic type from the usage.
I have confirmation that my typing is indeed correct: https://stackoverflow.com/questions/75568405/typing-of-using-a-subclass-of-a-generic-class?noredirect=1#comment133323604_75568405
To Reproduce
Playground url: https://mypy-play.net/?mypy=latest&python=3.11&gist=7bdb14547c7d7ea11185c02e6267c016
Expected Behavior
Correctly infer that T=str
No errors
Actual Behavior
Inferred T = nothing
Argument 1 to "sirRobin" of "Baz" has incompatible type "Bar"; expected "Foo[]" [arg-type]
Argument 2 to "sirRobin" of "Baz" has incompatible type "str"; expected < nothing > [arg-type]
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: