getComputedType: route all declaration-name ranges through the binding path (#4091)#4091
getComputedType: route all declaration-name ranges through the binding path (#4091)#4091kinto0 wants to merge 2 commits into
Conversation
|
@kinto0 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D111155589. |
stroxler
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
| } | ||
|
|
||
| // ======================================================================= | ||
| // getComputedType range routing: an identifier-name range resolves through |
There was a problem hiding this comment.
This range-routing section covers def/class/param/typevar/import/except/global/match, but not a keyword-argument label range — which is the one case whose routing actually changed in this PR. Previously the ExprName-only guard in get_computed_type_at_range sent the x range in f(x=1) to the trace path; now classify_surface maps KeywordArgument to a Key (the matched parameter's declaration), so it routes through the declaration-preserving path instead (or NoType → trace when no parameter matches).
Since that behavior change isn't pinned by any test, could we add one here? Something like def f(x: int): ... then f(x=1), asserting the x= label range resolves to the parameter's type — plus a no-match case (e.g. f(y=1)) that should still fall back to the trace path.
Summary: See last diff for context. reproduces facebook#4042 with more examples Reviewed By: maggiemoss Differential Revision: D111155587
…g path (facebook#4091) Summary: fix facebook#4042 by using the classifications in classify_surface Reviewed By: stroxler Differential Revision: D111155589
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
This pull request has been merged in 7e636d1. |
Summary:
fix #4042
by using the classifications in classify_surface
Reviewed By: stroxler
Differential Revision: D111155589