-
Notifications
You must be signed in to change notification settings - Fork 1.1k
inline
together with private object might generate code that throws IllegalAccessError
#12160
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
Labels
Comments
A self-contained example: import scala.deriving._
trait Show[A]:
extension (a: A) def show: String
object Show:
inline def derived[A](using m: Mirror.Of[A]): Show[A] = inline m match
case p: Mirror.ProductOf[A] => internal.Shower.showProduct[A]
case s: Mirror.SumOf[A] => ???
package internal:
object Shower:
inline def showProduct[A]: Show[A] =
new Show[A] { extension (a: A) def show = P(a.toString).s }
private case class P(str: String) { def s = str } // must be a case class
end internal
case class Foo(s: String) derives Show
@main def Test =
println(Foo("bar").show)
|
Minimized to package internal:
object Foo:
inline def foo: Unit = P.s
private object P { def s = "b" }
end internal
@main def Test = internal.Foo.foo |
inline
together with derives
might generate code that throws IllegalAccessErrorinline
together with private object might generate code that throws IllegalAccessError
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Apr 8, 2022
Closes scala#12448 Closes scala#12487 Closes scala#12160
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Apr 8, 2022
Closes scala#12448 Closes scala#12487 Closes scala#12160
michelou
pushed a commit
to michelou/scala3
that referenced
this issue
Apr 25, 2022
Closes scala#12448 Closes scala#12487 Closes scala#12160
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.0.0-RC3
Minimized code
https://github.com/scf37/fpscala2/tree/scala3-bug
checkout and run
sbt run
Output
Expectation
Successful execution
The text was updated successfully, but these errors were encountered: