Skip to content

cl: compileErrWrapExpr remove autoCall (#2638) - #2640

Merged
xushiwei merged 1 commit into
goplus:mainfrom
xushiwei:q
Feb 17, 2026
Merged

xushiwei merged 1 commit into
goplus:mainfrom
xushiwei:q

Conversation

@xushiwei

@xushiwei xushiwei commented Feb 17, 2026 •

Copy link
Copy Markdown
Member

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @xushiwei, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the compiler's error-wrapping mechanism by removing an automatic function call behavior within compileErrWrapExpr. This change ensures that the ! operator explicitly wraps expressions that are expected to return errors, rather than implicitly calling identifiers or selectors. The introduction of a lhs parameter across various compilation functions signifies a deeper refinement in how expression contexts are managed during compilation, leading to more precise code generation for error handling.

Highlights

  • Error Wrapping Expression (!) Behavior Change: The compiler's handling of the error-wrapping operator (!) has been updated. The compileErrWrapExpr function no longer implicitly converts identifiers or selector expressions into function calls before applying error wrapping. Instead, it now directly processes the underlying expression v.X.
  • Introduction of lhs Parameter: A new lhs (left-hand side) integer parameter has been introduced and propagated across numerous compilation functions, including compileIdent, compileFuncAlias, compilePkgRef, identVal, compileExpr, and compileSelectorExpr. This parameter likely helps in distinguishing contexts where an expression's value is being assigned or consumed.
  • DQL Error Handling Example Update: The DQL test case cl/_testgop/dql2/in.xgo was updated to explicitly use the error-wrapping operator (!) on a DQL expression. The corresponding generated Go code in cl/_testgop/dql2/out.go now includes explicit error handling using github.com/qiniu/x/errors and panic for the wrapped expression.
  • Test Case Removal: The TestErrWrapNoArgs function has been removed from cl/compile_test.go, suggesting it tested a behavior of error wrapping that is no longer relevant after these changes.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • cl/_testgop/dql2/in.xgo
    • Modified DQL expression to explicitly use the error-wrapping operator.
  • cl/_testgop/dql2/out.go
    • Updated generated Go code to include explicit error handling for DQL error-wrapped expressions, importing github.com/qiniu/x/errors and using panic on error.
  • cl/builtin_test.go
    • Updated the call to compileFuncAlias in TestCompileFuncAlias to pass the new lhs argument.
  • cl/compile_spx_test.go
    • Corrected an expected error message in gopSpxErrorTestMap for a Game.t4gmx test case.
  • cl/compile_test.go
    • Removed the TestErrWrapNoArgs test function.
  • cl/expr.go
    • Modified compileIdent to accept a new lhs integer argument.
    • Updated compileMember to pass the lhs argument.
    • Modified compileFuncAlias to accept a new lhs integer argument.
    • Modified compilePkgRef to accept a new lhs integer argument.
    • Updated compileExprLHS to pass 1 as the lhs argument to compileIdent.
    • Updated compileExpr to pass the lhs argument to compileIdent.
    • Updated compileSelectorExprLHS to pass 1 as the lhs argument to compileIdent.
    • Updated compileSelectorExpr to pass 1 as the lhs argument to compileIdent and compilePkgRef.
    • Modified identVal to accept a new lhs integer argument and use it in cb.CallWith.
    • Updated compileCallExpr to pass 1 as the lhs argument to compileIdent, compileSelectorExpr, and compileExpr.
    • Updated compileCallArgs to pass 0 as the lhs argument to compileIdent for lambda expressions.
    • Removed automatic ast.CallExpr wrapping for ast.Ident and ast.SelectorExpr within compileErrWrapExpr.
    • Updated compileErrWrapExpr to directly compile v.X and pass the lhs argument to compileExpr.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@codecov

codecov Bot commented Feb 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.10%. Comparing base (6155935) to head (d28af7a).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2640      +/-   ##
==========================================
- Coverage   94.10%   94.10%   -0.01%     
==========================================
  Files          32       32              
  Lines        9964     9960       -4     
==========================================
- Hits         9377     9373       -4     
  Misses        419      419              
  Partials      168      168              

☔ 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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request removes the auto-call behavior for error-wrapping expressions (!), which is a significant language feature change. The implementation correctly removes the logic that wrapped identifiers and selectors in a CallExpr. The tests have been updated accordingly, including the removal of TestErrWrapNoArgs.

A large part of the change is a refactoring to pass the lhs (left-hand side count) parameter through various compilation functions. This seems to be done correctly. I have one comment regarding a TODO left in the code related to this refactoring.

Comment thread cl/expr.go
@xushiwei
xushiwei merged commit 96ab0be into goplus:main Feb 17, 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