fix(diagnostic): handle constrained generic function calls in call-non-callable#970
Conversation
…n-callable call/non-callable analysis treated template refs as definitively non-callable and did not consistently use template constraints during callability checks. Fixes: - infer_call_expr_func now handles TplRef/ConstTplRef/StrTplRef by resolving through get_tpl_ref_extend_type before call inference. - added a recursion guard when the resolved constraint type is unchanged. - call_non_callable checker now evaluates template refs via their constraints in has_non_callable_member. - union non-callable collection now reuses has_non_callable_member for consistent filtering.
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 addresses an issue where the 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. Changelog
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.
Code Review
This pull request effectively addresses an issue with call analysis on constrained generic functions. The changes in infer_call_expr_func to resolve template references and the corresponding updates in has_non_callable_member are well-implemented and correctly handle template constraints. The addition of a new test case is also a great inclusion. I have one suggestion to improve maintainability by reducing code duplication.
call/non-callable analysis treated template refs as definitively
non-callable and did not consistently use template constraints during
callability checks.
Fixes:
resolving through get_tpl_ref_extend_type before call inference.
unchanged.
constraints in has_non_callable_member.
consistent filtering.