-
-
Notifications
You must be signed in to change notification settings - Fork 5k
fix(python): resolve module-qualified constructor calls — 0 CALLS edges (Issue #337) #463
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
Changes from 1 commit
cd1c0ff
f90aabf
bbd9545
141f864
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -118,13 +118,14 @@ const WILDCARD_IMPORT_LANGUAGES = new Set([ | |||||||||||||||||
| SupportedLanguages.C, | ||||||||||||||||||
| SupportedLanguages.CPlusPlus, | ||||||||||||||||||
| SupportedLanguages.Swift, | ||||||||||||||||||
| SupportedLanguages.Python, // `import models` imports all exported symbols from modules | ||||||||||||||||||
| ]); | ||||||||||||||||||
|
|
||||||||||||||||||
| /** Synthesize namedImportMap entries for languages with whole-module imports. | ||||||||||||||||||
| * These languages (Go, Ruby, C/C++, Swift) import all exported symbols from a file, | ||||||||||||||||||
| * not specific named symbols. After parsing, we know which symbols each file exports | ||||||||||||||||||
| * (via graph isExported), so we can expand ImportMap edges into per-symbol bindings | ||||||||||||||||||
| * that Phase 14 can use for cross-file type propagation. */ | ||||||||||||||||||
| * These languages (Go, Ruby, C/C++, Swift, Python) import all exported symbols from a | ||||||||||||||||||
| * file, not specific named symbols. After parsing, we know which symbols each file | ||||||||||||||||||
| * exports (via graph isExported), so we can expand ImportMap edges into per-symbol | ||||||||||||||||||
| * bindings that Phase 14 can use for cross-file type propagation. */ | ||||||||||||||||||
| function synthesizeWildcardImportBindings( | ||||||||||||||||||
| graph: ReturnType<typeof createKnowledgeGraph>, | ||||||||||||||||||
| ctx: ReturnType<typeof createResolutionContext>, | ||||||||||||||||||
|
|
@@ -576,6 +577,12 @@ export const runPipelineFromRepo = async ( | |||||||||||||||||
| stats: { filesProcessed: filesParsedSoFar, totalFiles: totalParseable, nodesCreated: graph.nodeCount }, | ||||||||||||||||||
| }); | ||||||||||||||||||
| }, repoPath, importCtx); | ||||||||||||||||||
| // ── Wildcard-import synthesis (Python / Ruby / C/C++ / Swift / Go) ────────────── | ||||||||||||||||||
| // Synthesize namedImportMap entries for module-qualified calls like Python's | ||||||||||||||||||
| // `models.User()`. Must run after imports are resolved (importMap is populated) | ||||||||||||||||||
| // but BEFORE call resolution so Tier 2a-named can disambiguate `module.Name()`. | ||||||||||||||||||
| // Idempotent: first-seen semantics prevents double-counting across chunks. | ||||||||||||||||||
| synthesizeWildcardImportBindings(graph, ctx); | ||||||||||||||||||
|
||||||||||||||||||
| // Synthesize namedImportMap entries for module-qualified calls like Python's | |
| // `models.User()`. Must run after imports are resolved (importMap is populated) | |
| // but BEFORE call resolution so Tier 2a-named can disambiguate `module.Name()`. | |
| // Idempotent: first-seen semantics prevents double-counting across chunks. | |
| synthesizeWildcardImportBindings(graph, ctx); | |
| // NOTE: Per-chunk wildcard-import synthesis has been removed from the worker path | |
| // to avoid O(chunks × graph_size) behavior. A final/global synthesis pass should | |
| // run after all imports are resolved but before any global call resolution. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import models | ||
| import auth | ||
|
|
||
| u = models.User() | ||
| a = auth.Admin() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| class User: | ||
| def check(self): | ||
| pass | ||
|
|
||
| class Admin: | ||
| def login(self): | ||
| pass |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| class User: | ||
| def save(self): | ||
| pass |
Uh oh!
There was an error while loading. Please reload this page.