summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-01-29 09:59:54 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-01-29 09:59:54 +1000
commit1db62995b52b06f5037331172b3f54739d720d62 (patch)
tree0b684c4adfcb800fa195947b37fdb5dc89731552 /test/files/pos
parent8b5f2b435b4b14089806406c8923f7e845d10ef6 (diff)
parenteb15950e697eb77e52733f81c65e2d51951ad881 (diff)
downloadscala-1db62995b52b06f5037331172b3f54739d720d62.tar.gz
scala-1db62995b52b06f5037331172b3f54739d720d62.tar.bz2
scala-1db62995b52b06f5037331172b3f54739d720d62.zip
Merge commit 'eb15950' into merge/2.11.x-to-2.12.x-20150129
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/switch-small.flags1
-rw-r--r--test/files/pos/switch-small.scala8
-rw-r--r--test/files/pos/t3240.scala8
-rw-r--r--test/files/pos/t8267.scala33
-rw-r--r--test/files/pos/t845.scala16
-rw-r--r--test/files/pos/t8868a/Sub_2.scala1
-rw-r--r--test/files/pos/t8868a/T_1.scala6
-rw-r--r--test/files/pos/t8868b/Sub_2.scala2
-rw-r--r--test/files/pos/t8868b/T_1.scala4
-rw-r--r--test/files/pos/t8868c/Sub_2.scala2
-rw-r--r--test/files/pos/t8868c/T_1.scala9
-rw-r--r--test/files/pos/t8894.scala12
12 files changed, 93 insertions, 9 deletions
diff --git a/test/files/pos/switch-small.flags b/test/files/pos/switch-small.flags
deleted file mode 100644
index 85d8eb2ba2..0000000000
--- a/test/files/pos/switch-small.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfatal-warnings
diff --git a/test/files/pos/switch-small.scala b/test/files/pos/switch-small.scala
deleted file mode 100644
index 9de9ca028e..0000000000
--- a/test/files/pos/switch-small.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-import annotation._
-
-object Test {
- def f(x: Int) = (x: @switch) match {
- case 1 => 1
- case _ => 2
- }
-}
diff --git a/test/files/pos/t3240.scala b/test/files/pos/t3240.scala
new file mode 100644
index 0000000000..cf197a406d
--- /dev/null
+++ b/test/files/pos/t3240.scala
@@ -0,0 +1,8 @@
+class A {
+ val foo = new {
+ type t
+ def apply(a: Option[t], defVal: Any) = {
+ a.getOrElse(defVal).asInstanceOf[t]
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/t8267.scala b/test/files/pos/t8267.scala
new file mode 100644
index 0000000000..37b498fe3e
--- /dev/null
+++ b/test/files/pos/t8267.scala
@@ -0,0 +1,33 @@
+class Bippy { trait Foo[A] }
+
+final class RichBippy[C <: Bippy with Singleton](val c1: C) {
+ def f: Int = 1
+ def f[A](x: A)(ev: c1.Foo[A]): Int = 2
+
+ def g[A <: Nothing](x: A): Int = 1
+ def g[A](x: A)(ev: c1.Foo[A]): Int = 2
+
+ def h[A](x: A)(ev: c1.Foo[A]): Int = 1
+
+ def i(x: Nothing): Int = 1
+ def i(x: AnyRef)(ev: c1.Foo[x.type]): Int = 2
+}
+
+object p {
+
+ val c = new Bippy
+ val d0 = new RichBippy[c.type](c)
+ def d1 = new RichBippy[c.type](c)
+
+ d0.f[Int](5)(null: c.Foo[Int]) // ok
+ d1.f[Int](5)(null: c.Foo[Int]) // fails
+
+ d0.g[Int](5)(null: c.Foo[Int]) // ok
+ d1.g[Int](5)(null: c.Foo[Int]) // fails
+
+ d0.h[Int](5)(null: c.Foo[Int]) // ok
+ d1.h[Int](5)(null: c.Foo[Int]) // ok
+
+ d0.i("")(null) // ok
+ d1.i("")(null) // ok
+}
diff --git a/test/files/pos/t845.scala b/test/files/pos/t845.scala
new file mode 100644
index 0000000000..ddf6a16f32
--- /dev/null
+++ b/test/files/pos/t845.scala
@@ -0,0 +1,16 @@
+package test;
+
+object Test extends App {
+ type Bar;
+ trait FooImpl;
+
+ trait Bob {
+ def bar : Bar with FooImpl;
+ }
+ def ifn[A,B](a : A)(f : A => B) =
+ if (a != null) f(a) else null;
+
+ val bob : Bob = null;
+ val bar = ifn(bob)(_.bar);
+ assert(bar == null);
+}
diff --git a/test/files/pos/t8868a/Sub_2.scala b/test/files/pos/t8868a/Sub_2.scala
new file mode 100644
index 0000000000..a19b529c88
--- /dev/null
+++ b/test/files/pos/t8868a/Sub_2.scala
@@ -0,0 +1 @@
+class Sub extends T
diff --git a/test/files/pos/t8868a/T_1.scala b/test/files/pos/t8868a/T_1.scala
new file mode 100644
index 0000000000..9fb97b1413
--- /dev/null
+++ b/test/files/pos/t8868a/T_1.scala
@@ -0,0 +1,6 @@
+class C
+
+trait T {
+ @deprecated(since = "", message = "")
+ class X
+}
diff --git a/test/files/pos/t8868b/Sub_2.scala b/test/files/pos/t8868b/Sub_2.scala
new file mode 100644
index 0000000000..58b44db2b3
--- /dev/null
+++ b/test/files/pos/t8868b/Sub_2.scala
@@ -0,0 +1,2 @@
+class Sub extends T
+
diff --git a/test/files/pos/t8868b/T_1.scala b/test/files/pos/t8868b/T_1.scala
new file mode 100644
index 0000000000..0b71cfdaa3
--- /dev/null
+++ b/test/files/pos/t8868b/T_1.scala
@@ -0,0 +1,4 @@
+@deprecated(since = "2.4.0", message = "")
+trait T {
+ class X
+}
diff --git a/test/files/pos/t8868c/Sub_2.scala b/test/files/pos/t8868c/Sub_2.scala
new file mode 100644
index 0000000000..58b44db2b3
--- /dev/null
+++ b/test/files/pos/t8868c/Sub_2.scala
@@ -0,0 +1,2 @@
+class Sub extends T
+
diff --git a/test/files/pos/t8868c/T_1.scala b/test/files/pos/t8868c/T_1.scala
new file mode 100644
index 0000000000..dc541950d8
--- /dev/null
+++ b/test/files/pos/t8868c/T_1.scala
@@ -0,0 +1,9 @@
+class C(a: Any) extends annotation.StaticAnnotation
+
+@C({val x = 0; x})
+trait T {
+ class X
+
+ @C({val x = 0; x})
+ def foo = 42
+}
diff --git a/test/files/pos/t8894.scala b/test/files/pos/t8894.scala
new file mode 100644
index 0000000000..3b26f1ae7e
--- /dev/null
+++ b/test/files/pos/t8894.scala
@@ -0,0 +1,12 @@
+class CC(val i: Int, val s: String)
+object CC extends {
+ type P = (Int, String)
+
+ //def unapply(c: CC): Option[(Int, String)] = Some((c.i, c.s)) // OK
+ def unapply(c: CC): Option[P] = Some((c.i, c.s)) // fails (because of the type alias)
+}
+
+class Test {
+ val cc = new CC(23, "foo")
+ val CC(i, s) = cc
+} \ No newline at end of file