Skip to content

gogen v1.22.0: revert overload-conflict#2699

Merged
xushiwei merged 2 commits intogoplus:mainfrom
xushiwei:q
Apr 2, 2026
Merged

gogen v1.22.0: revert overload-conflict#2699
xushiwei merged 2 commits intogoplus:mainfrom
xushiwei:q

Conversation

@xushiwei
Copy link
Copy Markdown
Member

@xushiwei xushiwei commented Apr 2, 2026

No description provided.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.12%. Comparing base (12e36e3) to head (279a20c).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2699   +/-   ##
=======================================
  Coverage   94.12%   94.12%           
=======================================
  Files          32       32           
  Lines       10053    10054    +1     
=======================================
+ Hits         9462     9463    +1     
  Misses        421      421           
  Partials      170      170           

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the github.com/goplus/gogen dependency to version 1.22.0 and removes several internal files related to overload conflicts. In cl/compile.go, the code was refactored to use a temporary variable for receiver types; however, feedback suggests reverting this change to simplify the logic and avoid unnecessary variable declarations.

Comment on lines +1232 to 1238
var recvType = d.Recv.List[0].Type
recv, ok = recvType.(*ast.Ident)
if !ok {
ctx.handleErrorf(d.Recv.List[0].Type.Pos(), d.Recv.List[0].Type.End(), "invalid recv type %v", ctx.LoadExpr(d.Recv.List[0].Type))
ctx.handleErrorf(recvType.Pos(), recvType.End(), "invalid recv type %v", ctx.LoadExpr(recvType))
break
}
ctx.lbinames = append(ctx.lbinames, recv)
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.

medium

The variable recvType is introduced to improve readability, but the subsequent logic for recv and ok can be simplified by directly using the type assertion on d.Recv.List[0].Type to reduce unnecessary variable declarations.

Suggested change
var recvType = d.Recv.List[0].Type
recv, ok = recvType.(*ast.Ident)
if !ok {
ctx.handleErrorf(d.Recv.List[0].Type.Pos(), d.Recv.List[0].Type.End(), "invalid recv type %v", ctx.LoadExpr(d.Recv.List[0].Type))
ctx.handleErrorf(recvType.Pos(), recvType.End(), "invalid recv type %v", ctx.LoadExpr(recvType))
break
}
ctx.lbinames = append(ctx.lbinames, recv)
recv, ok = d.Recv.List[0].Type.(*ast.Ident)
if !ok {
ctx.handleErrorf(d.Recv.List[0].Type.Pos(), d.Recv.List[0].Type.End(), "invalid recv type %v", ctx.LoadExpr(d.Recv.List[0].Type))
break
}
ctx.lbinames = append(ctx.lbinames, recv)

if d.Recv != nil {
var ok bool
recv, ok = d.Recv.List[0].Type.(*ast.Ident)
var recvType = d.Recv.List[0].Type
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: idiomatic Go (and the style used elsewhere in this file, e.g. line 910) prefers := over var x = expr when no explicit type annotation is needed.

Suggested change
var recvType = d.Recv.List[0].Type
recvType := d.Recv.List[0].Type

@xgopilot
Copy link
Copy Markdown

xgopilot bot commented Apr 2, 2026

Clean, focused PR. The recvType extraction is a nice readability improvement, and the removal of the overload-conflict test artifacts leaves no dangling references. One minor style nit left inline. No performance or security concerns.

@xushiwei xushiwei merged commit e9c5569 into goplus:main Apr 2, 2026
11 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