Fix decorator import resolution without source#1273
Open
gojun077 wants to merge 1 commit into
Open
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-019ed3c3-1f34-7278-87d8-1b741154a281 Co-authored-by: Amp <amp@ampcode.com>
|
@gojun077 is attempting to deploy a commit to the shashankss1205's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves [1272(https://github.com//issues/1272)
Root cause:
build_decorated_by_links()assumed every parsed import had a source field. Python parser imports usefull_import_name instead, so an imported decorator like@dataclassproducedlocal_imports["dataclass"] = None, then crashed atNone.split(".")What changed:
Added shared import normalization for decorator/metaclass resolution in
CodeGraphContext/src/codegraphcontext/tools/indexing/resolution/inheritance.py#L311-L342sourcewhen present.full_import_name.name.Reused that normalization for both
DECORATED_BYand PythonMETACLASSlink building inCodeGraphContext/src/codegraphcontext/tools/indexing/resolution/inheritance.py#L353-L413.Added a regression test for Python imports without source in
CodeGraphContext/tests/unit/tools/test_cross_lang_call_resolution_patterns.py#L681-L723Amp-Thread-ID: https://ampcode.com/threads/T-019ed3c3-1f34-7278-87d8-1b741154a281