Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix crash when annotating callable definition location #3375
I have no idea how to add test case for this.
[case testUnexpectedKwargsDefinedHere] import m m.A(x=1) # E: Unexpected keyword argument "x" for "A" [file m.py] class A: def __init__(self) -> None: # N: "A" defined here pass
doesn't trigger note, because
if not defn._fullname: defn._fullname = self.qualified_name(defn.name())
(also works with your test example above).
I just received a spurious message of the form
The code to issue this message was modified by this PR.
I have not been able to repro this "in the lab" yet (the above was part of a huge run on internal code), but I suspect that this might be related to an error in another file that was ignored by
I would propose an alternative solution. We could report the note on the same line as error, but report the source in the note itself, something like:
(TBH, this wording also seems nicer to me than the current one.)