Skip to content

product mirror for scala.Nil.type tries to access the constructor #15234

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

Closed
bishabosha opened this issue May 19, 2022 · 0 comments · Fixed by #15231
Closed

product mirror for scala.Nil.type tries to access the constructor #15234

bishabosha opened this issue May 19, 2022 · 0 comments · Fixed by #15231

Comments

@bishabosha
Copy link
Member

bishabosha commented May 19, 2022

Any Mirror for a value alias to a case object will crash when calling the fromProduct method, this is because it tries to access the constructor. (i.e. a singleton mirror is not synthesised, but instead a standard product mirror).

Compiler version

3.0.0 - 3.1.2

Minimized code

import scala.deriving.Mirror

@main def Test =
  println(summon[Mirror.Of[Nil.type]].fromProduct(EmptyTuple))

Output

Exception in thread "main" java.lang.IllegalAccessError: tried to access method scala.collection.immutable.Nil$.<init>()V from class App$package$$anon$1
	at App$package$$anon$1.fromProduct(App.scala:4)
	at App$package$$anon$1.fromProduct(App.scala:4)
	at App$package$.Test(App.scala:4)
	at Test.main(App.scala:3)

Expectation

I expect to see List() printed

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