diff options
Diffstat (limited to 'tests/pending/pos')
-rw-r--r-- | tests/pending/pos/t2782.scala | 18 | ||||
-rw-r--r-- | tests/pending/pos/t2795-new.scala | 19 | ||||
-rw-r--r-- | tests/pending/pos/t2795-old.scala | 17 | ||||
-rwxr-xr-x | tests/pending/pos/t2913.scala | 55 | ||||
-rw-r--r-- | tests/pending/pos/t2945.scala | 12 | ||||
-rw-r--r-- | tests/pending/pos/t2994a.scala | 27 | ||||
-rw-r--r-- | tests/pending/pos/t2994b.scala | 7 | ||||
-rw-r--r-- | tests/pending/pos/tuplePatDef.scala | 4 |
8 files changed, 155 insertions, 4 deletions
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..0379e9ba1 --- /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 + } + } +} diff --git a/tests/pending/pos/t2994a.scala b/tests/pending/pos/t2994a.scala new file mode 100644 index 000000000..f1a4a4a12 --- /dev/null +++ b/tests/pending/pos/t2994a.scala @@ -0,0 +1,27 @@ +object Naturals { + trait NAT { + type a[s[_ <: NAT] <: NAT, z <: NAT] <: NAT + type v = a[SUCC, ZERO] + } + final class ZERO extends NAT { + type a[s[_ <: NAT] <: NAT, z <: NAT] = z + } + final class SUCC[n <: NAT] extends NAT { + type a[s[_ <: NAT] <: NAT, z <: NAT] = s[n#a[s, z]] + } + type _0 = ZERO + type _1 = SUCC[_0] + type _2 = SUCC[_1] + type _3 = SUCC[_2] + type _4 = SUCC[_3] + type _5 = SUCC[_4] + type _6 = SUCC[_5] + + + // crashes scala-2.8.0 beta1 + trait MUL[n <: NAT, m <: NAT] extends NAT { + trait curry[n[_[_], _], s[_]] { type f[z <: NAT] = n[s, z] } + type a[s[_ <: NAT] <: NAT, z <: NAT] = n#a[curry[m#a, s]#f, z] + } + +} diff --git a/tests/pending/pos/t2994b.scala b/tests/pending/pos/t2994b.scala new file mode 100644 index 000000000..8b5eb9692 --- /dev/null +++ b/tests/pending/pos/t2994b.scala @@ -0,0 +1,7 @@ +object Test { + trait Bar[X[_]] + trait Baz[S[_] <: Bar[S]] { + type Apply[T] + } + trait Foo[V[_] <: Bar[V]] extends Bar[Baz[V]#Apply] +} diff --git a/tests/pending/pos/tuplePatDef.scala b/tests/pending/pos/tuplePatDef.scala deleted file mode 100644 index 978052991..000000000 --- a/tests/pending/pos/tuplePatDef.scala +++ /dev/null @@ -1,4 +0,0 @@ - -object Test { - val (x,y): (String, M) = null -} |