-
Notifications
You must be signed in to change notification settings - Fork 57
WIP: update #938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
WIP: update #938
Conversation
Summary of ChangesHello @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 Highlights
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this 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.
crates/emmylua_code_analysis/src/diagnostic/checker/call_non_callable.rs
Show resolved
Hide resolved
crates/emmylua_code_analysis/src/semantic/infer/narrow/get_type_at_flow.rs
Outdated
Show resolved
Hide resolved
Add a new diagnostic that reports calls on non-callable values (e.g. numbers, strings, booleans, threads). Include tests.
69c5944 to
c24f6b4
Compare
|
This PR seems to make heavy use of AI? Are you sure you fully understand what the changes mean? |
|
Not fully, but I've made sure every single change is backed up with a test, which constitutes most of the PR. |
|
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. |
|
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
No description provided.