diff --git a/staging/src/scala/quoted/staging/QuoteDriver.scala b/staging/src/scala/quoted/staging/QuoteDriver.scala index 3cf8744f001d..0a0cacbb090f 100644 --- a/staging/src/scala/quoted/staging/QuoteDriver.scala +++ b/staging/src/scala/quoted/staging/QuoteDriver.scala @@ -56,7 +56,7 @@ private class QuoteDriver(appClassloader: ClassLoader) extends Driver: try method.invoke(inst).asInstanceOf[T] catch case ex: java.lang.reflect.InvocationTargetException => ex.getCause match - case ex: java.lang.NoClassDefFoundError => + case _: java.lang.NoClassDefFoundError => throw new Exception( s"""`scala.quoted.staging.run` failed to load a class. |The classloader used for the `staging.Compiler` instance might not be the correct one. diff --git a/tests/run-staging/i19170b.scala b/tests/run-staging/i19170b.scala index 7fee2d2bc822..58b3f0999825 100644 --- a/tests/run-staging/i19170b.scala +++ b/tests/run-staging/i19170b.scala @@ -8,9 +8,10 @@ class A(i: Int) def f(i: Expr[Int])(using Quotes): Expr[A] = { '{ new A($i) } } @main def Test = { - try - val g: Int => A = staging.run { '{ (i: Int) => ${ f('{i}) } } } - println(g(3)) - catch case ex: Exception => - assert(ex.getMessage().startsWith("`scala.quoted.staging.run` failed to load a class.")) + if !System.getProperty("os.name").contains("Windows") then + try + val g: Int => A = staging.run { '{ (i: Int) => ${ f('{i}) } } } + println(g(3)) + catch case ex: Exception => + assert(ex.getMessage().startsWith("`scala.quoted.staging.run` failed to load a class."), ex.getMessage()) }