Skip to content

Conversation

@Frotty
Copy link
Member

@Frotty Frotty commented Oct 18, 2025

No description provided.

@Frotty Frotty requested a review from Copilot October 18, 2025 21:51
Copy link

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 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);
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

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

Corrected 'showErrors' parameter comment formatting. Use standard JavaDoc style with equals sign: '/showErrors=/ false' instead of '/showErrors/ false'.

Copilot uses AI. Check for mistakes.
// 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);
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

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

Corrected 'showErrors' parameter comment formatting. Use standard JavaDoc style with equals sign: '/showErrors=/ false' instead of '/showErrors/ false'.

Copilot uses AI. Check for mistakes.
@Frotty Frotty merged commit 691fdf2 into master Oct 18, 2025
4 checks passed
@Frotty Frotty deleted the fix-#863 branch October 18, 2025 21:58
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