Skip to content

position of using clause prevents overloaded extension method being picked #11713

Closed
@rjolly

Description

@rjolly

Compiler version

3.0.0-RC1

Minimized code and output

extension [T1](x: T1)(using Numeric[T1])
  def combine[T2](y: T2)(using Numeric[T2]) = ???
  def combine(y: String) = ???

val res = 100.combine(200)
//        ^^^^^^^^^^^
//    value combine is not a member of Int.
//    An extension method was tried, but could not be fully constructed:
//
//        combine()    failed with
//
//            value combine: <overloaded combine> does not take parameters

Expectation : should work, as when we move using to the end of the parameter list:

extension [T1](x: T1)
  def combine[T2](y: T2)(using Numeric[T2], Numeric[T1]) = ???
  def combine(y: String) = ???

val res = 100.combine(200)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions