summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/macro-reify-chained1/Impls_Macros_1.scala (renamed from test/files/run/macro-reify-nested-b/Impls_Macros_1.scala)3
-rw-r--r--test/files/run/macro-reify-chained1/Test_2.scala9
-rw-r--r--test/files/run/macro-reify-chained2/Impls_Macros_1.scala47
-rw-r--r--test/files/run/macro-reify-chained2/Test_2.scala9
-rw-r--r--test/files/run/macro-reify-nested-a.flags1
-rw-r--r--test/files/run/macro-reify-nested-a1/Impls_Macros_1.scala (renamed from test/files/run/macro-reify-nested-a/Impls_Macros_1.scala)3
-rw-r--r--test/files/run/macro-reify-nested-a1/Test_2.scala (renamed from test/files/run/macro-reify-nested-a/Test_2.scala)5
-rw-r--r--test/files/run/macro-reify-nested-a2/Impls_Macros_1.scala47
-rw-r--r--test/files/run/macro-reify-nested-a2/Test_2.scala9
-rw-r--r--test/files/run/macro-reify-nested-b.flags1
-rw-r--r--test/files/run/macro-reify-nested-b1/Impls_Macros_1.scala47
-rw-r--r--test/files/run/macro-reify-nested-b1/Test_2.scala (renamed from test/files/run/macro-reify-nested-b/Test_2.scala)5
-rw-r--r--test/files/run/macro-reify-nested-b2/Impls_Macros_1.scala47
-rw-r--r--test/files/run/macro-reify-nested-b2/Test_2.scala9
-rw-r--r--test/files/run/t2251.flags1
-rw-r--r--test/files/run/t2251b.flags1
-rw-r--r--test/files/run/t4577.scala38
-rw-r--r--test/files/run/t6111.check1
-rw-r--r--test/files/run/t6111.scala2
-rw-r--r--test/files/run/t7185.check4
-rw-r--r--test/files/run/t8197.scala13
21 files changed, 297 insertions, 5 deletions
diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-chained1/Impls_Macros_1.scala
index 3bea04cead..7f877b2729 100644
--- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-chained1/Impls_Macros_1.scala
@@ -1,6 +1,7 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
case class Utils[C <: Context]( c:C ) {
import c.universe._
@@ -34,7 +35,7 @@ object QueryableMacros{
c.universe.reify{ Queryable.factory[S]( foo.splice )}
}
def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
- (c: scala.reflect.macros.blackbox.Context)
+ (c: Context)
(projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
}
class Queryable[T]{
diff --git a/test/files/run/macro-reify-chained1/Test_2.scala b/test/files/run/macro-reify-chained1/Test_2.scala
new file mode 100644
index 0000000000..2adb07b035
--- /dev/null
+++ b/test/files/run/macro-reify-chained1/Test_2.scala
@@ -0,0 +1,9 @@
+object Test extends App{
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(x => x).map(x => x)
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(x => x).map(x => x)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-chained2/Impls_Macros_1.scala b/test/files/run/macro-reify-chained2/Impls_Macros_1.scala
new file mode 100644
index 0000000000..965b191044
--- /dev/null
+++ b/test/files/run/macro-reify-chained2/Impls_Macros_1.scala
@@ -0,0 +1,47 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.macros.whitebox.Context
+import scala.language.experimental.macros
+
+case class Utils[C <: Context]( c:C ) {
+ import c.universe._
+ import c.{Tree=>_}
+ object removeDoubleReify extends c.universe.Transformer {
+ def apply( tree:Tree ) = transform(tree)
+ override def transform(tree: Tree): Tree = {
+ super.transform {
+ tree match {
+ case Apply(TypeApply(Select(_this, termname), _), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case Apply(Select(_this, termname), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case _ => tree
+ }
+ }
+ }
+ }
+}
+object QueryableMacros{
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ import c.universe._
+ import internal._
+ val element_type = implicitly[c.WeakTypeTag[S]].tpe
+ val foo = c.Expr[ru.Expr[Queryable[S]]](
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
+ Utils[c.type](c).removeDoubleReify(
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
+ ).asInstanceOf[Tree]
+ )))
+ c.universe.reify{ Queryable.factory[S]( foo.splice )}
+ }
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
+ (c: Context)
+ (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
+}
+class Queryable[T]{
+ def _map[S]( projection: T => S ) : Queryable[S] = ???
+ def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S]
+}
+object Queryable{
+ def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-chained2/Test_2.scala b/test/files/run/macro-reify-chained2/Test_2.scala
new file mode 100644
index 0000000000..2adb07b035
--- /dev/null
+++ b/test/files/run/macro-reify-chained2/Test_2.scala
@@ -0,0 +1,9 @@
+object Test extends App{
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(x => x).map(x => x)
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(x => x).map(x => x)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-a.flags b/test/files/run/macro-reify-nested-a.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-reify-nested-a.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a1/Impls_Macros_1.scala
index 3bea04cead..7f877b2729 100644
--- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-nested-a1/Impls_Macros_1.scala
@@ -1,6 +1,7 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
case class Utils[C <: Context]( c:C ) {
import c.universe._
@@ -34,7 +35,7 @@ object QueryableMacros{
c.universe.reify{ Queryable.factory[S]( foo.splice )}
}
def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
- (c: scala.reflect.macros.blackbox.Context)
+ (c: Context)
(projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
}
class Queryable[T]{
diff --git a/test/files/run/macro-reify-nested-a/Test_2.scala b/test/files/run/macro-reify-nested-a1/Test_2.scala
index fa0eb378af..b99c4c55e4 100644
--- a/test/files/run/macro-reify-nested-a/Test_2.scala
+++ b/test/files/run/macro-reify-nested-a1/Test_2.scala
@@ -1,4 +1,9 @@
object Test extends App{
val q : Queryable[Any] = new Queryable[Any]
q.map(e1 => q.map(e2=>e1))
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1))
+ }
} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-a2/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a2/Impls_Macros_1.scala
new file mode 100644
index 0000000000..965b191044
--- /dev/null
+++ b/test/files/run/macro-reify-nested-a2/Impls_Macros_1.scala
@@ -0,0 +1,47 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.macros.whitebox.Context
+import scala.language.experimental.macros
+
+case class Utils[C <: Context]( c:C ) {
+ import c.universe._
+ import c.{Tree=>_}
+ object removeDoubleReify extends c.universe.Transformer {
+ def apply( tree:Tree ) = transform(tree)
+ override def transform(tree: Tree): Tree = {
+ super.transform {
+ tree match {
+ case Apply(TypeApply(Select(_this, termname), _), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case Apply(Select(_this, termname), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case _ => tree
+ }
+ }
+ }
+ }
+}
+object QueryableMacros{
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ import c.universe._
+ import internal._
+ val element_type = implicitly[c.WeakTypeTag[S]].tpe
+ val foo = c.Expr[ru.Expr[Queryable[S]]](
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
+ Utils[c.type](c).removeDoubleReify(
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
+ ).asInstanceOf[Tree]
+ )))
+ c.universe.reify{ Queryable.factory[S]( foo.splice )}
+ }
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
+ (c: Context)
+ (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
+}
+class Queryable[T]{
+ def _map[S]( projection: T => S ) : Queryable[S] = ???
+ def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S]
+}
+object Queryable{
+ def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-a2/Test_2.scala b/test/files/run/macro-reify-nested-a2/Test_2.scala
new file mode 100644
index 0000000000..b99c4c55e4
--- /dev/null
+++ b/test/files/run/macro-reify-nested-a2/Test_2.scala
@@ -0,0 +1,9 @@
+object Test extends App{
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1))
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-b.flags b/test/files/run/macro-reify-nested-b.flags
deleted file mode 100644
index cd66464f2f..0000000000
--- a/test/files/run/macro-reify-nested-b.flags
+++ /dev/null
@@ -1 +0,0 @@
--language:experimental.macros \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-b1/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b1/Impls_Macros_1.scala
new file mode 100644
index 0000000000..7f877b2729
--- /dev/null
+++ b/test/files/run/macro-reify-nested-b1/Impls_Macros_1.scala
@@ -0,0 +1,47 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
+
+case class Utils[C <: Context]( c:C ) {
+ import c.universe._
+ import c.{Tree=>_}
+ object removeDoubleReify extends c.universe.Transformer {
+ def apply( tree:Tree ) = transform(tree)
+ override def transform(tree: Tree): Tree = {
+ super.transform {
+ tree match {
+ case Apply(TypeApply(Select(_this, termname), _), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case Apply(Select(_this, termname), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case _ => tree
+ }
+ }
+ }
+ }
+}
+object QueryableMacros{
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ import c.universe._
+ import internal._
+ val element_type = implicitly[c.WeakTypeTag[S]].tpe
+ val foo = c.Expr[ru.Expr[Queryable[S]]](
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
+ Utils[c.type](c).removeDoubleReify(
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
+ ).asInstanceOf[Tree]
+ )))
+ c.universe.reify{ Queryable.factory[S]( foo.splice )}
+ }
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
+ (c: Context)
+ (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
+}
+class Queryable[T]{
+ def _map[S]( projection: T => S ) : Queryable[S] = ???
+ def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S]
+}
+object Queryable{
+ def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-b/Test_2.scala b/test/files/run/macro-reify-nested-b1/Test_2.scala
index fa13f57ffb..b199036349 100644
--- a/test/files/run/macro-reify-nested-b/Test_2.scala
+++ b/test/files/run/macro-reify-nested-b1/Test_2.scala
@@ -1,4 +1,9 @@
object Test extends App{
val q : Queryable[Any] = new Queryable[Any]
q.map(e1 => q.map(e2=>e1).map(e2=>e1))
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1).map(e2=>e1))
+ }
} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-b2/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b2/Impls_Macros_1.scala
new file mode 100644
index 0000000000..965b191044
--- /dev/null
+++ b/test/files/run/macro-reify-nested-b2/Impls_Macros_1.scala
@@ -0,0 +1,47 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.macros.whitebox.Context
+import scala.language.experimental.macros
+
+case class Utils[C <: Context]( c:C ) {
+ import c.universe._
+ import c.{Tree=>_}
+ object removeDoubleReify extends c.universe.Transformer {
+ def apply( tree:Tree ) = transform(tree)
+ override def transform(tree: Tree): Tree = {
+ super.transform {
+ tree match {
+ case Apply(TypeApply(Select(_this, termname), _), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case Apply(Select(_this, termname), reification::Nil )
+ if termname.toString == "factory" => c.unreifyTree(reification)
+ case _ => tree
+ }
+ }
+ }
+ }
+}
+object QueryableMacros{
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ import c.universe._
+ import internal._
+ val element_type = implicitly[c.WeakTypeTag[S]].tpe
+ val foo = c.Expr[ru.Expr[Queryable[S]]](
+ c.reifyTree( gen.mkRuntimeUniverseRef, EmptyTree, c.typecheck(
+ Utils[c.type](c).removeDoubleReify(
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
+ ).asInstanceOf[Tree]
+ )))
+ c.universe.reify{ Queryable.factory[S]( foo.splice )}
+ }
+ def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
+ (c: Context)
+ (projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
+}
+class Queryable[T]{
+ def _map[S]( projection: T => S ) : Queryable[S] = ???
+ def map[S]( projection: T => S ) : Queryable[S] = macro QueryableMacros.map[T,S]
+}
+object Queryable{
+ def factory[S]( projection:ru.Expr[Queryable[S]] ) : Queryable[S] = null
+} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-b2/Test_2.scala b/test/files/run/macro-reify-nested-b2/Test_2.scala
new file mode 100644
index 0000000000..b199036349
--- /dev/null
+++ b/test/files/run/macro-reify-nested-b2/Test_2.scala
@@ -0,0 +1,9 @@
+object Test extends App{
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1).map(e2=>e1))
+
+ locally {
+ val q : Queryable[Any] = new Queryable[Any]
+ q.map(e1 => q.map(e2=>e1).map(e2=>e1))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t2251.flags b/test/files/run/t2251.flags
new file mode 100644
index 0000000000..19243266d1
--- /dev/null
+++ b/test/files/run/t2251.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/test/files/run/t2251b.flags b/test/files/run/t2251b.flags
new file mode 100644
index 0000000000..19243266d1
--- /dev/null
+++ b/test/files/run/t2251b.flags
@@ -0,0 +1 @@
+-Xstrict-inference \ No newline at end of file
diff --git a/test/files/run/t4577.scala b/test/files/run/t4577.scala
new file mode 100644
index 0000000000..b08100d3ea
--- /dev/null
+++ b/test/files/run/t4577.scala
@@ -0,0 +1,38 @@
+object Test {
+ val bippy = new Symbol("bippy")
+ val imposter = new Symbol("bippy")
+ val notBippy = new Symbol("not-bippy")
+ val syms = List(bippy, imposter, notBippy)
+
+ // the equals method should only be used for case `bippy`,
+ // for the singleton type pattern, case _: bippy.type, the spec mandates `bippy eq _` as the test
+ class Symbol(val name: String) {
+ override def equals(other: Any) = other match {
+ case x: Symbol => name == x.name
+ case _ => false
+ }
+ override def toString = name
+ }
+
+ // TODO: test bytecode equality for f and fDirect (and g and gDirect),
+ // for now the optimizer doesn't quite get from `f` to `fDirect`
+ def f(s: Symbol) = s match {
+ case _: bippy.type => true
+ case _ => false
+ }
+ def fDirect(s: Symbol) = bippy eq s
+
+ def g(s: Symbol) = s match {
+ case _: bippy.type => 1
+ case `bippy` => 2
+ case _ => 3
+ }
+ def gDirect(s: Symbol) = if (bippy eq s) 1 else if (bippy == s) 2 else 3
+
+ def main(args: Array[String]): Unit = {
+ // `syms map f` should be: true false false
+ assert(syms forall (s => f(s) == fDirect(s)))
+ // `syms map g` should be: 1 2 3
+ assert(syms forall (s => g(s) == gDirect(s)))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t6111.check b/test/files/run/t6111.check
index 7fd2e33526..1f23a87f73 100644
--- a/test/files/run/t6111.check
+++ b/test/files/run/t6111.check
@@ -1,2 +1,3 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
(8,8)
(x,x)
diff --git a/test/files/run/t6111.scala b/test/files/run/t6111.scala
index 7cceea1d09..c0bcf17a07 100644
--- a/test/files/run/t6111.scala
+++ b/test/files/run/t6111.scala
@@ -1,3 +1,5 @@
+// SI-6675 DEPRECATED AUTO-TUPLING BECAUSE BAD IDEA -- MEAMAXIMACULPA
+// TODO: remove this test case in 2.12, when the deprecation will go into effect and this will no longer compile
// slightly overkill, but a good test case for implicit resolution in extractor calls,
// along with the real fix: an extractor pattern with 1 sub-pattern should type check for all extractors
// that return Option[T], whatever T (even if it's a tuple)
diff --git a/test/files/run/t7185.check b/test/files/run/t7185.check
index 2b4adf36b4..ebf85b731f 100644
--- a/test/files/run/t7185.check
+++ b/test/files/run/t7185.check
@@ -24,7 +24,9 @@ tree: reflect.runtime.universe.Apply =
scala> {val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typecheck(tree): Any}
res0: Any =
{
- $read.O.apply()
+ {
+ $read.O.apply()
+ }
}
scala>
diff --git a/test/files/run/t8197.scala b/test/files/run/t8197.scala
new file mode 100644
index 0000000000..5ca67088de
--- /dev/null
+++ b/test/files/run/t8197.scala
@@ -0,0 +1,13 @@
+// NOTE: according to SI-4728, this shouldn't even compile...
+class A
+class B
+// default arguments do not participate in overload resolution
+class Foo(val x: A = null) {
+ def this(bla: B*) {
+ this(new A)
+ }
+}
+
+object Test extends App {
+ assert((new Foo).x != null)
+}