aboutsummaryrefslogtreecommitdiff
path: root/tests/pending
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pending')
-rw-r--r--tests/pending/pos/t2454.scala25
-rw-r--r--tests/pending/pos/t2613.scala11
-rw-r--r--tests/pending/pos/t2693.scala6
-rw-r--r--tests/pending/pos/t2782.scala18
-rw-r--r--tests/pending/pos/t2795-new.scala19
-rw-r--r--tests/pending/pos/t2795-old.scala17
-rwxr-xr-xtests/pending/pos/t2913.scala55
-rw-r--r--tests/pending/pos/t2945.scala12
8 files changed, 138 insertions, 25 deletions
diff --git a/tests/pending/pos/t2454.scala b/tests/pending/pos/t2454.scala
deleted file mode 100644
index 00f2e6f67..000000000
--- a/tests/pending/pos/t2454.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-package am;
-
-trait One[M[_]] {
- val x : Int
-}
-
-trait Two[M[_,_]] {
- val x : Int
-}
-
-object Test {
- // Works.
- val x = new Two[Map] {
- val x = 5
- }
-
- val o = new One[java.util.List] {
- val x = 1
- }
-
- // Does not work
- val y = new Two[java.util.concurrent.ConcurrentHashMap] {
- val x = 3
- }
-}
diff --git a/tests/pending/pos/t2613.scala b/tests/pending/pos/t2613.scala
new file mode 100644
index 000000000..c234d4c0d
--- /dev/null
+++ b/tests/pending/pos/t2613.scala
@@ -0,0 +1,11 @@
+import language.existentials
+
+object Test {
+ class Row
+
+ abstract class MyRelation [R <: Row, +Relation <: MyRelation[R, Relation]]
+
+ type M = MyRelation[_ <: Row, _ <: MyRelation]
+
+ val (x,y): (String, M) = null
+}
diff --git a/tests/pending/pos/t2693.scala b/tests/pending/pos/t2693.scala
new file mode 100644
index 000000000..5d4d0380c
--- /dev/null
+++ b/tests/pending/pos/t2693.scala
@@ -0,0 +1,6 @@
+class A {
+ trait T[A]
+ def usetHk[T[_], A](ta: T[A]) = 0
+ usetHk(new T[Int]{}: T[Int])
+ usetHk(new T[Int]{}) // fails with: found: java.lang.Object with T[Int], required: ?T[ ?A ]
+}
diff --git a/tests/pending/pos/t2782.scala b/tests/pending/pos/t2782.scala
new file mode 100644
index 000000000..3b387af80
--- /dev/null
+++ b/tests/pending/pos/t2782.scala
@@ -0,0 +1,18 @@
+import scala.{collection => sc}
+
+object Test {
+ trait Foo[T]
+
+ // Haven't managed to repro without using a CanBuild or CanBuildFrom implicit parameter
+ implicit def MapFoo[A, B, M[A, B] <: sc.Map[A,B]](implicit aFoo: Foo[A], bFoo: Foo[B], cb: sc.generic.CanBuild[(A, B), M[A, B]]): Test.Foo[M[A,B]] = new Foo[M[A,B]] {}
+ implicit object Tuple2IntIntFoo extends Foo[(Int, Int)] // no difference if this line is uncommented
+ implicit def Tuple2Foo[A, B]: Test.Foo[(A, B)] = new Foo[(A, B)] {} // nor this one
+
+ implicitly[Foo[(Int, Int)]]
+}
+
+class A {
+ def x[N[X] >: M[X], M[_], G](n: N[G], m: M[G]) = null
+
+ x(Some(3), Seq(2))
+}
diff --git a/tests/pending/pos/t2795-new.scala b/tests/pending/pos/t2795-new.scala
new file mode 100644
index 000000000..e307133e0
--- /dev/null
+++ b/tests/pending/pos/t2795-new.scala
@@ -0,0 +1,19 @@
+package t1
+
+import scala.reflect.{ClassTag, classTag}
+
+trait Element[T] {
+}
+
+trait Config {
+ type T <: Element[T]
+ implicit val m: ClassTag[T]
+ // XXX Following works fine:
+ // type T <: Element[_]
+}
+
+trait Transform { self: Config =>
+ def processBlock(block: Array[T]): Unit = {
+ var X = new Array[T](1)
+ }
+}
diff --git a/tests/pending/pos/t2795-old.scala b/tests/pending/pos/t2795-old.scala
new file mode 100644
index 000000000..935cb1f44
--- /dev/null
+++ b/tests/pending/pos/t2795-old.scala
@@ -0,0 +1,17 @@
+package t1
+
+trait Element[T] {
+}
+
+trait Config {
+ type T <: Element[T]
+ implicit val m: ClassManifest[T]
+ // XXX Following works fine:
+ // type T <: Element[_]
+}
+
+trait Transform { self: Config =>
+ def processBlock(block: Array[T]): Unit = {
+ var X = new Array[T](1)
+ }
+}
diff --git a/tests/pending/pos/t2913.scala b/tests/pending/pos/t2913.scala
new file mode 100755
index 000000000..21700e71a
--- /dev/null
+++ b/tests/pending/pos/t2913.scala
@@ -0,0 +1,55 @@
+import language.noAutoTupling // try with on and off
+
+class A {
+ def foo(a: Int) = 0
+}
+
+class RichA {
+ def foo(a: String) = 0
+ def foo(a: String, b: String) = 0
+ def foo() = 0
+}
+
+object Test {
+
+ implicit def AToRichA(a: A): RichA = new RichA
+
+ val a = new A
+ a.foo()
+ a.foo(1)
+
+ a.foo("") // Without implicits, a type error regarding invalid argument types is generated at `""`. This is
+ // the same position as an argument, so the 'second try' typing with an Implicit View is tried,
+ // and AToRichA(a).foo("") is found.
+ //
+ // My reading of the spec "7.3 Views" is that `a.foo` denotes a member of `a`, so the view should
+ // not be triggered.
+ //
+ // But perhaps the implementation was changed to solve See https://lampsvn.epfl.ch/trac/scala/ticket/1756
+
+ a.foo("a", "b") // Without implicits, a type error regarding invalid arity is generated at `foo(<error>"", "")`.
+ // Typers#tryTypedApply:3274 only checks if the error is as the same position as `foo`, `"a"`, or `"b"`.
+ // None of these po
+}
+
+// t0851 is essentially the same:
+object test1 {
+ case class Foo[T,T2](f : (T,T2) => String) extends (((T,T2)) => String){
+ def apply(t : T) = (s:T2) => f(t,s)
+ def apply(p : (T,T2)) = f(p._1,p._2)
+ }
+ implicit def g[T](f : (T,String) => String): test1.Foo[T,String] = Foo(f)
+ def main(args : Array[String]) : Unit = {
+ val f = (x:Int,s:String) => s + x
+ println(f(1))
+ ()
+ }
+}
+object Main {
+ def main(args : Array[String]): Unit = {
+ val fn = (a : Int, str : String) => "a: " + a + ", str: " + str
+ implicit def fx[T](f : (T,String) => String): T => String = (x:T) => f(x,null)
+ println(fn(1))
+ ()
+ }
+}
diff --git a/tests/pending/pos/t2945.scala b/tests/pending/pos/t2945.scala
new file mode 100644
index 000000000..54f0a7724
--- /dev/null
+++ b/tests/pending/pos/t2945.scala
@@ -0,0 +1,12 @@
+object Foo {
+ def test(s: String) = {
+ (s: Seq[Char]) match {
+ case Seq('f', 'o', 'o', ' ', rest1: _*) =>
+ rest1
+ case Seq('b', 'a', 'r', ' ', ' ', rest2: _*) =>
+ rest2
+ case _ =>
+ s
+ }
+ }
+}