Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing an instance of a value class to a method accessed structurall via reflection #16995

Open
prolativ opened this issue Feb 22, 2023 · 2 comments · May be fixed by #17564
Open

Passing an instance of a value class to a method accessed structurall via reflection #16995

prolativ opened this issue Feb 22, 2023 · 2 comments · May be fixed by #17564

Comments

@prolativ
Copy link
Contributor

Compiler version

3.3.1-RC1-bin-20230221-847eccc-NIGHTLY and before

Minimized code

class Foo(val i: Int) extends AnyVal
class Reflective extends reflect.Selectable

@main def run() =
  val reflective = new Reflective {
    def bar(foo: Foo) = foo.i
  }
  val i = reflective.bar(Foo(1))

Output

Exception in thread "main" java.lang.NoSuchMethodException: Reflect$package$$anon$1.bar(Foo)
        at java.lang.Class.getMethod(Class.java:1786)
        at scala.reflect.Selectable.applyDynamic(Selectable.scala:38)
        at scala.reflect.Selectable.applyDynamic$(Selectable.scala:11)
        at Reflective.applyDynamic(Reflect.scala:2)
        at Reflect$package$.run(Reflect.scala:8)
        at run.main(Reflect.scala:4)

Expectation

No exception should be thrown.

This is related to #14340 (with fix available here #16286) but the problem here is in the parameters of methods rather than in returned values

@prolativ
Copy link
Contributor Author

@G1ng3r you might be interested in that

@G1ng3r
Copy link

G1ng3r commented Feb 22, 2023

Thanks! Will take a look into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants