Skip to content

Commit f079dd3

Browse files
committed
Fix build: Port #5797 to new syntax from #5458
1 parent cfbdbd8 commit f079dd3

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ class TastyInterpreter extends TastyConsumer {
1414
case DefDef("main", _, _, _, Some(rhs)) =>
1515
val interpreter = new jvm.Interpreter(reflect)
1616

17-
interpreter.eval(rhs)(Map.empty)
17+
interpreter.eval(rhs) with Map.empty
1818
// TODO: recurse only for PackageDef, ClassDef
1919
case tree =>
2020
super.traverseTree(tree)
2121
}
2222
}
2323
Traverser.traverseTree(root)(reflect.rootContext)
2424
}
25-
}
25+
}

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) {
1313
/** Representation of objects and values in the interpreter */
1414
type AbstractAny
1515

16-
type Result = implicit Env => AbstractAny
16+
type Result = Env |=> AbstractAny
1717

1818
def localValue(sym: Symbol)(implicit env: Env): LocalValue = env(sym)
1919

20-
def withLocalValue[T](sym: Symbol, value: LocalValue)(in: implicit Env => T)(implicit env: Env): T =
21-
in(env.updated(sym, value))
20+
def withLocalValue[T](sym: Symbol, value: LocalValue)(in: Env |=> T)(implicit env: Env): T =
21+
in with env.updated(sym, value)
2222

23-
def withLocalValues[T](syms: List[Symbol], values: List[LocalValue])(in: implicit Env => T)(implicit env: Env): T =
24-
in(env ++ syms.zip(values))
23+
def withLocalValues[T](syms: List[Symbol], values: List[LocalValue])(in: Env |=> T)(implicit env: Env): T =
24+
in with (env ++ syms.zip(values))
2525

26-
def interpretCall(instance: AbstractAny, sym: DefSymbol, args: List[AbstractAny]): Result = {
26+
def interpretCall(inst: AbstractAny, sym: DefSymbol, args: List[AbstractAny]): Result = {
2727
// TODO
28-
// withLocalValue(`this`, instance) {
28+
// withLocalValue(`this`, inst) {
2929
val syms = sym.tree.paramss.headOption.getOrElse(Nil).map(_.symbol)
3030
withLocalValues(syms, args.map(LocalValue.valFrom(_))) {
3131
eval(sym.tree.rhs.get)
@@ -65,7 +65,7 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) {
6565
def interpretBlock(stats: List[Statement], expr: Term): Result = {
6666
val newEnv = stats.foldLeft(implicitly[Env])((accEnv, stat) => stat match {
6767
case ValDef(name, tpt, Some(rhs)) =>
68-
def evalRhs = eval(rhs)(accEnv)
68+
def evalRhs = eval(rhs) with accEnv
6969
val evalRef: LocalValue =
7070
if (stat.symbol.flags.is(Flags.Lazy)) LocalValue.lazyValFrom(evalRhs)
7171
else if (stat.symbol.flags.is(Flags.Mutable)) LocalValue.varFrom(evalRhs)
@@ -76,10 +76,10 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) {
7676
// TODO: record the environment for closure purposes
7777
accEnv
7878
case stat =>
79-
eval(stat)(accEnv)
79+
eval(stat) with accEnv
8080
accEnv
8181
})
82-
eval(expr)(newEnv)
82+
eval(expr) with newEnv
8383
}
8484

8585
def interpretUnit(): AbstractAny
@@ -213,4 +213,4 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) {
213213
case _ => None
214214
}
215215
}
216-
}
216+
}

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

+10-10
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,22 @@ class JVMReflection[R <: Reflection & Singleton](val reflect: R) {
4747
}
4848

4949
def interpretStaticVal(moduleClass: Symbol, fn: Symbol): Object = {
50-
val instance = loadModule(moduleClass)
50+
val inst = loadModule(moduleClass)
5151
val name = fn.name
52-
val method = getMethod(instance.getClass, name, Nil)
53-
method.invoke(instance)
52+
val method = getMethod(inst.getClass, name, Nil)
53+
method.invoke(inst)
5454
}
5555

5656
def interpretStaticMethodCall(moduleClass: Symbol, fn: Symbol, args: List[Object]): Object = {
5757
// TODO can we use interpretMethodCall instead?
58-
val instance = loadModule(moduleClass)
59-
val method = getMethod(instance.getClass, fn.name, paramsSig(fn))
60-
method.invoke(instance, args: _*)
58+
val inst = loadModule(moduleClass)
59+
val method = getMethod(inst.getClass, fn.name, paramsSig(fn))
60+
method.invoke(inst, args: _*)
6161
}
6262

63-
def interpretMethodCall(instance: Object, fn: Symbol, args: List[Object]): Object = {
64-
val method = getMethod(instance.getClass, fn.name, paramsSig(fn))
65-
method.invoke(instance, args: _*)
63+
def interpretMethodCall(inst: Object, fn: Symbol, args: List[Object]): Object = {
64+
val method = getMethod(inst.getClass, fn.name, paramsSig(fn))
65+
method.invoke(inst, args: _*)
6666
}
6767

6868
def interpretNew(fn: Symbol, args: List[Object]): Object = {
@@ -113,4 +113,4 @@ class JVMReflection[R <: Reflection & Singleton](val reflect: R) {
113113
}
114114

115115
private def extraMsg = ". The most common reason for that is that you apply macros in the compilation run that defines them"
116-
}
116+
}

0 commit comments

Comments
 (0)