From cfbdbd821e5115af7be8182e1d51e8155918ff86 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Tue, 29 Jan 2019 20:28:14 +0100
Subject: [PATCH 1/2] Fix build more
Complete #5818.
---
compiler/test-resources/repl/i5345 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/compiler/test-resources/repl/i5345 b/compiler/test-resources/repl/i5345
index 655258018144..458aab906978 100644
--- a/compiler/test-resources/repl/i5345
+++ b/compiler/test-resources/repl/i5345
@@ -1,2 +1,2 @@
-scala> def x[A, B]: ImplicitConverter[A, B] = _ => ???
-def x[A, B] => ImplicitConverter[A, B]
+scala> def x[A, B]: Conversion[A, B] = _ => ???
+def x[A, B] => Conversion[A, B]
From f079dd307361e63dc222fee7885a177f291f0197 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Tue, 29 Jan 2019 20:58:29 +0100
Subject: [PATCH 2/2] Fix build: Port #5797 to new syntax from #5458
---
.../interpreter/TastyInterpreter.scala | 4 ++--
.../interpreter/TreeInterpreter.scala | 22 +++++++++----------
.../interpreter/jvm/JVMReflection.scala | 20 ++++++++---------
3 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TastyInterpreter.scala b/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TastyInterpreter.scala
index 9eaf6c02dc9d..ba0c87ce5191 100644
--- a/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TastyInterpreter.scala
+++ b/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TastyInterpreter.scala
@@ -14,7 +14,7 @@ class TastyInterpreter extends TastyConsumer {
case DefDef("main", _, _, _, Some(rhs)) =>
val interpreter = new jvm.Interpreter(reflect)
- interpreter.eval(rhs)(Map.empty)
+ interpreter.eval(rhs) with Map.empty
// TODO: recurse only for PackageDef, ClassDef
case tree =>
super.traverseTree(tree)
@@ -22,4 +22,4 @@ class TastyInterpreter extends TastyConsumer {
}
Traverser.traverseTree(root)(reflect.rootContext)
}
-}
\ No newline at end of file
+}
diff --git a/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala b/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala
index 8df8d08d65b2..3ce4283ff4f6 100644
--- a/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala
+++ b/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala
@@ -13,19 +13,19 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) {
/** Representation of objects and values in the interpreter */
type AbstractAny
- type Result = implicit Env => AbstractAny
+ type Result = Env |=> AbstractAny
def localValue(sym: Symbol)(implicit env: Env): LocalValue = env(sym)
- def withLocalValue[T](sym: Symbol, value: LocalValue)(in: implicit Env => T)(implicit env: Env): T =
- in(env.updated(sym, value))
+ def withLocalValue[T](sym: Symbol, value: LocalValue)(in: Env |=> T)(implicit env: Env): T =
+ in with env.updated(sym, value)
- def withLocalValues[T](syms: List[Symbol], values: List[LocalValue])(in: implicit Env => T)(implicit env: Env): T =
- in(env ++ syms.zip(values))
+ def withLocalValues[T](syms: List[Symbol], values: List[LocalValue])(in: Env |=> T)(implicit env: Env): T =
+ in with (env ++ syms.zip(values))
- def interpretCall(instance: AbstractAny, sym: DefSymbol, args: List[AbstractAny]): Result = {
+ def interpretCall(inst: AbstractAny, sym: DefSymbol, args: List[AbstractAny]): Result = {
// TODO
- // withLocalValue(`this`, instance) {
+ // withLocalValue(`this`, inst) {
val syms = sym.tree.paramss.headOption.getOrElse(Nil).map(_.symbol)
withLocalValues(syms, args.map(LocalValue.valFrom(_))) {
eval(sym.tree.rhs.get)
@@ -65,7 +65,7 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) {
def interpretBlock(stats: List[Statement], expr: Term): Result = {
val newEnv = stats.foldLeft(implicitly[Env])((accEnv, stat) => stat match {
case ValDef(name, tpt, Some(rhs)) =>
- def evalRhs = eval(rhs)(accEnv)
+ def evalRhs = eval(rhs) with accEnv
val evalRef: LocalValue =
if (stat.symbol.flags.is(Flags.Lazy)) LocalValue.lazyValFrom(evalRhs)
else if (stat.symbol.flags.is(Flags.Mutable)) LocalValue.varFrom(evalRhs)
@@ -76,10 +76,10 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) {
// TODO: record the environment for closure purposes
accEnv
case stat =>
- eval(stat)(accEnv)
+ eval(stat) with accEnv
accEnv
})
- eval(expr)(newEnv)
+ eval(expr) with newEnv
}
def interpretUnit(): AbstractAny
@@ -213,4 +213,4 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) {
case _ => None
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm/JVMReflection.scala b/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm/JVMReflection.scala
index 3983dd298113..a18d76ea208f 100644
--- a/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm/JVMReflection.scala
+++ b/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm/JVMReflection.scala
@@ -47,22 +47,22 @@ class JVMReflection[R <: Reflection & Singleton](val reflect: R) {
}
def interpretStaticVal(moduleClass: Symbol, fn: Symbol): Object = {
- val instance = loadModule(moduleClass)
+ val inst = loadModule(moduleClass)
val name = fn.name
- val method = getMethod(instance.getClass, name, Nil)
- method.invoke(instance)
+ val method = getMethod(inst.getClass, name, Nil)
+ method.invoke(inst)
}
def interpretStaticMethodCall(moduleClass: Symbol, fn: Symbol, args: List[Object]): Object = {
// TODO can we use interpretMethodCall instead?
- val instance = loadModule(moduleClass)
- val method = getMethod(instance.getClass, fn.name, paramsSig(fn))
- method.invoke(instance, args: _*)
+ val inst = loadModule(moduleClass)
+ val method = getMethod(inst.getClass, fn.name, paramsSig(fn))
+ method.invoke(inst, args: _*)
}
- def interpretMethodCall(instance: Object, fn: Symbol, args: List[Object]): Object = {
- val method = getMethod(instance.getClass, fn.name, paramsSig(fn))
- method.invoke(instance, args: _*)
+ def interpretMethodCall(inst: Object, fn: Symbol, args: List[Object]): Object = {
+ val method = getMethod(inst.getClass, fn.name, paramsSig(fn))
+ method.invoke(inst, args: _*)
}
def interpretNew(fn: Symbol, args: List[Object]): Object = {
@@ -113,4 +113,4 @@ class JVMReflection[R <: Reflection & Singleton](val reflect: R) {
}
private def extraMsg = ". The most common reason for that is that you apply macros in the compilation run that defines them"
-}
\ No newline at end of file
+}