Skip to content

Conversation

@WojciechMazur
Copy link
Contributor

Fixes #24799

scala3-staging was not tested, at least not since scala3-repl seperation, it actually is currently broken when using from REPL:

WIP - blocked by classpath issues
A REPL-staging test currently fails, I believe it's the same underlying issue as with REPL classpath separation and might require a larger refactor

[info] Test scala.quoted.staging.repl.StagingScriptedReplTests.replStagingTests started
  scala> import scala.quoted._
  scala> import quoted.staging.{Compiler => StagingCompiler, _}
  scala> implicit def compiler: StagingCompiler = StagingCompiler.make(getClass.getClassLoader)
  def compiler: scala.quoted.staging.Compiler
  scala> def v(using Quotes) = '{ (if true then Some(1) else None).map(v => v+1) }
  def v(using x$1: scala.quoted.Quotes): scala.quoted.Expr[Option[Int]]
  scala> scala.quoted.staging.withQuotes(v.show)
  val res0: String = "(if (true) scala.Some.apply[scala.Int](1) else scala.None).map[scala.Int](((v: scala.Int) => v.+(1)))"
  scala> scala.quoted.staging.run(v)
+ java.lang.IncompatibleClassChangeError: Class Generated$Code$From$Quoted$$Lambda/0x0000000800a50208 does not implement the requested interface scala.Function1
+   at scala.Option.map(Option.scala:244)
+   at Generated$Code$From$Quoted.apply(<quoted.Expr>:1)
+   at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
+   at java.lang.reflect.Method.invoke(Method.java:580)
+   at scala.quoted.staging.QuoteDriver.run(QuoteDriver.scala:70)
+   at scala.quoted.staging.Compiler$$anon$1.run(Compiler.scala:50)
+   at scala.quoted.staging.package$.run(staging.scala:19)
+   ... 75 elided
- val res1: Option[Int] = Some(2)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renable staging tests

1 participant