Skip to content

Conversation

@lewis6991
Copy link
Collaborator

@lewis6991 lewis6991 commented Jan 30, 2026

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @lewis6991, 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 enhances the type analysis capabilities by adding a new diagnostic to catch attempts to call non-callable expressions. It also refines the type flow analysis, specifically addressing how explicit ---@type annotations and doc-function assignments interact with type narrowing, ensuring that the inferred types are more accurate and consistent with developer intent.

Highlights

  • New Diagnostic: Call Non-Callable: A new diagnostic check has been introduced to identify and warn when an expression that is not a function (or callable type) is being called.
  • Improved Doc-Function Assignment Narrowing: The type inference system now correctly handles doc-function assignments, ensuring that types are narrowed appropriately based on explicit documentation.
  • Preserved Explicit Doc Type Narrowing: Explicit type annotations provided via ---@type comments are now preserved and correctly applied during assignment, preventing unintended type widening or loss of specificity.

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

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.

Copy link

@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 introduces a new call-non-callable diagnostic and significantly improves type narrowing on assignment, which are valuable enhancements. The implementation of the new checker is mostly solid, and the fixes to type narrowing correctly handle more complex scenarios. I've identified one critical issue that will prevent compilation and a couple of opportunities to improve maintainability and performance. Overall, these are great changes that will improve the quality of the analysis.

Add a new diagnostic that reports calls on non-callable values
(e.g. numbers, strings, booleans, threads). Include tests.
@lewis6991 lewis6991 changed the title add call-non-callable check and narrowing fixes feat(analysis): refine globals/member inference, tests, and diagnostics Jan 31, 2026
@lewis6991 lewis6991 force-pushed the lupdate branch 3 times, most recently from 69c5944 to c24f6b4 Compare January 31, 2026 13:41
@xuhuanzy
Copy link
Member

xuhuanzy commented Jan 31, 2026

This PR seems to make heavy use of AI? Are you sure you fully understand what the changes mean?

@lewis6991
Copy link
Collaborator Author

lewis6991 commented Jan 31, 2026

Not fully, but I've made sure every single change is backed up with a test, which constitutes most of the PR.

@xuhuanzy
Copy link
Member

Some edge cases are hard to cover with tests, so we can’t guarantee that passing all tests means it’s correct. Before making changes, it’s best to make sure you know what you’re doing.

@lewis6991
Copy link
Collaborator Author

lewis6991 commented Jan 31, 2026

I'll run it through my projects before this is ready.

Otherwise I can break this down into easy to review PR's. The changes began simple but kept finding existing issues.

Ensure post-if flow is marked unreachable when all branches terminate,
so narrowing after error-only branches works correctly.
Intersect DocFunction with Signature to avoid narrowing to Never when a
function literal is assigned to a doc-typed function slot. This prevents
false call-non-callable/need-check-nil diagnostics after reassignment.
- extract explicit var doc-type lookup
- centralize doc-type cache resolution for decls/members
- add tests covering doc-type narrowing behavior
- extract explicit var doc-type lookup
- centralize doc-type cache resolution for decls/members
- add tests covering doc-type narrowing behavior
- add global-path/member fallbacks and index ownership hints
- tighten type narrowing and assignment diagnostics in tests
- simplify diagnostic output and add clarifying comments
@lewis6991 lewis6991 changed the title feat(analysis): refine globals/member inference, tests, and diagnostics WIP: update Jan 31, 2026
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.

2 participants