Skip to content

Conversation

@krrish175-byte
Copy link

The compiler was incorrectly reporting "two or more overloaded variants have default arguments" when an extension method with default using clauses coexisted with a non-extension method of the same name.

The issue was that the conflicting defaults check was applied to all methods with the same name, rather than only to methods that actually conflict (i.e., those that match the same static signature).

Changes:

  • Move the conflicting defaults check inside the matchesSameStatic condition in Checking.scala
  • Add test case demonstrating extension methods with default using clauses working alongside non-extension methods
    This allows valid code patterns where extension methods and regular methods share the same name, since they have different signatures and don't actually overload each other.

Closing issue

closes #24886

@krrish175-byte krrish175-byte force-pushed the fix/24886-extension-using-defaults branch from 7707ae9 to 7fc2a55 Compare January 3, 2026 08:33
@krrish175-byte krrish175-byte force-pushed the fix/24886-extension-using-defaults branch from 93eda62 to 0595bbb Compare January 4, 2026 10:25
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.

extension with using clauses with defaults and with a method with default argument fails at call site

1 participant