-
Notifications
You must be signed in to change notification settings - Fork 226
Open
Labels
bugSomething isn't workingSomething isn't workingdiagnosticsRelated to reporting of diagnostics.Related to reporting of diagnostics.
Milestone
Description
Summary
Given the following example:
from typing import Callable
def fn(a: int) -> None: ...
def foo[**P, T](fn: Callable[P, T], *args: P.args, **kwargs: P.kwargs): ...
foo(fn, a="a")The diagnostic is using the location for fn for highlighting on foo:
❯ ty check .
error[invalid-argument-type]: Argument to function `foo` is incorrect
--> main.py:10:5
|
10 | foo(fn, a="a")
| ^^ Expected `int`, found `Literal["a"]`
|
info: Function defined here
--> main.py:7:5
|
7 | def foo[**P, T](fn: Callable[P, T], *args: P.args, **kwargs: P.kwargs): ...
| ^^^ ------------------ Parameter declared here
|
info: rule `invalid-argument-type` is enabled by default
Found 1 diagnostic- The "Expected
..., found..." should be on"a" - It should use the
fnfunction directly for the info diagnostic of "Function defined here" - And, provide a sub-diagnostic / info to state that this function comes from the argument being matched against a
ParamSpectype variable which resolved to this function
Version
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdiagnosticsRelated to reporting of diagnostics.Related to reporting of diagnostics.