-
-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
# pants: no-infer-dep
not always respected by the 2.17 Rust parser
#19751
Comments
This change is split out of #19751 Specifically the goal would be to use a different resolve for the plugins so that we model "external plugins" correctly in the Pants repo (which we should be doing anyways)
Thanks for taking the time to file an issue. As an additional work around that you may be aware of, you can continue using the non-Rust parser, i.e. set |
OK, oddly adding assert_imports(
r"
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from a import ClassA # pants: no-infer-dep
print('Hello, world!')",
&["typing.TYPE_CHECKING"],
); to |
Oh, but I'm on if I checkout 2.17.x it fails. So I think #19293 fixed this. I'll get it cherry picked backwards. Kudos @lilatomic |
#19293) (#19788) fixes #17691 and fixes #19751 also: - fixes the case of nested weakenings - bumps tree-sitter-python to an unreleased version (last release was a year ago) - rebuilds the generation of tree-sitter node types to support multiple symbols for a name Co-authored-by: Daniel Goldman <[email protected]> Co-authored-by: Huon Wilson <[email protected]>
#19293) (#19789) fixes #17691 and fixes #19751 also: - fixes the case of nested weakenings - bumps tree-sitter-python to an unreleased version (last release was a year ago) - rebuilds the generation of tree-sitter node types to support multiple symbols for a name --------- Co-authored-by: Daniel Goldman <[email protected]>
…-pick of #19804) (#19807) This closes #19751 by adding some tests for it. We're pretty sure the real fix was in #19293, but only incidentally, so this PR makes sure we've got a regression test specifically for #19751. I've marked the test for cherrypicking so that we confirm that this is fixed in the earlier releases too. Co-authored-by: Huon Wilson <[email protected]>
…-pick of #19804) (#19808) This closes #19751 by adding some tests for it. We're pretty sure the real fix was in #19293, but only incidentally, so this PR makes sure we've got a regression test specifically for #19751. I've marked the test for cherrypicking so that we confirm that this is fixed in the earlier releases too. Co-authored-by: Huon Wilson <[email protected]>
I'm not sure what part of #19293 fixes this. I think it might be the newer version of the tree-sitter grammar. |
Describe the bug
The new Rust inference parser disrespects a
# pants: no-infer-dep
on a conditional import:Dependencies' diff below:
Note and workarounds
This seems to break only when
# pants: no-infer-dep
is on the last line inside theif
block:pass
statement at the end of theif TYPE_CHECKING
block also results in a correct behaviorPants version
2.17.0
OS
Both: MacOS and Linux
Additional info
Minimalist setup to reproduce
main.py
a.py
pants.toml
BUILD
The text was updated successfully, but these errors were encountered: