You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example code has a bug hidden by the unchecked/unsound cast to Expr[T]. Using the asExprOf checked cast
- ).asExpr.asInstanceOf[Expr[T]]+ ).asExprOf[T]
we get
9|valz=Y.testStuff[A.C]
|^^^^^^^^^^^^^^^^|Exception occurred while executing macro expansion.
|java.lang.Exception:Expr cast exception: test.A.C.apply(1)
|of type: test.A.C|did not conform to type: scala.Nothing|| at scala.quoted.runtime.impl.QuotesImpl.asExprOf(QuotesImpl.scala:71)
| at scala.quoted.runtime.impl.QuotesImpl$reflect$TreeMethods$.asExprOf(QuotesImpl.scala:113)
| at scala.quoted.runtime.impl.QuotesImpl$reflect$TreeMethods$.asExprOf(QuotesImpl.scala:112)
| at test.Y$.testStuffImpl(Bar.scala:23)
||This location contains code that was inlined from Foo.scala:9
From this, we know that testStuffImpl is called as testStuffImpl[Nothing]. Therefore the code requires the following change to work (and should also use asExprOf)
Compiler version
3.1.0
Minimized code
Output
Expectation
The apply of the case class can be called and an object can be created.
PS: When using a proxy method to the apply, it works just fine.
The text was updated successfully, but these errors were encountered: