summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/t6215.scala1
-rw-r--r--test/files/pos/t6485a/Macros_1.scala5
-rw-r--r--test/files/pos/t6485a/Test_2.scala5
-rw-r--r--test/files/pos/t6485b/Test.scala10
-rw-r--r--test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-typecheck-implicitsdisabled.check2
-rw-r--r--test/files/run/reflection-implicit.scala2
-rw-r--r--test/files/run/reflection-magicsymbols-invoke.scala8
-rw-r--r--test/files/run/reflection-methodsymbol-params.scala16
-rw-r--r--test/files/run/reflection-valueclasses-magic.scala14
-rw-r--r--test/files/run/t6344.check16
11 files changed, 57 insertions, 24 deletions
diff --git a/test/files/pos/t6215.scala b/test/files/pos/t6215.scala
new file mode 100644
index 0000000000..2f66892b69
--- /dev/null
+++ b/test/files/pos/t6215.scala
@@ -0,0 +1 @@
+class Foo(val v: String) extends AnyVal { private def len = v.length ; def f = len }
diff --git a/test/files/pos/t6485a/Macros_1.scala b/test/files/pos/t6485a/Macros_1.scala
new file mode 100644
index 0000000000..85c2d5dbdb
--- /dev/null
+++ b/test/files/pos/t6485a/Macros_1.scala
@@ -0,0 +1,5 @@
+import scala.reflect.macros.Context
+
+object Macros {
+ def crash(c: Context): c.Expr[Unit] = c.universe.reify(())
+} \ No newline at end of file
diff --git a/test/files/pos/t6485a/Test_2.scala b/test/files/pos/t6485a/Test_2.scala
new file mode 100644
index 0000000000..54e260ac74
--- /dev/null
+++ b/test/files/pos/t6485a/Test_2.scala
@@ -0,0 +1,5 @@
+import scala.language.experimental.macros
+
+final class Ops[T](val x: T) extends AnyVal {
+ def f = macro Macros.crash
+}
diff --git a/test/files/pos/t6485b/Test.scala b/test/files/pos/t6485b/Test.scala
new file mode 100644
index 0000000000..382df1c453
--- /dev/null
+++ b/test/files/pos/t6485b/Test.scala
@@ -0,0 +1,10 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Context
+
+final class Ops[T](val x: T) extends AnyVal {
+ def f = macro Macros.crash
+}
+
+object Macros {
+ def crash(c: Context): c.Expr[Unit] = c.universe.reify(())
+} \ No newline at end of file
diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala
index 089f30f389..adecfcff17 100644
--- a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala
+++ b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala
@@ -11,7 +11,7 @@ object Test extends App {
val macrobody = Select(Ident(newTermName("Impls")), newTermName("foo"))
val macroparam = ValDef(NoMods, newTermName("x"), TypeTree(definitions.IntClass.toType), EmptyTree)
val macrodef = DefDef(Modifiers(MACRO), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody)
- val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(Apply(Select(Super(This(EmptyTypeName), EmptyTypeName), nme.CONSTRUCTOR), List())))
+ val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())))
val module = ModuleDef(NoMods, newTermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef)))
val macroapp = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42))))
val tree = Block(macrodef, module, macroapp)
diff --git a/test/files/run/macro-typecheck-implicitsdisabled.check b/test/files/run/macro-typecheck-implicitsdisabled.check
index 6cf25076a7..c4fa2c5c28 100644
--- a/test/files/run/macro-typecheck-implicitsdisabled.check
+++ b/test/files/run/macro-typecheck-implicitsdisabled.check
@@ -1,2 +1,2 @@
scala.this.Predef.any2ArrowAssoc[Int](1).->[Int](2)
-scala.reflect.internal.Types$TypeError: value -> is not a member of Int
+scala.reflect.macros.TypecheckException: value -> is not a member of Int
diff --git a/test/files/run/reflection-implicit.scala b/test/files/run/reflection-implicit.scala
index 637ef24e14..0bcb0bc3a0 100644
--- a/test/files/run/reflection-implicit.scala
+++ b/test/files/run/reflection-implicit.scala
@@ -9,7 +9,7 @@ class C {
object Test extends App {
val decls = typeOf[C].typeSymbol.typeSignature.declarations.sorted.toList.filter(sym => !sym.isTerm || (sym.isMethod && !sym.asMethod.isConstructor))
println(decls map (_.isImplicit))
- val param = decls.find(_.name.toString == "d").get.asMethod.params.last.head
+ val param = decls.find(_.name.toString == "d").get.asMethod.paramss.last.head
param.typeSignature
println(param.isImplicit)
} \ No newline at end of file
diff --git a/test/files/run/reflection-magicsymbols-invoke.scala b/test/files/run/reflection-magicsymbols-invoke.scala
index b38d1be7b2..5f39370708 100644
--- a/test/files/run/reflection-magicsymbols-invoke.scala
+++ b/test/files/run/reflection-magicsymbols-invoke.scala
@@ -2,6 +2,12 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe.definitions._
import scala.reflect.runtime.{currentMirror => cm}
+package scala {
+ object ExceptionUtils {
+ def unwrapThrowable(ex: Throwable): Throwable = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex)
+ }
+}
+
object Test extends App {
def key(sym: Symbol) = sym + ": " + sym.typeSignature
def test(tpe: Type, receiver: Any, method: String, args: Any*) {
@@ -13,7 +19,7 @@ object Test extends App {
println(result)
} catch {
case ex: Throwable =>
- val realex = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex)
+ val realex = scala.ExceptionUtils.unwrapThrowable(ex)
println(realex.getClass + ": " + realex.getMessage)
}
print(s"testing ${tpe.typeSymbol.name}.$method: ")
diff --git a/test/files/run/reflection-methodsymbol-params.scala b/test/files/run/reflection-methodsymbol-params.scala
index 7174c6f49b..45b1f9628f 100644
--- a/test/files/run/reflection-methodsymbol-params.scala
+++ b/test/files/run/reflection-methodsymbol-params.scala
@@ -13,12 +13,12 @@ class C {
}
object Test extends App {
- println(typeOf[C].member(newTermName("x1")).asMethod.params)
- println(typeOf[C].member(newTermName("x2")).asMethod.params)
- println(typeOf[C].member(newTermName("x3")).asMethod.params)
- println(typeOf[C].member(newTermName("x4")).asMethod.params)
- println(typeOf[C].member(newTermName("y1")).asMethod.params)
- println(typeOf[C].member(newTermName("y2")).asMethod.params)
- println(typeOf[C].member(newTermName("y3")).asMethod.params)
- println(typeOf[C].member(newTermName("y4")).asMethod.params)
+ println(typeOf[C].member(newTermName("x1")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("x2")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("x3")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("x4")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("y1")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("y2")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("y3")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("y4")).asMethod.paramss)
} \ No newline at end of file
diff --git a/test/files/run/reflection-valueclasses-magic.scala b/test/files/run/reflection-valueclasses-magic.scala
index f9feb2d504..c4a26e460a 100644
--- a/test/files/run/reflection-valueclasses-magic.scala
+++ b/test/files/run/reflection-valueclasses-magic.scala
@@ -3,11 +3,17 @@ import scala.reflect.runtime.universe.definitions._
import scala.reflect.runtime.{currentMirror => cm}
import scala.reflect.ClassTag
+package scala {
+ object ExceptionUtils {
+ def unwrapThrowable(ex: Throwable): Throwable = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex)
+ }
+}
+
object Test extends App {
def key(sym: Symbol) = {
sym match {
// initialize parameter symbols
- case meth: MethodSymbol => meth.params.flatten.map(_.typeSignature)
+ case meth: MethodSymbol => meth.paramss.flatten.map(_.typeSignature)
}
sym + ": " + sym.typeSignature
}
@@ -35,14 +41,14 @@ object Test extends App {
println(s"[${result.getClass}] =======> $result")
} catch {
case ex: Throwable =>
- val realex = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex)
+ val realex = scala.ExceptionUtils.unwrapThrowable(ex)
println(realex.getClass + ": " + realex.getMessage)
}
val meth = tpe.declaration(newTermName(method).encodedName.toTermName)
val testees = if (meth.isMethod) List(meth.asMethod) else meth.asTerm.alternatives.map(_.asMethod)
testees foreach (testee => {
- val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.params.flatten.apply(i).typeSignature) }
- print(s"testing ${tpe.typeSymbol.name}.$method(${testee.params.flatten.map(_.typeSignature).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ")
+ val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.paramss.flatten.apply(i).typeSignature) }
+ print(s"testing ${tpe.typeSymbol.name}.$method(${testee.paramss.flatten.map(_.typeSignature).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ")
wrap(cm.reflect(receiver).reflectMethod(testee)(convertedArgs: _*))
})
}
diff --git a/test/files/run/t6344.check b/test/files/run/t6344.check
index 5ac04d0320..8d9adac849 100644
--- a/test/files/run/t6344.check
+++ b/test/files/run/t6344.check
@@ -101,14 +101,14 @@ public int ValueInt.x()
public int ValueInt.x()
public java.lang.Object ValueInt.x()
public java.lang.Object ValueInt.x()
-public static Gen ValueInt.extension$plus(int,Gen,Gen)
-public static Gen<java.lang.Object> ValueInt.extension$plus(int,Gen<java.lang.Object>,Gen<java.lang.Object>)
-public static boolean ValueInt.extension$equals(int,java.lang.Object)
-public static boolean ValueInt.extension$equals(int,java.lang.Object)
-public static int ValueInt.extension$hashCode(int)
-public static int ValueInt.extension$hashCode(int)
-public static int ValueInt.extension$iplus(int,int,int)
-public static int ValueInt.extension$iplus(int,int,int)
+public static Gen ValueInt.plus$extension(int,Gen,Gen)
+public static Gen<java.lang.Object> ValueInt.plus$extension(int,Gen<java.lang.Object>,Gen<java.lang.Object>)
+public static boolean ValueInt.equals$extension(int,java.lang.Object)
+public static boolean ValueInt.equals$extension(int,java.lang.Object)
+public static int ValueInt.hashCode$extension(int)
+public static int ValueInt.hashCode$extension(int)
+public static int ValueInt.iplus$extension(int,int,int)
+public static int ValueInt.iplus$extension(int,int,int)
RefInt
public Gen RefInt.plus(Gen,Gen)