Skip to content

cl: compileCallExpr convKwargs bugfix - #2685

Merged
xushiwei merged 3 commits into
goplus:mainfrom
xushiwei:q
Mar 26, 2026
Merged

xushiwei merged 3 commits into
goplus:mainfrom
xushiwei:q

Conversation

@xushiwei

Copy link
Copy Markdown
Member

No description provided.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 significantly improves the maintainability and correctness of function call compilation by refactoring keyword argument processing into a standalone utility function. This change isolates complex logic, making it easier to understand and test, and includes new tests to cover specific error conditions related to variadic functions and keyword arguments. Additionally, a minor but important fix was applied to a type initialization method.

Highlights

  • Refactoring: The logic for converting keyword arguments in function calls has been extracted from compileCallExpr into a new, dedicated helper function named convKwargs.
  • Testing: Two new test cases, TestConvKwargs1 and TestConvKwargs2, were added to builtin_test.go to specifically validate the error handling of the convKwargs function, particularly for variadic functions.
  • Bugfix: A subtle bug in fnType.initFuncs related to pointer assignment within a loop was corrected to ensure proper type chain initialization.

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

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.

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 Mar 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.11%. Comparing base (c62581b) to head (fbe11df).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
cl/expr.go 92.30% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2685      +/-   ##
==========================================
+ Coverage   94.09%   94.11%   +0.02%     
==========================================
  Files          32       32              
  Lines       10045    10046       +1     
==========================================
+ Hits         9452     9455       +3     
+ Misses        422      421       -1     
+ Partials      171      170       -1     

☔ 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 refactors the handling of keyword arguments in function calls by extracting the conversion logic into a new convKwargs helper function. This improves modularity and readability within compileCallExpr. New test cases, TestConvKwargs1 and TestConvKwargs2, have been added to cl/builtin_test.go to cover error scenarios related to keyword argument processing with variadic functions. A minor refactoring was also made in fnType.initFuncs for clarity. I have no feedback to provide as there were no review comments.

Comment thread cl/expr.go Outdated
Comment thread cl/expr.go Outdated
Comment thread cl/builtin_test.go Outdated
@fennoai

fennoai Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Good refactor — extracting convKwargs and moving it inside the overload loop is the right approach for correct per-candidate kwargs conversion. The initFuncs cleanup (p = fn instead of p = p.next) is a nice clarity improvement.

Main concerns: (1) convKwargs panics inside the overload loop, which prevents fallthrough to other candidates unlike compileCallArgs errors. (2) The recordCallExpr change from fnt to fn.sig and from v to nv alters IDE recording semantics — worth verifying with recorder tests.

@xushiwei
xushiwei merged commit c4648a3 into goplus:main Mar 26, 2026
10 of 11 checks passed
@xushiwei
xushiwei deleted the q branch March 30, 2026 23:23
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