Skip to content

No way to recognize if using params belong to extension method #13123

Open
@tgodzik

Description

@tgodzik

Compiler version

3.0.1

Minimized code

  class A
  class B
  class C
  object Foo:
      extension [T](using A)(s: T)(using B)
          def double(using C)(times: Int) = (s.toString + s.toString) * times
      end extension
      given A with {}
      given B with {}
      given C with {}
      "".double(1)
  end Foo

Output

I am trying to print the definition for double method, but it seems it's not possible to see that using C belongs to the double method.

My implementation based on https://github.com/lampepfl/dotty/blob/c8894a0168061ddb1369a426e9bde8d9972c893b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala#L851

will print:
extension [T](using A)(s: T)(using B)(using C) def double(times: Int): String

Expectation

There is a flag to recognize if param belongs to an extension method such as:
sym.is(Flags.ExtensionParam)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions