-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
Labels
questionAsking for support or clarificationAsking for support or clarification
Description
Summary
On the following code, ty correctly reports that the argument to function f is incorrect (playground):
class A: pass
B = A
def f(b: B): pass
f("") # Argument to function `f` is incorrect: Expected `A`, found `Literal[""]` (invalid-argument-type) [Ln 4, Col 3]When the last two lines are moved into a separate file, and B is imported, ty no longer detects the error (playground):
from main import B
def f(b: B): pass
f("")In the main file, the implicit type alias B is correctly inferred to be <class 'A'>. But when it's imported from another module, ty infers Unknown | <class 'A'>.
I'm not sure how broad the actual underlying issue is.
Version
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionAsking for support or clarificationAsking for support or clarification