summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/reflect/runtime/ToolBoxes.scala7
-rw-r--r--test/files/run/t5239.check2
-rw-r--r--test/files/run/t5266_1.check (renamed from test/pending/run/t5266_1.check)0
-rw-r--r--test/files/run/t5266_1.scala (renamed from test/pending/run/t5266_1.scala)9
-rw-r--r--test/files/run/t5266_2.check (renamed from test/pending/run/t5266_2.check)0
-rw-r--r--test/files/run/t5266_2.scala (renamed from test/pending/run/t5266_2.scala)2
6 files changed, 7 insertions, 13 deletions
diff --git a/src/compiler/scala/reflect/runtime/ToolBoxes.scala b/src/compiler/scala/reflect/runtime/ToolBoxes.scala
index e617239398..1114c908e6 100644
--- a/src/compiler/scala/reflect/runtime/ToolBoxes.scala
+++ b/src/compiler/scala/reflect/runtime/ToolBoxes.scala
@@ -42,11 +42,10 @@ trait ToolBoxes extends { self: Universe =>
def wrapInObject(expr: Tree, fvs: List[Symbol]): ModuleDef = {
val obj = EmptyPackageClass.newModule(NoPosition, nextWrapperModuleName())
- val minfo = ClassInfoType(List(ObjectClass.tpe), new Scope, obj.moduleClass)
+ val minfo = ClassInfoType(List(ObjectClass.tpe, ScalaObjectClass.tpe), new Scope, obj.moduleClass)
obj.moduleClass setInfo minfo
obj setInfo obj.moduleClass.tpe
val meth = obj.moduleClass.newMethod(NoPosition, wrapperMethodName)
- meth setFlag Flags.STATIC
def makeParam(fv: Symbol) = meth.newValueParameter(NoPosition, fv.name) setInfo fv.tpe
meth setInfo MethodType(fvs map makeParam, expr.tpe)
minfo.decls enter meth
@@ -92,7 +91,9 @@ trait ToolBoxes extends { self: Universe =>
if (settings.debug.value) println("generated: "+className)
val jclazz = jClass.forName(moduleFileName(className), true, classLoader)
val jmeth = jclazz.getDeclaredMethods.find(_.getName == wrapperMethodName).get
- val result = jmeth.invoke(null, fvs map (sym => sym.asInstanceOf[FreeVar].value.asInstanceOf[AnyRef]): _*)
+ val jfield = jclazz.getDeclaredFields.find(_.getName == NameTransformer.MODULE_INSTANCE_NAME).get
+ val singleton = jfield.get(null)
+ val result = jmeth.invoke(singleton, fvs map (sym => sym.asInstanceOf[FreeVar].value.asInstanceOf[AnyRef]): _*)
if (etpe.typeSymbol != FunctionClass(0)) result
else {
val applyMeth = result.getClass.getMethod("apply")
diff --git a/test/files/run/t5239.check b/test/files/run/t5239.check
index db5778f95b..40fe6a76e7 100644
--- a/test/files/run/t5239.check
+++ b/test/files/run/t5239.check
@@ -6,7 +6,7 @@ package <empty> {
__wrapper$1.super.this();
()
};
- <static> def wrapper(): Int = 2
+ def wrapper(): Int = 2
}
}
diff --git a/test/pending/run/t5266_1.check b/test/files/run/t5266_1.check
index 3feac16a0b..3feac16a0b 100644
--- a/test/pending/run/t5266_1.check
+++ b/test/files/run/t5266_1.check
diff --git a/test/pending/run/t5266_1.scala b/test/files/run/t5266_1.scala
index 06a81a04ea..18e288e685 100644
--- a/test/pending/run/t5266_1.scala
+++ b/test/files/run/t5266_1.scala
@@ -8,14 +8,7 @@ object Test extends App {
println(x)
};
- val settings = new Settings
- settings.debug.value = true
- settings.Xshowtrees.value = true
- settings.Xprint.value = List("typer")
- settings.printtypes.value = true
- settings.Ytyperdebug.value = true
-
- val reporter = new ConsoleReporter(settings)
+ val reporter = new ConsoleReporter(new Settings)
val toolbox = new ToolBox(reporter)
val ttree = toolbox.typeCheck(code.tree)
val evaluated = toolbox.runExpr(ttree)
diff --git a/test/pending/run/t5266_2.check b/test/files/run/t5266_2.check
index 3feac16a0b..3feac16a0b 100644
--- a/test/pending/run/t5266_2.check
+++ b/test/files/run/t5266_2.check
diff --git a/test/pending/run/t5266_2.scala b/test/files/run/t5266_2.scala
index cd841da021..eb319583f8 100644
--- a/test/pending/run/t5266_2.scala
+++ b/test/files/run/t5266_2.scala
@@ -9,7 +9,7 @@ object Test extends App {
println(y)
};
- val reporter = new ConsoleReporter(settings)
+ val reporter = new ConsoleReporter(new Settings)
val toolbox = new ToolBox(reporter)
val ttree = toolbox.typeCheck(code.tree)
val evaluated = toolbox.runExpr(ttree)