Skip to content

Conversation

@xterao
Copy link
Collaborator

@xterao xterao commented Sep 10, 2025

This update adds parameter type checking for methods called as bind variables in SQL.
It verifies the number and types of arguments for methods referenced as bind variables by retrieving actual method definitions, enabling accurate code completion and reference resolution.

Scope of Checks

  • Instance methods
  • Static methods
  • Custom functions and built-in functions

Validation Details

  • Checks if a function definition with the same name exists
  • Checks if a method with the same number of arguments exists
  • Checks if argument types match

Type Checking Rules

  • Wrapper types and primitive types (e.g., Integer and int) are considered compatible
  • Subtypes of defined parameter types are considered compatible
  • CharSequence and String are considered compatible
  • If a field access within method parameters fails to resolve, type checking is temporarily performed using the last successfully analyzed type

xterao added 19 commits August 19, 2025 15:59
When `doma.expr.functions` is present, always resolve function definitions from the original defining class.
… correctly retrieves the preceding elements.
…d the logic for fetching the most recently analyzed item.
@xterao xterao requested a review from Copilot September 10, 2025 11:37
@xterao xterao self-assigned this Sep 10, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive parameter type checking for method calls referenced as bind variables in SQL files. It enables accurate validation by verifying parameter counts and types for instance methods, static methods, custom functions, and built-in functions used in SQL bind variables.

  • Implements parameter type validation for method calls in bind variables
  • Adds validation for parameter count mismatches
  • Introduces type compatibility checking with support for boxing/unboxing and inheritance

Reviewed Changes

Copilot reviewed 76 out of 76 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ValidationResultFunctionCallParameterTypeMismatch.kt New validation result class for type mismatch errors
ValidationResultFunctionCallParameterCount.kt New validation result class for parameter count errors
InspectionFunctionCallVisitorProcessor.kt Enhanced processor with parameter validation logic
MethodMatcher.kt New utility class for method parameter matching
FieldMethodResolver.kt New resolver for field and method access with parameter validation
PsiParentClass.kt Enhanced with method finding capabilities for parameter validation
SqlElExtensions.kt Added parameter type extraction functionality
TypeUtil.kt Added type compatibility checking methods
ForDirectiveUtil.kt Refactored to use new method resolution system
Test files Comprehensive test data and cases for validation scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@xterao xterao linked an issue Sep 10, 2025 that may be closed by this pull request
@xterao xterao merged commit b4937ca into main Sep 11, 2025
5 checks passed
@xterao xterao deleted the feature/inspection-function-call-param branch September 11, 2025 00:53
@xterao xterao removed a link to an issue Sep 11, 2025
@xterao xterao added this to the 2.3.0 Release milestone Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants