feat: C++ ADL V2: free-function reference args contribute enclosing namespace#1598
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/24805583-c0c4-4ef8-978f-b874bd917947 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
|
@copilot merge origin main into this branch and resolve anyt conflicts. |
…app.cpp Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
…app.cpp Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/136aeffe-45da-47e2-95dd-e3883e85fad7 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
Done. Merged Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Claude finished @magyargergo's task in 6m 53s —— View job Adversarial Production-Readiness Review — PR #1598Tasks completed:
Review Bar for This PRReviewing against Current PR State
Branch Hygiene AssessmentClassification: merge-from-main commit present but harmless and merge-safe The branch contains two merge/conflict-resolution commits. Commit The effective diff is scoped to C++ ADL files and test fixtures — no unrelated churn detected. The merge is traceable and reviewable. However, the correctness questions below are what block merge. Understanding of the ChangeThe PR adds a
FindingsFinding 1 — ISO C++ Misstatement in Test CommentSeverity: High Risk: This claim is factually incorrect per This forces a standards compliance comment fix (or explicit GitNexus-approximation label) before merge, and the Recommended fix: Replace the And update the Blocks merge: Yes — DoD §2.3 requires comments that explain intent and contracts accurately. Claiming ISO behavior for a non-ISO approximation violates the repo's correctness and readability bars. Finding 2 —
|
|
@copilot retrieve all of the comments and filter out claude's review and get all of the findings and every findings must be fix in separate commits. Act as a senior c++ static analysis engineer as well as an iso c++ compiler engineer. |
…th GitNexus-approximation label Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/fa37c0dd-65f9-4dd4-9811-617227a37073 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
…tributing via qualified_identifier arg Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/fa37c0dd-65f9-4dd4-9811-617227a37073 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
…assified as free-function refs Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/fa37c0dd-65f9-4dd4-9811-617227a37073 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
|
Claude finished @magyargergo's task in 16m 18s —— View job Adversarial Production-Readiness Review — PR #1598 (Re-review)Tasks completed:
Review Bar for This PRReviewing against Current PR State
Branch Hygiene AssessmentClassification: merge-from-main commit present but harmless and merge-safe Two merge commits ( Understanding of the ChangeThe PR adds Previous Findings Status
Findings (New)Finding A — Negative tests absent from
|
|
/autofix |
|
✅ Applied autofix and pushed a commit. (apply run) |
|
@copilot we need to skip tests from the legacy DAG |
…AG parity run Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/64ffbaf1-f442-4a2b-8542-4afa500d9182 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
Done in commit
Both are now listed in |
Keep both expected-failure entries: inline-namespace ambiguity (abhigyanpatwari#1564) and ADL reference-arg negative fixtures (abhigyanpatwari#1598).
Keep both expected-failure entries: conversion-rank scoring (abhigyanpatwari#1578) and ADL reference-arg negative fixtures (abhigyanpatwari#1598).
…amespace (abhigyanpatwari#1598) * Initial plan * cpp ADL V2: free-function reference args contribute enclosing namespace Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/24805583-c0c4-4ef8-978f-b874bd917947 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> * merge: resolve conflicts with origin/main and fix overloaded fixture app.cpp Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/136aeffe-45da-47e2-95dd-e3883e85fad7 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> * fix(finding-1): replace ISO C++ [basic.lookup.argdep] misstatement with GitNexus-approximation label Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/fa37c0dd-65f9-4dd4-9811-617227a37073 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> * fix(finding-2): verify Function/Method exists in namespace before contributing via qualified_identifier arg Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/fa37c0dd-65f9-4dd4-9811-617227a37073 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> * fix(finding-3): function parameters in parameter_list no longer misclassified as free-function refs Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/fa37c0dd-65f9-4dd4-9811-617227a37073 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> * doc(finding-4): document typedef/using-aliased function-pointer limitation in lookupAdlIdentifierType Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/fa37c0dd-65f9-4dd4-9811-617227a37073 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> * test(finding-5): add negative fixtures for local-fp shadowing free-func and unqualified namespace collision Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/fa37c0dd-65f9-4dd4-9811-617227a37073 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> * chore(autofix): apply prettier + eslint fixes via /autofix command * fix(legacy-parity): skip two new negative-fixture tests from legacy DAG parity run Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/64ffbaf1-f442-4a2b-8542-4afa500d9182 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
C++ ADL (Koenig lookup) ignored function-pointer arguments entirely. Passing a free function reference like
utils::workeras an argument should addutilsto the associated-namespace set, enabling resolution of unqualified calls likewith_callback(utils::worker)toutils::with_callback.Note
GitNexus approximation (not strict ISO C++ ADL): ISO C++
[basic.lookup.argdep]says associated entities for function-type arguments come from parameter and return types — not the function's enclosing namespace. Forvoid worker(), the standard-compliant associated set is empty. GitNexus instead contributes the enclosing namespace of confirmed Function/Method defs, capturing the dominant real-world pattern at bounded precision cost.Changes
CppAdlArgInfo(adl.ts)functionRefText?: string— set when an arg is a potential free-function reference (qualified or unqualified identifier not found in local scope or parameter list), as opposed to a locally-declared function-pointer variable or function parameter.classifyAdlArg/lookupAdlIdentifierType/isIdentifierAFunctionParameter(captures.ts)lookupAdlIdentifierTypenow returnsCppAdlArgInfo | nullinstead of alwaysCppAdlArgInfo:null→ identifier not found in local scope (potential free-function ref)EMPTY_ADL_ARG→ identifier found as a locally-declaredvoid (*fp)()variable or as a function parameter (explicitly excluded)foundAsLocalFunctionPointertracking +extractDeclaratorLeafNamehelper to correctly extract variable names from function-pointer declarator chains (e.g.,void (*g)()) so local fp vars are never misclassified as free-function refs.isIdentifierAFunctionParameterhelper walks the enclosingfunction_definition→function_declarator→parameter_listchain. Function parameters live outsidecompound_statementso the local declaration scan previously returnednullfor them (triggering the free-function-ref path). Now returnsEMPTY_ADL_ARGto prevent false positives.classifyAdlArgnow handlesqualified_identifiernodes (e.g.,utils::worker) as potential function references; noted as a GitNexus approximation since tree-sitter-cpp produces the same node type for variables, enum values, and static members.collectFunctionRefNamespaces+pickCppAdlCandidates(adl.ts)collectFunctionRefNamespacesresolves the associated namespace(s):utils::worker): namespace extracted from the qualifier text (::→.normalisation), then verified via workspace lookup — aFunction/Methoddef with that simple name must exist in the target namespace before the namespace is contributed. This guards against false positives from namespace-qualified variables, enum values, and static data members.worker): workspace scanned for anyFunction/Methoddef with matching simple name; all enclosing namespaces contributed (GitNexus simplification — overloads all contribute, no overload selection).pickCppAdlCandidatesloop extended to callcollectFunctionRefNamespacesfor each arg withfunctionRefTextset, alongside the existing class-typed arg path.Legacy DAG parity (
helpers.ts)LEGACY_RESOLVER_PARITY_EXPECTED_FAILURES.cpp. The legacy DAG'spickUniqueGlobalCallableresolves callees by simple-name workspace lookup regardless of argument analysis, so it emits false-positive CALLS edges for these cases that the registry-primary path correctly suppresses:process(data::value)— legacy resolvesprocessglobally; registry-primary correctly contributes no namespace (no Function namedvalueindata).run_with(callback)— legacy resolvesrun_withglobally; registry-primary correctly detectscallbackas a parameter (EMPTY_ADL_ARG).Fixtures & tests
cpp-adl-free-func-ref:with_callback(utils::worker)resolves toutils::with_callbackvia ADL (qualified function ref, cross-namespace).cpp-adl-free-func-ref-overloaded: same withutils::worker/utils::worker(int)overloads — verifies no crash and namespace still contributed.cpp-adl-qualified-variable-arg(negative):process(data::value)wheredata::valueis anintvariable → 0 CALLS edges (namespace not contributed because no Function namedvalueexists indata). Skipped in legacy DAG parity run.cpp-adl-param-not-free-func-ref(negative):run_with(callback)wherecallbackis anintparameter andutils::callback()exists in workspace → 0 CALLS edges (parameter detected, EMPTY_ADL_ARG returned). Skipped in legacy DAG parity run.cpp-adl-local-fp-shadows-free-func(negative): localvoid (*g)()variable whileaudit::g()exists in workspace → 0 CALLS edges (foundAsLocalFunctionPointer guard).cpp-adl-unqualified-ref-collision(negative): unqualifiedworkerexists in two namespaces →ADL_AMBIGUOUS→ 0 CALLS edges.