Skip to content

selectDynamic not encodes given name #18612

Closed
@goshacodes

Description

@goshacodes

Compiler version

3.3.0

Minimized code

class X extends scala.reflect.Selectable:
  val `+` = "1"
  
 val x = X()

This one is not working:

x.selectDynamic("+")
Caused by: java.lang.NoSuchMethodException: Playground$X.+()

But this one works:

x.selectDynamic("$plus")

Expectation

This one works

x.selectDynamic("+")

Also I wonder is there a way of encoding given name by hand?
As I understood this blocks scalamock migration to Scala 3, since MethodSymbol#name returned encoded name, while Symbol#name gives raw name, so I can't use reflection to get a field, I need to encode it somehow.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions