Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issue #863 by correctly collecting method overloads in class hierarchies. Previously, subclass methods with the same name would hide all parent class overloads, even those with different signatures. The fix ensures that overloaded methods from parent classes remain visible and callable on subclass instances.
Key changes:
- Refactored method resolution to rank candidates by argument match quality before filtering by receiver specificity
- Added visibility filtering to distinguish accessible methods from hidden ones
- Implemented a test case verifying that subclass instances can call both inherited and new overloads
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| BugTests.java | Added regression test for overload visibility in subclass hierarchy |
| AttrPossibleFunctionSignatures.java | Rewrote ExprMemberMethod signature resolution to rank by argument match first, then receiver specificity |
| AttrModuleInstanciations.java | Enhanced module origin lookup with fallback to nearest scope for detached AST nodes |
| AttrFunctionSignature.java | Deferred unbound type variable errors when closure arguments are present |
| AttrFuncDef.java | Refactored ExprMemberMethod func link calculation with explicit visibility filtering and most-specific receiver selection |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // 1) Normal path: resolve relative to the lexical parent (old behavior) | ||
| final Element parent = mi.getParent(); | ||
| if (parent != null) { | ||
| TypeDef def = parent.lookupType(name, /*showErrors*/ false); |
There was a problem hiding this comment.
Corrected 'showErrors' parameter comment formatting. Use standard JavaDoc style with equals sign: '/showErrors=/ false' instead of '/showErrors/ false'.
| // 2) Detached during incremental build: try the nearest attached scope | ||
| final WScope scope = mi.attrNearestScope(); | ||
| if (scope != null) { | ||
| TypeDef def = scope.lookupType(name, /*showErrors*/ false); |
There was a problem hiding this comment.
Corrected 'showErrors' parameter comment formatting. Use standard JavaDoc style with equals sign: '/showErrors=/ false' instead of '/showErrors/ false'.
No description provided.