Skip to content

Commit a5d640e

Browse files
committed
Drop single case match in test
The syntax is no longer supported
1 parent 02617be commit a5d640e

File tree

1 file changed

+24
-24
lines changed
  • tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm

1 file changed

+24
-24
lines changed

tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm/Interpreter.scala

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@ class Interpreter[R <: Reflection & Singleton](reflect0: R) extends TreeInterpre
1717
// Best effort to try to create a proxy
1818
val sym = fn.symbol.owner
1919
if (sym.isClassDef) {
20-
sym.tree match case tree: ClassDef =>
21-
val parentSymbols = tree.parents.tail.map(_.asInstanceOf[TypeTree].symbol).head
22-
import java.lang.reflect._
23-
val handler: InvocationHandler = new InvocationHandler() {
24-
25-
def invoke(proxy: Object, method: Method, args: scala.Array[Object]): Object = {
26-
if (LOG) {
27-
val proxyString = if (method.getName == "toString") method.invoke(this) else proxy.toString
28-
println(s"%> proxy call `$method` on `$proxyString` with args=${if (args == null) Nil else args.toList}")
29-
}
30-
31-
// println(method)
32-
val symbol = sym.methods.find(_.name == method.getName).get
33-
34-
if (symbol.isDefinedInCurrentRun) {
35-
val argsList = if (args == null) Nil else args.toList
36-
interpretCall(this, symbol, argsList).asInstanceOf[Object]
37-
}
38-
else {
39-
assert(method.getClass == classOf[Object])
40-
method.invoke(this, args: _*)
41-
}
42-
}
43-
20+
sym.tree match
21+
case tree: ClassDef =>
22+
val parentSymbols = tree.parents.tail.map(_.asInstanceOf[TypeTree].symbol).head
23+
import java.lang.reflect._
24+
val handler: InvocationHandler = new InvocationHandler() {
25+
26+
def invoke(proxy: Object, method: Method, args: scala.Array[Object]): Object = {
27+
if (LOG) {
28+
val proxyString = if (method.getName == "toString") method.invoke(this) else proxy.toString
29+
println(s"%> proxy call `$method` on `$proxyString` with args=${if (args == null) Nil else args.toList}")
30+
}
31+
32+
// println(method)
33+
val symbol = sym.methods.find(_.name == method.getName).get
34+
35+
if (symbol.isDefinedInCurrentRun) {
36+
val argsList = if (args == null) Nil else args.toList
37+
interpretCall(this, symbol, argsList).asInstanceOf[Object]
38+
}
39+
else {
40+
assert(method.getClass == classOf[Object])
41+
method.invoke(this, args: _*)
42+
}
43+
}
4444
}
4545
val proxyClass: Class[_] = Proxy.getProxyClass(getClass.getClassLoader, jvmReflection.loadClass(parentSymbols.fullName))
4646
proxyClass.getConstructor(classOf[InvocationHandler]).newInstance(handler);

0 commit comments

Comments
 (0)