Repository navigation
Conversation
Signed-off-by: Andrew Studnicky <a.j.studnicky@gmail.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
DeusData
left a comment
There was a problem hiding this comment.
Thank you, @Studnicky, both for the precise report in #2379 (the minimal repro and the query_graph output made the gap obvious) and for turning it into a fix with eight focused tests. They cover struct, class, convenience, failable, extension and deinit, plus a guard that ordinary methods keep their attribution. Welcome back; #1470 and #1471 are still doing their job.
The extraction side is right: init/deinit become Type.init/Type.deinit Methods, and calls in their bodies now come from them. Because those nodes are also new call targets, we need to see the edge-level result before merging:
super.init(...). Callees likesuper.initandself.inithave a lower-case receiver, soreceiver_chain_admits(src/pipeline/registry.c:1179) lets them through, andresolve_name_lookupthen picks the nearest node whose short name isinit. Before this PR there was no Swiftinitto bind to. Now aUIViewControllersubclass'ssuper.init(nibName:bundle:)could resolve to its owninit(a self-loop) or to a sibling type's. We keep the graph to true edges only, so could you add a pipeline-level test that asserts the exact CALLS set? Use the #2379 repro plusclass Sub: Base { init() { super.init() } }. Ifsuper.initmis-binds, please handle it, for example by resolving it through the class's base, or dropping it when the base isn't in the project.- A before/after on a real Swift project (Alamofire, for example): CALLS counts plus a sample of the new
*.initedges. That's the evidence we use to judge graph-quality changes. - Gate the naming on Swift in one place.
func_name_node(extract_defs.c:212) has no language parameter, and the Slang grammar also has aninit_declarationnode. Alang == CBM_LANG_SWIFTbranch incbm_resolve_func_name/resolve_method_name, like the Kotlinsecondary_constructorbranch inextract_class_methods, keeps this explicit.
Nits:
swift_init_multiple_not_collapsed_issue2379asserts that the inits do share one node (correctly, per #2061), so something like..._overloads_share_one_node_...would avoid confusion.find_def_in_modulehas two stacked header comments (test_extraction.c:72-75), and the first describes a different helper.
Thanks again!
|
Thanks again for the Swift lifecycle attribution work. Following up on the review: the exact super.init CALLS test, real-project edge comparison, and Swift-only naming gate remain the requested next steps. Please let us know if any point needs clarification. |
Brings the branch up to date with main (a222715) so the Swift initializer fix is reviewed and tested against the current tree. No conflicts. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Follow-up to the review of DeusData#2395 (issue DeusData#2379). Making init/deinit Method nodes gives every type an `init` target, and the short-name registry strategies then bound initializer calls to whichever `init` was nearest. On Alamofire (bda9ed57) all 8 new CALLS edges into an initializer were false, and so were the 40 new USAGE edges. - Name init/deinit in one Swift-gated place, cbm_resolve_func_name; resolve_method_name delegates there. The language-agnostic func_name_node no longer special-cases the node kinds (the Slang grammar has an init_declaration too). - super.init(...) is emitted as <Superclass>.init, from the first entry of the enclosing class's inheritance clause. The class node is carried by the unified walk (enclosing_class_node, saved and restored with the other frame state) instead of found by climbing parents. Without a clause, or with an entry that does not read as a type name, there is no call. - self.init(...) forms no call. Initializer overloads share one node, so the only possible edge is a self-loop, and that is false whenever the overload it delegates to lives outside the project. - T.init(...) calls are flagged is_method, and Swift joins the weak-member guard in pass_calls.c and pass_parallel.c (in lockstep), so only qualified, same-module or import placements survive. No other Swift call carries the flag. - init and deinit are Swift keywords for cbm_is_keyword, so references such as .init(...) and Foo.init are not usages resolved by name. Tests: the exact CALLS set for the DeusData#2379 reproduction plus initializer delegation in a SwiftPM package, through the sequential and the parallel resolver; extraction tests for the superclass rewrite, the no-superclass and lower-case cases, the scope of the call flag and init references. Review nits: renamed the overload test, removed the stacked helper comment. Alamofire, main / PR head / this commit: CALLS 5472 / 5487 / 5485; CALLS into an initializer 0 / 8 (all false) / 6 (all superclass initializers); USAGE into an initializer 0 / 40 / 0. Co-authored-by: Andrew Studnicky <a.j.studnicky@gmail.com> Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you, @Studnicky, for this fix and for the careful report in #2379. Your extraction change is exactly right: Since you allowed maintainer edits, we took care of the points from the September review ourselves, so the PR does not have to wait for another round trip. We merged current
Before and after on Alamofire (
On Kingfisher, CALLS into an initializer go from 15 on your branch (14 of them wrong) to 2, both correct. CI will run on the updated branch, and we will follow up here. Thanks again for a really useful contribution! |
|
Thank you again for the Swift lifecycle fix. The October 20 update records the naming gate and initializer-resolution follow-ups as completed with the additional regressions. The remaining follow-up is ours; sorry for the delay, and I’ll follow up soon. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you again, @Studnicky, for this fix and for the clear reproduction in #2379. Turning Swift init and deinit into real Method nodes is exactly what lets every call inside an initializer land on the right node in the graph, and your tests made each initializer form easy to check. A short status note: the CI run after our October 20 update stopped early, before any test suite ran, on a check of the published language counts that was broken on main at the time. That check has since been repaired on main, so we merged current main into the branch again (one signed-off merge commit, b5b16e0; no conflicts, your commit is unchanged). We will merge as soon as CI is green. If you plan to push anything else here, please pull first. Thanks again for a really useful contribution! |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thanks again, @Studnicky. Several other pull requests landed on main this evening, including changes in files this one also touches, so we merged current main into your branch once more (one signed-off merge commit, f2c9080; your changes are untouched). That keeps the required checks honest against today's tree; we will merge once they are green. Please pull before pushing again. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you for your patience, @Studnicky. CI went green on this branch, but tonight's merges on main touched tests/test_extraction.c and tests/test_pipeline.c, which this pull request also changes, so that green no longer covered today's main. We merged current main into the branch once more (one merge commit, b11aef0; your changes are untouched) and will merge once the fresh checks are green. Please pull before pushing again. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you for your patience, @Studnicky. CI went green on this branch, but this evening's merges on main touched files this pull request also changes, so that green no longer covered today's main. We merged current main into the branch once more (one merge commit, 3fbe17f; your changes are untouched) and will merge once the fresh checks are green. Please pull before pushing again. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you again, @Studnicky, for your patience with this one. Two pull requests merged into main a few minutes ago (#2754 and #2090), and they touch internal/cbm/lang_specs.c and src/pipeline/pass_parallel.c, which this pull request also changes. So we merged current main into your branch once more (one merge commit, ebe2e6f; it merged cleanly and your own change is untouched), checked that the merged files still compile, and started a fresh CI run. We will merge as soon as the required checks are green. Please pull before pushing again so the merge commit is kept. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you for your patience, @Studnicky. A pull request that merged into main a few minutes ago (#2769) changes internal/cbm/extract_defs.c, which this pull request also changes, so the CI run in progress here could no longer vouch for today's main. We merged current main into your branch once more (one merge commit, 5efa564; it merged cleanly and your own change is untouched) and started a fresh run. We will merge once the required checks are green. Please pull before pushing again. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you for your patience, @Studnicky. A pull request that merged into main a few minutes ago (#1710) changes internal/cbm/extract_calls.c, which this pull request also changes, so the CI run in progress here could no longer vouch for today's main. We merged current main into your branch once more (one merge commit, 97628c0; it merged cleanly and your own change is untouched) and started a fresh run. We will merge once the required checks are green. Please pull before pushing again. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you for your patience, @Studnicky. Main has moved since the last CI run on this branch, and some of the new commits change internal/cbm/extract_defs.c and src/pipeline/pass_calls.c, which this pull request also changes, so that run can no longer vouch for today's main. Separately, the Windows leg of that run failed with an intermittent crash at the start of a few test suites that we are tracking on our side; it is not caused by your change. We merged current main into your branch (one merge commit, ca1f750; it merged cleanly and your own change is untouched) and started a fresh run. We will merge once the required checks are green. Please pull before pushing again. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you for your patience, @Studnicky. The macOS legs of the last CI run here were cancelled by GitHub itself: it is retiring its macOS 14 runners on November 2 and ran scheduled brownouts beforehand, so those jobs never got a runner. Nothing in your change caused it. Separately, the Windows leg hit an intermittent crash at the start of a few test suites that we are tracking on our side; that is not your change either. Main now runs CI on macOS 15 (#2849), so we merged current main into your branch (one merge commit, f6100d9; it merged cleanly and your own change is untouched) to get a run on the new runners. Please pull before pushing again. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you for your patience, @Studnicky. Your change was green, but several pull requests merged yesterday touch src/pipeline/pass_calls.c, src/pipeline/pass_parallel.c and tests/test_pipeline.c, which this pull request also changes, so that run could no longer vouch for today's main. We merged current main into your branch (no conflicts, your own change is unchanged) to get a fresh CI run on the combined tree. Please pull before pushing again. We will merge as soon as the required checks are green. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you for your patience, @Studnicky. A quick status note: the last CI run failed on the Linux GCC x86 leg because that job hung in If you push to this branch again, please pull first so the merge commit is kept. Thanks again for the Swift initializer work; it is next in line once this run is green. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
What does this PR do?
Fixes #2379. Swift
initanddeinitdeclarations are emitted as methods namedinitanddeinit, so calls in their bodies retain the lifecycle method as their enclosing function instead of falling back to module scope.The regression coverage exercises struct, class, convenience, failable enum, extension, ordinary-method, and deinitializer cases.
This contribution is written with Codex under the account holder's direction.
Validation
make -f Makefile.cbm test— 8,198 passed, 10 skippedmake -j3 -f Makefile.cbm lint-ci lint-tidy-diff— passedscripts/security-audit.sh— passedbuild/c/test-runner extraction— 386 passedChecklist
git commit -s)make -f Makefile.cbm test)make -f Makefile.cbm lint-ci)