summaryrefslogtreecommitdiff
path: root/test/pending
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-09-09 12:25:26 -0700
committerPaul Phillips <paulp@improving.org>2013-09-09 12:53:32 -0700
commit288b12e48af3222134f3985b65e40f202af81df2 (patch)
tree87dedc0c05be446bf8ad76f1aa760af13ed145bb /test/pending
parentf342445f68654c1606871b5d7372621558731f65 (diff)
downloadscala-288b12e48af3222134f3985b65e40f202af81df2.tar.gz
scala-288b12e48af3222134f3985b65e40f202af81df2.tar.bz2
scala-288b12e48af3222134f3985b65e40f202af81df2.zip
Noise reduction + minor enhance in TreeCheckers.
Misc irrelevant work, which I can only offer as-is. It lowers the noise in -Ycheck:* output and performs some common sense chillaxes like not screaming ERROR IN INTERNAL CHECKING! WE'RE ALL GOING TO DIE! when a tree doesn't hit all nine points at the Jiffy Tree. You can see some reasonably well reduced symbol flailing if you run the included pending tests: test/partest --show-diff test/pending/pos/treecheckers Example output, Out of scope symbol reference { tree TypeTree Factory[Traversable] position OffsetPosition test/pending/pos/treecheckers/c5.scala:3 with sym ClassSymbol Factory: Factory[CC] and tpe ClassArgsTypeRef Factory[Traversable] encl(1) ModuleSymbol object Test5 ref to AbstractTypeSymbol X (<deferred> <param>) }
Diffstat (limited to 'test/pending')
-rw-r--r--test/pending/pos/treecheckers.flags1
-rw-r--r--test/pending/pos/treecheckers/c1.scala12
-rw-r--r--test/pending/pos/treecheckers/c2.scala1
-rw-r--r--test/pending/pos/treecheckers/c3.scala8
-rw-r--r--test/pending/pos/treecheckers/c4.scala9
-rw-r--r--test/pending/pos/treecheckers/c5.scala3
-rw-r--r--test/pending/pos/treecheckers/c6.scala4
7 files changed, 38 insertions, 0 deletions
diff --git a/test/pending/pos/treecheckers.flags b/test/pending/pos/treecheckers.flags
new file mode 100644
index 0000000000..5319681590
--- /dev/null
+++ b/test/pending/pos/treecheckers.flags
@@ -0,0 +1 @@
+-Ycheck:all \ No newline at end of file
diff --git a/test/pending/pos/treecheckers/c1.scala b/test/pending/pos/treecheckers/c1.scala
new file mode 100644
index 0000000000..b936839039
--- /dev/null
+++ b/test/pending/pos/treecheckers/c1.scala
@@ -0,0 +1,12 @@
+object Test1 {
+ def f[T](xs: Array[T]): Array[T] = xs match { case xs => xs }
+ // [check: patmat] The symbol, tpe or info of tree `(x) : Array[T]` refers to a out-of-scope symbol, type T. tree.symbol.ownerChain: value x
+ // [check: patmat] The symbol, tpe or info of tree `(x) : Array[T]` refers to a out-of-scope symbol, type T. tree.symbol.ownerChain: value x
+
+ def g[T](xs: Array[T]): Array[T] = {
+ val x1: Array[T] = xs
+ def case4() = matchEnd3(x1)
+ def matchEnd3(x: Array[T]) = x
+ case4()
+ }
+}
diff --git a/test/pending/pos/treecheckers/c2.scala b/test/pending/pos/treecheckers/c2.scala
new file mode 100644
index 0000000000..c893a5c922
--- /dev/null
+++ b/test/pending/pos/treecheckers/c2.scala
@@ -0,0 +1 @@
+class Test2(val valueVal: Int) extends AnyVal
diff --git a/test/pending/pos/treecheckers/c3.scala b/test/pending/pos/treecheckers/c3.scala
new file mode 100644
index 0000000000..e480bbfb08
--- /dev/null
+++ b/test/pending/pos/treecheckers/c3.scala
@@ -0,0 +1,8 @@
+import scala.collection.mutable.ArrayOps
+
+object Test3 {
+ implicit def genericArrayOps[T](xs: Array[T]): ArrayOps[T] = (xs match {
+ case x: Array[AnyRef] => refArrayOps[AnyRef](x)
+ case x: Array[Boolean] => booleanArrayOps(x)
+ }).asInstanceOf[ArrayOps[T]]
+}
diff --git a/test/pending/pos/treecheckers/c4.scala b/test/pending/pos/treecheckers/c4.scala
new file mode 100644
index 0000000000..2328131770
--- /dev/null
+++ b/test/pending/pos/treecheckers/c4.scala
@@ -0,0 +1,9 @@
+sealed trait Message[+A]
+class Script[A] extends Message[A] {
+ def iterator: Iterator[Message[A]] = ???
+}
+
+trait Test4[A] {
+ def f(cmd: Message[A]): Iterator[A] = cmd match { case s: Script[t] => s.iterator flatMap f }
+ def g(cmd: Message[A]) = cmd match { case s: Script[t] => s }
+}
diff --git a/test/pending/pos/treecheckers/c5.scala b/test/pending/pos/treecheckers/c5.scala
new file mode 100644
index 0000000000..43cbb65d74
--- /dev/null
+++ b/test/pending/pos/treecheckers/c5.scala
@@ -0,0 +1,3 @@
+trait Factory[CC[X] <: Traversable[X]]
+
+object Test5 extends Factory[Traversable]
diff --git a/test/pending/pos/treecheckers/c6.scala b/test/pending/pos/treecheckers/c6.scala
new file mode 100644
index 0000000000..8283655f3a
--- /dev/null
+++ b/test/pending/pos/treecheckers/c6.scala
@@ -0,0 +1,4 @@
+object Test6 {
+ import scala.reflect.ClassTag
+ def f[T: ClassTag] = implicitly[ClassTag[T]].runtimeClass match { case x => x }
+}