Skip to content

rm support for obj.XGo_Enum(func(...)) - #644

Merged
xushiwei merged 3 commits into
goplus:mainfrom
xushiwei:q
Aug 16, 2026
Merged

rm support for obj.XGo_Enum(func(...))#644
xushiwei merged 3 commits into
goplus:mainfrom
xushiwei:q

Conversation

@xushiwei

Copy link
Copy Markdown
Member

@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.66%. Comparing base (bce1b2b) to head (9632a5b).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #644      +/-   ##
==========================================
- Coverage   93.67%   93.66%   -0.02%     
==========================================
  Files          29       29              
  Lines        7262     7217      -45     
==========================================
- Hits         6803     6760      -43     
+ Misses        391      389       -2     
  Partials       68       68              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: remove callback-style XGo_Enum for-range iteration

The core deletion is correct and self-consistent: checkUdt now rejects any nonzero-parameter XGo_Enum signature (returns nil, false), which fails closed to a normal cannot range over ... compile error. The removed internal/foo fixtures (Foo..Foo4) leave no dangling references, and the affected tests pass. go build/go vet are clean.

The one gap is incomplete cleanup: the checker half of the callback feature was removed, but the emitter half is left behind as dead code. Nothing now assigns a negative p.udt or p.kvt, so the else branch in emitForRangeStmt, the kvt field, and the cantUseFlowsInForRange constant are all unreachable. Removing them completes the PR's intent and should recover the coverage drop (the deleted tests were the only ones exercising that branch). Security and performance passes found nothing.

Additional findings

  • /workspace/gogen/util_gengo.go:1228: [P2] Dead code: negative-udt callback branch is now unreachable: This else branch handles p.udt < 0 (the X.XGo_Enum(func(k, v){...}) callback form, n = -n at 1199). After this PR, p.udt is only ever set to a positive value (2/3) at stmt.go:726; the sole producer of a negative udt (p.udt = -n in checkUdt case 1) was deleted. This branch and its p.kvt reads are therefore dead code. Removing it completes the feature removal and, per the PR note, should recover the coverage drop since the deleted tests were the only ones exercising it. The cantUseFlowsInForRange constant (below, ~line 1232) is referenced only from here and becomes unused once this branch is gone.
  • stmt.go:487: [P3] Vestigial kvt field after callback path removal: kvt is now never assigned anywhere in the codebase; it is read only from the now-dead negative-udt branch in emitForRangeStmt. It can be removed from forRangeStmt as part of completing the removal.

Comment thread stmt.go
@xushiwei
xushiwei merged commit b240c8b into goplus:main Aug 16, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant