diff options
Diffstat (limited to 'tests/pending')
130 files changed, 50 insertions, 1811 deletions
diff --git a/tests/pending/neg/i533/Compat.scala b/tests/pending/neg/i533/Compat.scala new file mode 100644 index 000000000..16613cf5b --- /dev/null +++ b/tests/pending/neg/i533/Compat.scala @@ -0,0 +1,7 @@ +object Compat { + def main(args: Array[String]): Unit = { + val x = new Array[Int](1) + x(0) = 10 + println(JA.get(x)) + } +} diff --git a/tests/pending/neg/i533/JA.java b/tests/pending/neg/i533/JA.java new file mode 100644 index 000000000..92421e5b1 --- /dev/null +++ b/tests/pending/neg/i533/JA.java @@ -0,0 +1,5 @@ +class JA { + public static <T> T get(T[] arr) { + return arr[0]; + } +}
\ No newline at end of file diff --git a/tests/pending/pos/apply-equiv.scala b/tests/pending/pos/apply-equiv.scala deleted file mode 100644 index f53b8b5ab..000000000 --- a/tests/pending/pos/apply-equiv.scala +++ /dev/null @@ -1,14 +0,0 @@ -class Test { - - class Lambda { type Arg; type Apply } - - type T1 = (Lambda { type Arg = Int } { type Apply = List[Arg] }) # Apply - type T2 = List[Int] - - var x: T1 = _ - var y: T2 = _ - - x = y - y = x - -} diff --git a/tests/pending/pos/contraImplicits.scala b/tests/pending/pos/contraImplicits.scala deleted file mode 100644 index c4d659615..000000000 --- a/tests/pending/pos/contraImplicits.scala +++ /dev/null @@ -1,18 +0,0 @@ -import scala.reflect._ -// this needs to be fleshed out further -class Contra[-T] - -object Test { - def getParam[T](c: Contra[T])(implicit ct: ClassTag[T]): Unit = { - println(ct) - ct - } - def f[T](x: Contra[T]): Contra[T] = x - - def main(args: Array[String]): Unit = { - val x = f(new Contra[Int]) - val y: Contra[Int] = x - getParam(new Contra[Int]) - } -} - diff --git a/tests/pending/pos/depmet_implicit_norm_ret.scala b/tests/pending/pos/depmet_implicit_norm_ret.scala index 85be750b4..42bfb9fe1 100644 --- a/tests/pending/pos/depmet_implicit_norm_ret.scala +++ b/tests/pending/pos/depmet_implicit_norm_ret.scala @@ -17,6 +17,8 @@ object Test{ } } + import ZipWith._ + trait ZipWith[S] { type T def zipWith : S => T = sys.error("") @@ -24,6 +26,9 @@ object Test{ // bug: inferred return type = (Stream[A]) => java.lang.Object with Test.ZipWith[B]{type T = Stream[B]}#T // this seems incompatible with vvvvvvvvvvvvvvvvvvvvvv -- #3731 - def map[A,B](f : A => B) /* : Stream[A] => Stream[B]*/ = ZipWith(f) - val tst: Stream[Int] = map{x: String => x.length}(Stream("a")) + def map1[A,B](f : A => B) = ZipWith(f)(SuccZipWith) // this typechecks but fails in -Ycheck:first + val tst1: Stream[Int] = map1[String, Int]{x: String => x.length}.apply(Stream("a")) + + def map2[A,B](f : A => B) = ZipWith(f) // this finds ZeroZipWith where scalac finds SuccZipWith and fails typechecking in the next line. + val tst2: Stream[Int] = map2{x: String => x.length}.apply(Stream("a")) } diff --git a/tests/pending/pos/depmet_implicit_oopsla_zipwith.scala b/tests/pending/pos/depmet_implicit_oopsla_zipwith.scala deleted file mode 100644 index 83171f865..000000000 --- a/tests/pending/pos/depmet_implicit_oopsla_zipwith.scala +++ /dev/null @@ -1,44 +0,0 @@ -case class Zero() -case class Succ[N](x: N) -import Stream.{cons, continually} - -trait ZipWith[N, S] { - type T - - def manyApp: N => Stream[S] => T - def zipWith: N => S => T = n => f => manyApp(n)(continually(f)) -} -object ZipWith { - implicit def ZeroZipWith[S]: ZipWith[Zero,S]{type T = Stream[S]} = new ZipWith[Zero, S] { - type T = Stream[S] - - def manyApp = n => xs => xs - } - - implicit def SuccZipWith[N, S, R](implicit zw: ZipWith[N, R]): ZipWith[Succ[N],S => R]{type T = Stream[S] => zw.T; def zapp[A, B](xs: Stream[A => B],ys: Stream[A]): Stream[B]} = - new ZipWith[Succ[N],S => R] { - type T = Stream[S] => zw.T - - def zapp[A, B](xs: Stream[A => B], ys: Stream[A]): Stream[B] = (xs, ys) match { - case (cons(f, fs), cons(s, ss)) => cons(f(s),zapp(fs, ss)) - case (_, _) => Stream.empty - } - - def manyApp = n => xs => ss => n match { - case Succ(i) => zw.manyApp(i)(zapp(xs, ss)) - } - } -} - -object Test { - def zWith[N, S](n: N, s: S)(implicit zw: ZipWith[N, S]): zw.T = zw.zipWith(n)(s) - - def zipWith0: Stream[Int] = zWith(Zero(),0) - -// (Stream[A]) => java.lang.Object with ZipWith[Zero,B]{type T = Stream[B]}#T -// should normalise to: Stream[A] => Stream[B] - def map[A, B](f: A => B) = zWith(Succ(Zero()),f) - - def zipWith3[A, B, C, D](f: A => B => C => D) = //: Stream[A] => Stream[B] => Stream[C] => Stream[D] = // BUG why do we need a return type? - zWith(Succ(Succ(Succ(Zero()))),f) -} diff --git a/tests/pending/pos/depsel.scala b/tests/pending/pos/depsel.scala deleted file mode 100644 index 2cec4349e..000000000 --- a/tests/pending/pos/depsel.scala +++ /dev/null @@ -1,14 +0,0 @@ -// demonstrates selection on non-path types. Needs to be fleshed out to -// become a real test. -object Test { - - class C { - type T - val f: T => T = ??? - } - - var x = new C - val y = x.f - - -} diff --git a/tests/pending/pos/exponential-spec.scala b/tests/pending/pos/exponential-spec.scala index 54515c1d2..26c9ab85e 100644 --- a/tests/pending/pos/exponential-spec.scala +++ b/tests/pending/pos/exponential-spec.scala @@ -23,7 +23,7 @@ object Test { compose f[T] // 8s compose f[T] // 11s compose f[T] // 17s - compose f[T] // 29s +/* compose f[T] // 29s compose f[T] // 54s compose f[T] compose f[T] @@ -42,6 +42,6 @@ object Test { compose f[T] compose f[T] compose f[T] - compose f[T] + compose f[T]*/ )(exp) } diff --git a/tests/pending/pos/extractor-types.scala b/tests/pending/pos/extractor-types.scala deleted file mode 100644 index 200279be6..000000000 --- a/tests/pending/pos/extractor-types.scala +++ /dev/null @@ -1,30 +0,0 @@ -package p1 { - object Ex { def unapply(p: Any): Option[_ <: Int] = null } - object Foo { val Ex(_) = null } -} -// a.scala:2: error: error during expansion of this match (this is a scalac bug). -// The underlying error was: type mismatch; -// found : Some[_$1(in value x$1)] where type _$1(in value x$1) -// required: Some[_$1(in method unapply)] -// object Foo { val Ex(_) = null } -// ^ -// one error found - -package p2 { - trait Other { - class Quux - object Baz { def unapply(x: Any): Option[Quux] = None } - } - trait Reifiers { - def f(): Unit = { - val u2: Other = null - (null: Any) match { case u2.Baz(x) => println(x) } //: u2.Quux) } - // The underlying error was: type mismatch; - // found : Other#Quux - // required: u2.Quux - // x match { case u2.Baz(x) => println(x: u2.Quux) } - // ^ - // one error found - } - } -} diff --git a/tests/pending/pos/gadts2.scala b/tests/pending/pos/gadts2.scala deleted file mode 100644 index b67bafb32..000000000 --- a/tests/pending/pos/gadts2.scala +++ /dev/null @@ -1,25 +0,0 @@ -object Test { - - abstract class Number - case class MyInt(n: Int) extends Number - case class MyDouble(d: Double) extends Number - - trait Term[a] - case class Cell[a](var x: a) extends Term[a] - final case class NumTerm(val n: Number) extends Term[Number] - - def f[a](t: Term[a], c: Cell[a]): Unit = { - t match { - case NumTerm(n) => c.x = MyDouble(1.0) - } - } - - val x: Term[Number] = NumTerm(MyInt(5)) - - def main(args: Array[String]): Unit = { - val cell = Cell[Number](MyInt(6)) - Console.println(cell) - f[Number](new NumTerm(MyInt(5)), cell) - Console.println(cell) - } -} diff --git a/tests/pending/pos/generic-sigs.flags b/tests/pending/pos/generic-sigs.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/generic-sigs.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/hk-infer.scala b/tests/pending/pos/hk-infer.scala deleted file mode 100644 index c23a9d151..000000000 --- a/tests/pending/pos/hk-infer.scala +++ /dev/null @@ -1,37 +0,0 @@ -object Basis { - final case class X[T](t: T) - val x = Seq(X(32)) - val y = Seq(X(true)) - val x1 = Seq(X("asdf")) - val x2 = Seq(X('d')) -} -import Basis._ - -object DoesWork { - // Doesn'tWork - // def f1 = x ++ y ++ x1 ++ x2 - - def f2 = List(x, y, x1, x2).flatten -} - -// Testing the not giving of explicit Booper[M] arguments. -object ShouldWorkHK { - class Booper[M[_]](xs: Seq[M[_]]) extends collection.generic.SeqForwarder[M[_]] { - def underlying = xs - def BOOP(ys: Seq[M[_]]) = new Booper(xs ++ ys) - } - implicit def mkBoop[M[_]](xs: Seq[M[_]]): ShouldWorkHK.Booper[M] = new Booper(xs) - - def f1 = x BOOP y BOOP x1 BOOP x2 -} - -object DoesWorkHK { - class Booper[M[_]](xs: Seq[M[_]]) extends collection.generic.SeqForwarder[M[_]] { - def underlying = xs - def BOOP(ys: Seq[M[_]]) = new Booper[M](xs ++ ys) - } - implicit def mkBoop[M[_]](xs: Seq[M[_]]): DoesWorkHK.Booper[M] = new Booper[M](xs) - - def f1 = x BOOP y BOOP x1 BOOP x2 -} - diff --git a/tests/pending/pos/i743.scala b/tests/pending/pos/i743.scala deleted file mode 100644 index 8fe522cee..000000000 --- a/tests/pending/pos/i743.scala +++ /dev/null @@ -1,6 +0,0 @@ -object NonLocalReturn { - def foo(a: List[Int]): Int = { - a.foreach(x => return x) - 0 - } -} diff --git a/tests/pending/pos/infersingle.flags b/tests/pending/pos/infersingle.flags deleted file mode 100644 index e1b37447c..000000000 --- a/tests/pending/pos/infersingle.flags +++ /dev/null @@ -1 +0,0 @@ --Xexperimental
\ No newline at end of file diff --git a/tests/pending/pos/infersingle.scala b/tests/pending/pos/infersingle.scala deleted file mode 100644 index 60f4ff07e..000000000 --- a/tests/pending/pos/infersingle.scala +++ /dev/null @@ -1,52 +0,0 @@ -object Test1 { - def one[T](x: T): Option[T] = Some(x) - val x = "one" - val y: Option[x.type] = one(x) -} - -object Test2 { - // Has never worked, but seems desirable given the recent changes to - // pattern type inference. - val a = "" - object Id { - def unapply(xxxx: Any): Some[a.type] = Some[a.type](a) - } - val b: a.type = (a: a.type) match { - case Id(x) => x - } -} - -object Test3 { - val a = "" - object Id { - def unapply(xxxx: Any): Some[Test3.type] = Some[Test3.type](Test3) - } - val b: Test3.type = a match { - case Id(x) => x - } -} - -class Test4 { - val a = "" - object Id { - def unapply(xxxx: Any): Some[Test4.this.type] = Some[Test4.this.type](Test4.this) - } - val b: Test4.this.type = a match { - case Id(x) => x - } -} - -class Super5 { - final val q = "" - def q1: q.type = q -} - -class Test5 extends Super5 { - val a = "" - object Id { - def unapply(xxxx: Any): Some[Test5.super.q.type] = Some[Test5.super.q.type](q1) - } - val b: Test5.super.q.type = a match { - case Id(x) => x - } -} diff --git a/tests/pending/pos/isApplicableSafe.scala b/tests/pending/pos/isApplicableSafe.scala deleted file mode 100644 index b4cacbf28..000000000 --- a/tests/pending/pos/isApplicableSafe.scala +++ /dev/null @@ -1,8 +0,0 @@ -class A { - // Any of Array[List[Symbol]], List[Array[Symbol]], or List[List[Symbol]] compile. - var xs: Array[Array[Symbol]] = _ - var ys: Array[Map[Symbol, Set[Symbol]]] = _ - - xs = Array(Array()) - ys = Array(Map(), Map()) -} diff --git a/tests/pending/pos/lazyvals.scala b/tests/pending/pos/lazyvals.scala deleted file mode 100644 index 93a82cd0c..000000000 --- a/tests/pending/pos/lazyvals.scala +++ /dev/null @@ -1,18 +0,0 @@ - - -trait Iterator { - - def span() = { - val self: Int = 33 - class Leading { - def finish(): Unit = println("finished") - } - val leading = new Leading - - class Trailing { - @volatile lazy val it = leading.finish() - } - val trailing = new Trailing - (leading, trailing) - } -} diff --git a/tests/pending/pos/matthias4.scala b/tests/pending/pos/matthias4.scala deleted file mode 100644 index 18599ae71..000000000 --- a/tests/pending/pos/matthias4.scala +++ /dev/null @@ -1,84 +0,0 @@ -/* -object A requires B { - B.X getX() { - return B.getX(); - } - void setX(B.X x) {} -} -object B { - class X {} - X getX() { - return new X(); - } - void setX(X x) {} -} -object C requires B { - object A; - void test() { - A.setX(B.getX()); - } -} -*/ - -trait _a extends AnyRef with _b { - val a: _a; - val A: A; - type A <: a.AObject; - trait AObject { - def getX(): B.X; - def setX(x: B.X): Unit; - } -} -trait a123 extends AnyRef with _a with _b { - val a: this.type = this; - val A: A = new A(); - class A() extends AObject { - def getX(): B.X = B.getX(); - def setX(x: B.X) = B.setX(x); - } -} - -trait _b { - val b: _b; - val B: B; - type B <: b.BObject; - trait BObject { - type X; - def getX(): X; - def setX(x: X): Unit; - } -} -abstract class b() extends AnyRef with _b { - val b: this.type = this; - val B: B = new B(); - class B() extends BObject { - class X() {} - def getX(): X = new X(); - def setX(x: X) = (); - } -} - -trait _m { - val m: _m; - val M: M; - type M <: m.MObject; - trait MObject {} -} -abstract class m() extends AnyRef with _m with _b { - val m: this.type = this; - val M: M = new M(); - class M() extends MObject with a123 with Linker { - def test() = { - val x: B.X = B.getX(); - A.setX(x); - } - } - trait Linker { - val b: m.this.b.type = m.this.b; - val B: m.this.B.type = m.this.B; - type B = m.this.B; - val m: m.this.m.type = m.this.m; - val M: m.this.M.type = m.this.M; - type M = m.this.M; - } -} diff --git a/tests/pending/pos/mixins.scala b/tests/pending/pos/mixins.scala deleted file mode 100644 index 846d6a41b..000000000 --- a/tests/pending/pos/mixins.scala +++ /dev/null @@ -1,22 +0,0 @@ -package mixins -abstract class Super { - def foo: Int -} -trait Mixin extends Super { - abstract override def foo = super.foo -} -trait MixinSub extends Super with Mixin { - abstract override def foo: Int = super.foo -} -trait MixinSubSub extends MixinSub { - abstract override def foo = super.foo -} -class Sub extends Super { - def foo: Int = 1 -} -class Base extends Sub with MixinSubSub { - override def foo = super.foo -} -trait Mixin1 extends Sub with MixinSubSub {} -class Base1 extends Mixin1 {} - diff --git a/tests/pending/pos/return_thistype.scala b/tests/pending/pos/return_thistype.scala deleted file mode 100644 index c0736c0ad..000000000 --- a/tests/pending/pos/return_thistype.scala +++ /dev/null @@ -1,8 +0,0 @@ -// tests transformation of return type in typedTypeApply (see also tcpoly_gm.scala) -class As { - class A { - def foo: A.this.type = bar.asInstanceOf[A.this.type] - def foo2: this.type = bar.asInstanceOf[this.type] - def bar: A = null - } -} diff --git a/tests/pending/pos/setter-not-implicit.scala b/tests/pending/pos/setter-not-implicit.scala deleted file mode 100644 index 9bfffc2ce..000000000 --- a/tests/pending/pos/setter-not-implicit.scala +++ /dev/null @@ -1,3 +0,0 @@ -object O { - implicit var x: Int = 0 -} diff --git a/tests/pending/pos/stable.scala b/tests/pending/pos/stable.scala deleted file mode 100644 index 267a36fe5..000000000 --- a/tests/pending/pos/stable.scala +++ /dev/null @@ -1,11 +0,0 @@ -trait Base { - val x: Int; - val y: Int; - var z: Int; -} - -class Sub() extends Base { - val x: Int = 1; - val y: Int = 2; - var z: Int = 3; -} diff --git a/tests/pending/pos/t1756.scala b/tests/pending/pos/t1756.scala deleted file mode 100644 index 34bf273ab..000000000 --- a/tests/pending/pos/t1756.scala +++ /dev/null @@ -1,59 +0,0 @@ - -/** -This is a tricky issue which has to do with the fact that too much conflicting -type information is propagated into a single implicit search, where the intended -solution applies two implicit searches. - -Roughly, in x + x * y, the first x is first typed as Poly[A]. That -means the x * y is then typed as Poly[A]. Then the second x is typed -as Poly[A], then y is typed as Poly[Poly[A]]. The application x * y -fails, so the coef2poly implicit conversion is applied to x. That -means we look for an implicit conversion from type Poly[A] to type -?{val *(x$1: ?>: Poly[Poly[A]] <: Any): Poly[A]}. Note that the result -type Poly[A] is propagated into the implicit search. Poly[A] comes as -expected type from x+, because the lhs x is still typed as a Poly[A]. -This means that the argument of the implicit conversion is typechecked -with expected type A with Poly[A]. And no solution is found. - -To solve this, I added a fallback scheme similar to implicit arguments: -When an implicit view that adds a method matching given arguments and result -type fails, try again without the result type. - -However, troubles are not yet over. We now get an oprhan poly param C when pickling -and, if typr printer and -Ylog:front is on, an infinite type of the form - - mu x. Ring[LazyRef(x) & A] -*/ -trait Ring[T <: Ring[T]] { - def +(that: T): T - def *(that: T): T -} - -class A extends Ring[A] { - def +(that: A) = new A - def *(that: A) = new A -} - -class Poly[C <: Ring[C]](val c: C) extends Ring[Poly[C]] { - def +(that: Poly[C]) = new Poly(this.c + that.c) - def *(that: Poly[C]) = new Poly(this.c*that.c) -} - -object Test extends App { - - implicit def coef2poly[C <: Ring[C]](c: C): Poly[C] = new Poly(c) - - val a = new A - val x = new Poly(new A) - - println(x + a) // works - println(a + x) // works - - val y = new Poly(new Poly(new A)) - - println(x + y*x) // works - println(x*y + x) // works - println(y*x + x) // works - - println(x + x*y) // failed before -} diff --git a/tests/pending/pos/t3494.scala b/tests/pending/pos/t3494.scala deleted file mode 100644 index dd54b0f82..000000000 --- a/tests/pending/pos/t3494.scala +++ /dev/null @@ -1,7 +0,0 @@ -object Test { - def f[T](xs: T*) = () - - val x = "abc" - - f[x.type](x) -} diff --git a/tests/pending/pos/t3631.scala b/tests/pending/pos/t3631.scala index e72374130..207e28cd7 100644 --- a/tests/pending/pos/t3631.scala +++ b/tests/pending/pos/t3631.scala @@ -1,3 +1,4 @@ +// fails Ycheck case class X22(x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int, x22: Int) { } case class X23(x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int, x22: Int, x23: Int) { } diff --git a/tests/pending/pos/t3800.scala b/tests/pending/pos/t3800.scala deleted file mode 100644 index 096502174..000000000 --- a/tests/pending/pos/t3800.scala +++ /dev/null @@ -1,6 +0,0 @@ -class meh extends annotation.StaticAnnotation - -class ALike[C] -abstract class AFactory[CC[x] <: ALike[CC[x]]] { - def aCompanion : AFactory[CC @meh] -} diff --git a/tests/pending/pos/t3862.scala b/tests/pending/pos/t3862.scala deleted file mode 100644 index 0d978caa4..000000000 --- a/tests/pending/pos/t3862.scala +++ /dev/null @@ -1,10 +0,0 @@ -// Currently takes a very long time (more than a minute) and then -// does not find an alternative. -object OverloadingShapeType { - // comment out this, and the other alternative is chosen. - def blerg(f: String): Unit = {} - - def blerg[M[X], T](l: M[T]): Unit = {} - - blerg(List(1)) // error: type mismatch; found : List[Int] required: String -} diff --git a/tests/pending/pos/t3880.scala b/tests/pending/pos/t3880.scala deleted file mode 100644 index f778eb71a..000000000 --- a/tests/pending/pos/t3880.scala +++ /dev/null @@ -1,16 +0,0 @@ -abstract class Bar[+B] { -} -abstract class C1[+B] extends Bar[B] { - private[this] def g(x: C1[B]): Unit = () - - // this method is fine: notice that it allows the call to g, - // which requires C1[B], even though we matched on C1[_]. - // (That is good news.) - private[this] def f1(x: Bar[B]): Unit = x match { - case x: C1[_] => g(x) - } - // this one crashes. - private[this] def f2(x: Bar[B]): Unit = x match { - case x: C1[_] => f2(x) - } -} diff --git a/tests/pending/pos/t3960.flags b/tests/pending/pos/t3960.flags deleted file mode 100644 index 4449dbbdf..000000000 --- a/tests/pending/pos/t3960.flags +++ /dev/null @@ -1 +0,0 @@ --Ycheck:typer
\ No newline at end of file diff --git a/tests/pending/pos/t3999/a_1.scala b/tests/pending/pos/t3999/a_1.scala deleted file mode 100644 index be9cc371e..000000000 --- a/tests/pending/pos/t3999/a_1.scala +++ /dev/null @@ -1,9 +0,0 @@ -package foo - -class Outside - -package object bar { - class Val(b: Boolean) - implicit def boolean2Val(b: Boolean): foo.bar.package.Val = new Val(b) - implicit def boolean2Outside(b: Boolean): foo.Outside = new Outside -} diff --git a/tests/pending/pos/t3999/b_2.scala b/tests/pending/pos/t3999/b_2.scala deleted file mode 100644 index 775b839d9..000000000 --- a/tests/pending/pos/t3999/b_2.scala +++ /dev/null @@ -1,7 +0,0 @@ -package foo -package bar - -class A { - val s: Val = false - val o: Outside = false -} diff --git a/tests/pending/pos/t3999b.scala b/tests/pending/pos/t3999b.scala deleted file mode 100644 index 0f3f7d642..000000000 --- a/tests/pending/pos/t3999b.scala +++ /dev/null @@ -1,20 +0,0 @@ -object `package` { - trait Score { def toString : String } - trait Test[+T <: Score] { def apply(s : String) : T } - - case class FT(f : Float) extends Score - implicit object FT extends Test[FT] { def apply(s : String) : FT = new FT(s.toFloat) } - - case class IT(i : Int) extends Score - implicit object IT extends Test[IT] { def apply(s : String) : IT = new IT(s.toInt) } -} - -class TT[+T <: Score](implicit val tb : Test[T]) { - def read(s : String) : T = tb(s) -} - -object Tester { - val tt = new TT[FT] - val r = tt.read("1.0") - r.toString -} diff --git a/tests/pending/pos/t4188.scala b/tests/pending/pos/t4188.scala index 40e7d4924..104473fc5 100644 --- a/tests/pending/pos/t4188.scala +++ b/tests/pending/pos/t4188.scala @@ -1,3 +1,4 @@ +// Fails Ycheck class A { object Ding class B { diff --git a/tests/pending/pos/t4269.scala b/tests/pending/pos/t4269.scala deleted file mode 100644 index fe0c20103..000000000 --- a/tests/pending/pos/t4269.scala +++ /dev/null @@ -1,5 +0,0 @@ -class A { - PartialFunction.condOpt(Nil) { - case items@List(_: _*) if true => - } -} diff --git a/tests/pending/pos/t4579.flags b/tests/pending/pos/t4579.flags deleted file mode 100644 index 1182725e8..000000000 --- a/tests/pending/pos/t4579.flags +++ /dev/null @@ -1 +0,0 @@ --optimize
\ No newline at end of file diff --git a/tests/pending/pos/t4911.flags b/tests/pending/pos/t4911.flags deleted file mode 100644 index 779916d58..000000000 --- a/tests/pending/pos/t4911.flags +++ /dev/null @@ -1 +0,0 @@ --unchecked -Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t5029.flags b/tests/pending/pos/t5029.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/t5029.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t5330.scala b/tests/pending/pos/t5330.scala deleted file mode 100644 index 24aab7733..000000000 --- a/tests/pending/pos/t5330.scala +++ /dev/null @@ -1,22 +0,0 @@ -trait FM[A] { - def map(f: A => Any): Unit -} - -trait M[A] extends FM[A] { - def map(f: A => Any): Unit -} - -trait N[A] extends FM[A] - -object test { - def kaboom(xs: M[_]) = xs map (x => ()) // missing parameter type. - - def okay1[A](xs: M[A]) = xs map (x => ()) - def okay2(xs: FM[_]) = xs map (x => ()) - def okay3(xs: N[_]) = xs map (x => ()) -} - -class CC2(xs: List[_]) { - def f(x1: Any, x2: Any) = null - def g = xs map (x => f(x, x)) -} diff --git a/tests/pending/pos/t5604/ReplConfig.scala b/tests/pending/pos/t5604/ReplConfig.scala deleted file mode 100644 index 8c589eba6..000000000 --- a/tests/pending/pos/t5604/ReplConfig.scala +++ /dev/null @@ -1,53 +0,0 @@ -/* NSC -- new Scala compiler - * Copyright 2005-2011 LAMP/EPFL - * @author Paul Phillips - */ - -package scala.tools.nsc -package interpreter - -import util.Exceptional.unwrap -import util.stackTraceString - -trait ReplConfig { - lazy val replProps = new ReplProps - - class TapMaker[T](x: T) { - def tapInfo(msg: => String): T = tap(x => replinfo(parens(x))) - def tapDebug(msg: => String): T = tap(x => repldbg(parens(x))) - def tapTrace(msg: => String): T = tap(x => repltrace(parens(x))) - def tap[U](f: T => U): T = { - f(x) - x - } - } - - private def parens(x: Any) = "(" + x + ")" - private def echo(msg: => String) = - try Console println msg - catch { case x: AssertionError => Console.println("Assertion error printing debugging output: " + x) } - - private[nsc] def repldbg(msg: => String) = if (isReplDebug) echo(msg) - private[nsc] def repltrace(msg: => String) = if (isReplTrace) echo(msg) - private[nsc] def replinfo(msg: => String) = if (isReplInfo) echo(msg) - - private[nsc] def logAndDiscard[T](label: String, alt: => T): PartialFunction[Throwable, T] = { - case t => - repldbg(label + ": " + unwrap(t)) - repltrace(stackTraceString(unwrap(t))) - alt - } - private[nsc] def substituteAndLog[T](alt: => T)(body: => T): T = - substituteAndLog("" + alt, alt)(body) - private[nsc] def substituteAndLog[T](label: String, alt: => T)(body: => T): T = { - try body - catch logAndDiscard(label, alt) - } - private[nsc] def squashAndLog(label: String)(body: => Unit): Unit = - substituteAndLog(label, ())(body) - - def isReplTrace: Boolean = replProps.trace - def isReplDebug: Boolean = replProps.debug || isReplTrace - def isReplInfo: Boolean = replProps.info || isReplDebug - def isReplPower: Boolean = replProps.power -} diff --git a/tests/pending/pos/t5604/ReplReporter.scala b/tests/pending/pos/t5604/ReplReporter.scala deleted file mode 100644 index 9423efd8a..000000000 --- a/tests/pending/pos/t5604/ReplReporter.scala +++ /dev/null @@ -1,30 +0,0 @@ -/* NSC -- new Scala compiler - * Copyright 2002-2011 LAMP/EPFL - * @author Paul Phillips - */ - -package scala.tools.nsc -package interpreter - -import reporters._ -import IMain._ - -class ReplReporter(intp: IMain) extends ConsoleReporter(intp.settings, Console.in, new ReplStrippingWriter(intp)) { - override def printMessage(msg: String): Unit = { - // Avoiding deadlock if the compiler starts logging before - // the lazy val is complete. - if (intp.isInitializeComplete) { - if (intp.totalSilence) { - if (isReplTrace) - super.printMessage("[silent] " + msg) - } - else super.printMessage(msg) - } - else Console.println("[init] " + msg) - } - - override def displayPrompt(): Unit = { - if (intp.totalSilence) () - else super.displayPrompt() - } -} diff --git a/tests/pending/pos/t5604b/T_1.scala b/tests/pending/pos/t5604b/T_1.scala deleted file mode 100644 index 179dcb10c..000000000 --- a/tests/pending/pos/t5604b/T_1.scala +++ /dev/null @@ -1,6 +0,0 @@ -// sandbox/t5604/T.scala -package t6504 - -trait T { - def foo: Boolean = false -} diff --git a/tests/pending/pos/t5604b/T_2.scala b/tests/pending/pos/t5604b/T_2.scala deleted file mode 100644 index 179dcb10c..000000000 --- a/tests/pending/pos/t5604b/T_2.scala +++ /dev/null @@ -1,6 +0,0 @@ -// sandbox/t5604/T.scala -package t6504 - -trait T { - def foo: Boolean = false -} diff --git a/tests/pending/pos/t5604b/Test_1.scala b/tests/pending/pos/t5604b/Test_1.scala deleted file mode 100644 index f7c58ebe8..000000000 --- a/tests/pending/pos/t5604b/Test_1.scala +++ /dev/null @@ -1,7 +0,0 @@ -// sandbox/t5604/Test.scala -package t6504 - -object Test { - def blerg1(a: Any): Any = if (foo) blerg1(0) - def blerg2(a: Any): Any = if (t6504.foo) blerg2(0) -} diff --git a/tests/pending/pos/t5604b/Test_2.scala b/tests/pending/pos/t5604b/Test_2.scala deleted file mode 100644 index f7c58ebe8..000000000 --- a/tests/pending/pos/t5604b/Test_2.scala +++ /dev/null @@ -1,7 +0,0 @@ -// sandbox/t5604/Test.scala -package t6504 - -object Test { - def blerg1(a: Any): Any = if (foo) blerg1(0) - def blerg2(a: Any): Any = if (t6504.foo) blerg2(0) -} diff --git a/tests/pending/pos/t5604b/pack_1.scala b/tests/pending/pos/t5604b/pack_1.scala deleted file mode 100644 index f50d568bf..000000000 --- a/tests/pending/pos/t5604b/pack_1.scala +++ /dev/null @@ -1,5 +0,0 @@ -// sandbox/t5604/pack.scala -package t6504 - -object `package` extends T { -} diff --git a/tests/pending/pos/t5726.scala b/tests/pending/pos/t5726.scala deleted file mode 100644 index 1ef14ac79..000000000 --- a/tests/pending/pos/t5726.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.language.dynamics - -class DynamicTest extends Dynamic { - def selectDynamic(name: String) = s"value of $name" - def updateDynamic(name: String)(value: Any): Unit = { - println(s"You have just updated property '$name' with value: $value") - } -} - -object MyApp extends App { - def testing(): Unit = { - val test = new DynamicTest - test.firstName = "John" - } - - testing() -} diff --git a/tests/pending/pos/t5769.scala b/tests/pending/pos/t5769.scala deleted file mode 100644 index d7ec23a56..000000000 --- a/tests/pending/pos/t5769.scala +++ /dev/null @@ -1,9 +0,0 @@ -// a.scala -import scala.reflect.{ClassTag, classTag} - -class A { - type AI = Array[Int] - - def f1 = classTag[Array[Int]] - def f2 = classTag[AI] -} diff --git a/tests/pending/pos/t578.scala b/tests/pending/pos/t578.scala deleted file mode 100644 index 6f95dd8ce..000000000 --- a/tests/pending/pos/t578.scala +++ /dev/null @@ -1,7 +0,0 @@ -object Test { - val x = Nil - val x2: Nil.type = x - val y = None - val y2: None.type = y - Console.println("Okay") -} diff --git a/tests/pending/pos/t5899.flags b/tests/pending/pos/t5899.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/t5899.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t5899.scala b/tests/pending/pos/t5899.scala deleted file mode 100644 index 852b4e3e7..000000000 --- a/tests/pending/pos/t5899.scala +++ /dev/null @@ -1,19 +0,0 @@ -import scala.tools.nsc._ - -trait Foo { - val global: Global - import global.{Name, Symbol, nme} - - case class Bippy(name: Name) - - def f(x: Bippy, sym: Symbol): Int = { - // no warning (!) for - // val Stable = sym.name.toTermName - - val Stable = sym.name - Bippy(Stable) match { - case Bippy(nme.WILDCARD) => 1 - case Bippy(Stable) => 2 // should not be considered unreachable - } - } -} diff --git a/tests/pending/pos/t5932.flags b/tests/pending/pos/t5932.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/t5932.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t5954a/A_1.scala b/tests/pending/pos/t5954a/A_1.scala deleted file mode 100644 index 10ead0b1c..000000000 --- a/tests/pending/pos/t5954a/A_1.scala +++ /dev/null @@ -1,6 +0,0 @@ -package p1 { - object `package` { - implicit class Foo(a: Any) - object Foo - } -} diff --git a/tests/pending/pos/t5954a/B_2.scala b/tests/pending/pos/t5954a/B_2.scala deleted file mode 100644 index 10ead0b1c..000000000 --- a/tests/pending/pos/t5954a/B_2.scala +++ /dev/null @@ -1,6 +0,0 @@ -package p1 { - object `package` { - implicit class Foo(a: Any) - object Foo - } -} diff --git a/tests/pending/pos/t5954b/A_1.scala b/tests/pending/pos/t5954b/A_1.scala deleted file mode 100644 index 8465e8f8c..000000000 --- a/tests/pending/pos/t5954b/A_1.scala +++ /dev/null @@ -1,6 +0,0 @@ -package p { - package object base { - class B - object B - } -} diff --git a/tests/pending/pos/t5954b/B_2.scala b/tests/pending/pos/t5954b/B_2.scala deleted file mode 100644 index f7e4704b3..000000000 --- a/tests/pending/pos/t5954b/B_2.scala +++ /dev/null @@ -1,5 +0,0 @@ -package p { - package object base { - case class B() - } -} diff --git a/tests/pending/pos/t5954c/A_1.scala b/tests/pending/pos/t5954c/A_1.scala deleted file mode 100644 index 29ad9547a..000000000 --- a/tests/pending/pos/t5954c/A_1.scala +++ /dev/null @@ -1,18 +0,0 @@ -package object A { - // these used to should be prevented by the implementation restriction - // but are now allowed - class B - object B - trait C - object C - case class D() - // all the rest of these should be ok - class E - object F - val g = "omg" - var h = "wtf" - def i = "lol" - type j = String - class K(val k : Int) extends AnyVal - implicit class L(val l : Int) -} diff --git a/tests/pending/pos/t5954c/B_2.scala b/tests/pending/pos/t5954c/B_2.scala deleted file mode 100644 index 29ad9547a..000000000 --- a/tests/pending/pos/t5954c/B_2.scala +++ /dev/null @@ -1,18 +0,0 @@ -package object A { - // these used to should be prevented by the implementation restriction - // but are now allowed - class B - object B - trait C - object C - case class D() - // all the rest of these should be ok - class E - object F - val g = "omg" - var h = "wtf" - def i = "lol" - type j = String - class K(val k : Int) extends AnyVal - implicit class L(val l : Int) -} diff --git a/tests/pending/pos/t5954d/A_1.scala b/tests/pending/pos/t5954d/A_1.scala deleted file mode 100644 index 8465e8f8c..000000000 --- a/tests/pending/pos/t5954d/A_1.scala +++ /dev/null @@ -1,6 +0,0 @@ -package p { - package object base { - class B - object B - } -} diff --git a/tests/pending/pos/t5954d/B_2.scala b/tests/pending/pos/t5954d/B_2.scala deleted file mode 100644 index a4aa2eb58..000000000 --- a/tests/pending/pos/t5954d/B_2.scala +++ /dev/null @@ -1,7 +0,0 @@ -package p { - trait T { - class B - object B - } - package object base extends T -} diff --git a/tests/pending/pos/t6084.scala b/tests/pending/pos/t6084.scala deleted file mode 100644 index 1aa1fed39..000000000 --- a/tests/pending/pos/t6084.scala +++ /dev/null @@ -1,15 +0,0 @@ -package object foo { type X[T, U] = (T => U) } - -package foo { - abstract class Foo[T, U](val d: T => U) extends (T => U) { - def f1(r: X[T, U]) = r match { case x: Foo[_,_] => x.d } // inferred ok - def f2(r: X[T, U]): (T => U) = r match { case x: Foo[_,_] => x.d } // dealiased ok - def f3(r: X[T, U]): X[T, U] = r match { case x: Foo[_,_] => x.d } // alias not ok - - // x.d : foo.this.package.type.X[?scala.reflect.internal.Types$NoPrefix$?.T, ?scala.reflect.internal.Types$NoPrefix$?.U] ~>scala.this.Function1[?scala.reflect.internal.Types$NoPrefix$?.T, ?scala.reflect.internal.Types$NoPrefix$?.U] - // at scala.Predef$.assert(Predef.scala:170) - // at scala.tools.nsc.Global.assert(Global.scala:235) - // at scala.tools.nsc.ast.TreeGen.mkCast(TreeGen.scala:252) - // at scala.tools.nsc.typechecker.Typers$Typer.typedCase(Typers.scala:2263) - } -} diff --git a/tests/pending/pos/t6123-explaintypes-implicits.flags b/tests/pending/pos/t6123-explaintypes-implicits.flags deleted file mode 100644 index b36707c7c..000000000 --- a/tests/pending/pos/t6123-explaintypes-implicits.flags +++ /dev/null @@ -1 +0,0 @@ --explaintypes diff --git a/tests/pending/pos/t6722.scala b/tests/pending/pos/t6722.scala deleted file mode 100644 index 576746c91..000000000 --- a/tests/pending/pos/t6722.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.language.dynamics - -class Dyn extends Dynamic { - def selectDynamic(s: String): Dyn = new Dyn - def get[T]: T = null.asInstanceOf[T] -} - -object Foo { - val dyn = new Dyn - dyn.foo.bar.baz.get[String] -} diff --git a/tests/pending/pos/t6815_import.scala b/tests/pending/pos/t6815_import.scala deleted file mode 100644 index 56f4358d5..000000000 --- a/tests/pending/pos/t6815_import.scala +++ /dev/null @@ -1,16 +0,0 @@ -trait U { - trait ValOrDefDefApi { - def name: Any - } - type ValOrDefDef <: ValOrDefDefApi - type ValDef <: ValOrDefDef with ValDefApi - trait ValDefApi extends ValOrDefDefApi { this: ValDef => } - val emptyValDef: ValDef // the result type is volatile -} - -object Test { - val u: U = ??? - - // but we shouldn't let that stop us from treating it as a stable identifier for import - import u.emptyValDef.name -} diff --git a/tests/pending/pos/t6948.scala b/tests/pending/pos/t6948.scala deleted file mode 100644 index 12a1d7eaf..000000000 --- a/tests/pending/pos/t6948.scala +++ /dev/null @@ -1,10 +0,0 @@ -object t6948 { - val rand = new scala.util.Random() - def a1 = rand.shuffle(0 to 5) - // Tis not to be - // def a2 = rand.shuffle(0 until 5) - def a3 = rand.shuffle(Vector(1, 2, 3)) - def a4 = rand.shuffle(scala.collection.Seq(1, 2, 3)) - def a5 = rand.shuffle(scala.collection.immutable.Seq(1, 2, 3)) - def a6 = rand.shuffle(scala.collection.mutable.Seq(1, 2, 3)) -} diff --git a/tests/pending/pos/t6994.flags b/tests/pending/pos/t6994.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/t6994.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t7011.flags b/tests/pending/pos/t7011.flags deleted file mode 100644 index a4c161553..000000000 --- a/tests/pending/pos/t7011.flags +++ /dev/null @@ -1 +0,0 @@ --Ydebug -Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t7035.scala b/tests/pending/pos/t7035.scala deleted file mode 100644 index f45bd0a87..000000000 --- a/tests/pending/pos/t7035.scala +++ /dev/null @@ -1,15 +0,0 @@ -case class Y(final var x: Int, final private var y: String, final val z1: Boolean, final private val z2: Any) { - - import Test.{y => someY} - List(someY.x: Int, someY.y: String, someY.z1: Boolean, someY.z2: Any) - someY.y = "" -} - -object Test { - val y = Y(0, "", true, new {}) - val unapp: Option[(Int, String, Boolean, Any)] = // was (Int, Boolean, String, Any) !! - Y.unapply(y) - - val Y(a, b, c, d) = y - List(a: Int, b: String, c: Boolean, d: Any) -} diff --git a/tests/pending/pos/t7228.scala b/tests/pending/pos/t7228.scala deleted file mode 100644 index 5d936f652..000000000 --- a/tests/pending/pos/t7228.scala +++ /dev/null @@ -1,75 +0,0 @@ -object AdaptWithWeaklyConformantType { - implicit class D(d: Double) { def double = d*2 } - - val x1: Int = 1 - var x2: Int = 2 - val x3 = 3 - var x4 = 4 - final val x5 = 5 - final var x6 = 6 - - def f1 = x1.double - def f2 = x2.double - def f3 = x3.double - def f4 = x4.double - def f5 = x5.double - def f6 = x6.double -} - -object AdaptAliasWithWeaklyConformantType { - implicit class D(d: Double) { def double = d*2 } - type T = Int - - val x1: T = 1 - var x2: T = 2 - val x3 = (3: T) - var x4 = (4: T) - final val x5 = (5: T) - final var x6 = (6: T) - - def f1 = x1.double - def f2 = x2.double - def f3 = x3.double - def f4 = x4.double - def f5 = x5.double - def f6 = x6.double -} - -object AdaptToAliasWithWeaklyConformantType { - type U = Double - implicit class D(d: U) { def double = d*2 } - - val x1: Int = 1 - var x2: Int = 2 - val x3 = (3: Int) - var x4 = (4: Int) - final val x5 = (5: Int) - final var x6 = (6: Int) - - def f1 = x1.double - def f2 = x2.double - def f3 = x3.double - def f4 = x4.double - def f5 = x5.double - def f6 = x6.double -} - -object AdaptAliasToAliasWithWeaklyConformantType { - type U = Double - type T = Int - implicit class D(d: U) { def double = d*2 } - - val x1: T = 1 - var x2: T = 2 - val x3 = (3: T) - var x4 = (4: T) - final val x5 = (5: T) - final var x6 = (6: T) - - def f1 = x1.double - def f2 = x2.double - def f3 = x3.double - def f4 = x4.double - def f5 = x5.double - def f6 = x6.double -} diff --git a/tests/pending/pos/t7239.scala b/tests/pending/pos/t7239.scala deleted file mode 100644 index 16e9d00f1..000000000 --- a/tests/pending/pos/t7239.scala +++ /dev/null @@ -1,38 +0,0 @@ -object Test { - def BrokenMethod(): HasFilter[(Int, String)] = ??? - - trait HasFilter[B] { - def filter(p: B => Boolean) = ??? - } - - trait HasWithFilter { - def withFilter = ??? - } - - object addWithFilter { - trait NoImplicit - implicit def enrich(v: Any) - (implicit F0: NoImplicit): HasWithFilter = ??? - } - - BrokenMethod().withFilter(_ => true) // okay - BrokenMethod().filter(_ => true) // okay - - locally { - import addWithFilter._ - BrokenMethod().withFilter((_: (Int, String)) => true) // okay - } - - locally { - import addWithFilter._ - // adaptToMemberWithArgs sets the type of the tree `x` - // to ErrorType (while in silent mode, so the error is not - // reported. Later, when the fallback from `withFilter` - // to `filter` is attempted, the closure is taken to have - // have the type `<error> => Boolean`, which conforms to - // `(B => Boolean)`. Only later during pickling does the - // defensive check for erroneous types in the tree pick up - // the problem. - BrokenMethod().withFilter(x => true) // erroneous or inaccessible type. - } -} diff --git a/tests/pending/pos/t7285a.flags b/tests/pending/pos/t7285a.flags deleted file mode 100644 index e8fb65d50..000000000 --- a/tests/pending/pos/t7285a.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings
\ No newline at end of file diff --git a/tests/pending/pos/t7294.scala b/tests/pending/pos/t7294.scala deleted file mode 100644 index ccac2b140..000000000 --- a/tests/pending/pos/t7294.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Test { - // no fruitless warning as Tuple2 isn't (yet) final. - // The corresponding `neg` test will treat it as final - // for the purposes of these tests under -Xfuture. - (1, 2) match { case Seq() => 0; case _ => 1 } -} diff --git a/tests/pending/pos/t7296.scala b/tests/pending/pos/t7296.scala index 0c078d365..fcba17c08 100644 --- a/tests/pending/pos/t7296.scala +++ b/tests/pending/pos/t7296.scala @@ -1,3 +1,4 @@ +// Fails Ycheck object Test { type A = Int // Emits the implementation restriction but then proceeds to crash diff --git a/tests/pending/pos/t7426.scala b/tests/pending/pos/t7426.scala deleted file mode 100644 index 8e42ad181..000000000 --- a/tests/pending/pos/t7426.scala +++ /dev/null @@ -1,3 +0,0 @@ -class foo(x: Any) extends annotation.StaticAnnotation - -@foo(new AnyRef { }) trait A diff --git a/tests/pending/pos/t7517.scala b/tests/pending/pos/t7517.scala deleted file mode 100644 index d0462c48d..000000000 --- a/tests/pending/pos/t7517.scala +++ /dev/null @@ -1,23 +0,0 @@ -// Invalid because nested hk type parameters are no longer allowed -trait Box[ K[A[x]] ] - -object Box { - // type constructor composition - sealed trait ∙[A[_], B[_]] { type l[T] = A[B[T]] } - - // composes type constructors inside K - type SplitBox[K[A[x]], B[x]] = Box[ ({ type l[A[x]] = K[ (A ∙ B)#l] })#l ] - - def split[ K[A[x]], B[x] ](base: Box[K]): SplitBox[K,B] = ??? - - class Composed[B[_], L[A[x]] ] { - val box: Box[L] = ??? - - type Split[ A[x] ] = L[ (A ∙ B)#l ] - val a: Box[Split] = Box.split(box) - - //Either of these work: - val a1: Box[Split] = Box.split[L,B](box) - val a2: Box[ ({ type l[A[x]] = L[ (A ∙ B)#l ] })#l ] = Box.split(box) - } -} diff --git a/tests/pending/pos/t762.scala b/tests/pending/pos/t762.scala deleted file mode 100644 index 76860272e..000000000 --- a/tests/pending/pos/t762.scala +++ /dev/null @@ -1,2 +0,0 @@ -trait Foo { type T } -trait Bar extends Foo { val x : Foo { type T <: Bar.this.T } = this : this.type } diff --git a/tests/pending/pos/t7668.scala b/tests/pending/pos/t7668.scala deleted file mode 100644 index 222a13d03..000000000 --- a/tests/pending/pos/t7668.scala +++ /dev/null @@ -1,12 +0,0 @@ -trait Space { - type T - val x: T -} - -trait Extractor { - def extract(s: Space): s.T -} - -class Sub extends Extractor { - def extract(s: Space) = s.x -} diff --git a/tests/pending/pos/t7688.scala b/tests/pending/pos/t7688.scala deleted file mode 100644 index 5a846b97e..000000000 --- a/tests/pending/pos/t7688.scala +++ /dev/null @@ -1,7 +0,0 @@ -import scala.reflect.macros._ - -class A[C <: Context with Singleton](position: C#Position) - -object A { - def apply(c: Context)(in: c.Tree): A[c.type] = new A(in.pos) -} diff --git a/tests/pending/pos/t7902.scala b/tests/pending/pos/t7902.scala deleted file mode 100644 index 7793d3723..000000000 --- a/tests/pending/pos/t7902.scala +++ /dev/null @@ -1,18 +0,0 @@ -// Invalid because nested hk type parameters are no longer allowed -import scala.language.higherKinds - -object Bug { - class Tag[W[M1[X1]]] - - def ofType[W[M2[X2]]]: Tag[W] = ??? - type InSeq [M3[X3]] = Some[M3[Any]] - - // fail - val x = ofType[InSeq] - - // okay - val y: Any = ofType[InSeq] - object T { - val z = ofType[InSeq] - } -} diff --git a/tests/pending/pos/t8002-nested-scope.scala b/tests/pending/pos/t8002-nested-scope.scala deleted file mode 100644 index a2088bce7..000000000 --- a/tests/pending/pos/t8002-nested-scope.scala +++ /dev/null @@ -1,20 +0,0 @@ -// This test serves to capture the status quo, but should really -// emit an accessibiltiy error. - -// `Namers#companionSymbolOf` seems too lenient, and currently doesn't -// implement the same-scope checks mentioned: -// -// https://github.com/scala/scala/pull/2816#issuecomment-22555206 -// -class C { - def foo = { - class C { private def x = 0 } - - { - val a = 0 - object C { - new C().x - } - } - } -} diff --git a/tests/pending/pos/t8046c.scala b/tests/pending/pos/t8046c.scala deleted file mode 100644 index f05b4c15b..000000000 --- a/tests/pending/pos/t8046c.scala +++ /dev/null @@ -1,19 +0,0 @@ -trait One { - type Op[A] - type Alias[A] = Op[A] -} - -trait Three extends One { - trait Op[A] extends (A => A) - - def f1(f: Op[Int]) = f(5) - def f2(f: Alias[Int]) = f(5) - def f3[T <: Op[Int]](f: T) = f(5) - def f4[T <: Alias[Int]](f: T) = f(5) - // ./a.scala:12: error: type mismatch; - // found : Int(5) - // required: T1 - // def f4[T <: Alias[Int]](f: T) = f(5) - // ^ -} - diff --git a/tests/pending/pos/t807.scala b/tests/pending/pos/t807.scala deleted file mode 100644 index 0eeb92ea2..000000000 --- a/tests/pending/pos/t807.scala +++ /dev/null @@ -1,45 +0,0 @@ -trait Matcher { - trait Link { - type Self <: Link; - type Match <: Link { type Match = Link.this.Self; } - } - trait HasLinks { - def link(b : Boolean) : Link = null; - } - -} -trait BraceMatcher extends Matcher { - trait BracePair { - trait BraceLink extends Link; - trait OpenLink extends BraceLink { - type Self = OpenLink; - type Match = CloseLink; - } - trait CloseLink extends BraceLink { - type Self = CloseLink; - type Match = OpenLink; - } - } -} -trait IfElseMatcher extends BraceMatcher { - trait IfElseLink extends Link; - trait IfLink extends IfElseLink { - type Self = IfLink; - type Match = ElseImpl; - } - trait ElseImpl extends IfElseLink with HasLinks { - type Self = ElseImpl; - type Match = IfLink; - override def link(b : Boolean) = this; - } - val parenPair : BracePair; - trait IfWithParenImpl extends HasLinks { - object ifLink extends IfLink; - object openParen extends parenPair.OpenLink; - override def link(b : Boolean): Link = b match { - case true => ifLink; - case false => openParen; - } - } -} - diff --git a/tests/pending/pos/t8111.scala b/tests/pending/pos/t8111.scala deleted file mode 100644 index 3f0e766ce..000000000 --- a/tests/pending/pos/t8111.scala +++ /dev/null @@ -1,24 +0,0 @@ -trait T { - - def crashy(ma: Any): Unit = { - // okay - val f1 = (u: Unit) => ma - foo(f1)() - foo((u: Unit) => ma) - foo(0, (u: Any) => ma) apply () - - // crash due to side effects on the onwer of the symbol in the - // qualifier or arguments of the application during an abandoned - // names/defaults transform. The code type checkes because of - // autp-tupling which promotes and empty parmater list to `(): Unit` - foo((u: Any) => ma)() - - {{(u: Any) => ma}; this}.foo(0)() - - foo({def foo = ma; 0})() - - {def foo = ma; this}.foo(0)() - } - - def foo(f: Any): Any => Any -} diff --git a/tests/pending/pos/t8134/A_1.scala b/tests/pending/pos/t8134/A_1.scala deleted file mode 100644 index 32bce003f..000000000 --- a/tests/pending/pos/t8134/A_1.scala +++ /dev/null @@ -1,4 +0,0 @@ -// a.scala -package object pkg { - class AnyOps(val x: Any) extends AnyVal -} diff --git a/tests/pending/pos/t8134/B_2.scala b/tests/pending/pos/t8134/B_2.scala deleted file mode 100644 index 32bce003f..000000000 --- a/tests/pending/pos/t8134/B_2.scala +++ /dev/null @@ -1,4 +0,0 @@ -// a.scala -package object pkg { - class AnyOps(val x: Any) extends AnyVal -} diff --git a/tests/pending/pos/t8146a.scala b/tests/pending/pos/t8146a.scala deleted file mode 100644 index e4eb8d3fd..000000000 --- a/tests/pending/pos/t8146a.scala +++ /dev/null @@ -1,9 +0,0 @@ -trait M[+A] - -object Test { - type Inty = Int - def t1( - x: M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[Int @unchecked]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] - ): M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[M[Inty @unchecked]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] - = x -} diff --git a/tests/pending/pos/t8187.check b/tests/pending/pos/t8187.check deleted file mode 100644 index e69de29bb..000000000 --- a/tests/pending/pos/t8187.check +++ /dev/null diff --git a/tests/pending/pos/t8237b.scala b/tests/pending/pos/t8237b.scala deleted file mode 100644 index 52bb310e8..000000000 --- a/tests/pending/pos/t8237b.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.language.higherKinds -import scala.reflect.runtime.universe._ -object Test { - - def fTt[A,E[X]<:List[X]](a: A)(implicit tt: TypeTag[E[A]]) = a - - trait TC[A] - implicit def TCListInt[A]: TC[A] = ??? - fTt(1) -} diff --git a/tests/pending/pos/t8300-patmat-a.scala b/tests/pending/pos/t8300-patmat-a.scala deleted file mode 100644 index ab3a3c960..000000000 --- a/tests/pending/pos/t8300-patmat-a.scala +++ /dev/null @@ -1,20 +0,0 @@ -// cf. pos/t8300-patmat-b.scala -trait Universe { - type Name >: Null <: AnyRef with NameApi - trait NameApi - - type TermName >: Null <: Name with TermNameApi - trait TermNameApi extends NameApi -} - -object Test extends App { - val u: Universe = ??? - import u._ - - locally { - val ScalaName: TermName = ??? - ??? match { - case ScalaName => ??? - } - } -} diff --git a/tests/pending/pos/t8300-patmat-b.scala b/tests/pending/pos/t8300-patmat-b.scala deleted file mode 100644 index 0acad4406..000000000 --- a/tests/pending/pos/t8300-patmat-b.scala +++ /dev/null @@ -1,20 +0,0 @@ -// cf. pos/t8300-patmat-a.scala -trait Universe { - type Name >: Null <: AnyRef with NameApi - trait NameApi - - type TermName >: Null <: TermNameApi with Name - trait TermNameApi extends NameApi -} - -object Test extends App { - val u: Universe = ??? - import u._ - - locally { - val ScalaName: TermName = ??? - ??? match { - case ScalaName => ??? - } - } -} diff --git a/tests/pending/pos/t8301b.scala b/tests/pending/pos/t8301b.scala deleted file mode 100644 index 4dd39139d..000000000 --- a/tests/pending/pos/t8301b.scala +++ /dev/null @@ -1,36 +0,0 @@ -// cf. pos/t8300-patmat.scala -trait Universe { - type Name >: Null <: AnyRef with NameApi - trait NameApi - - type TermName >: Null <: TermNameApi with Name - trait TermNameApi extends NameApi -} - -object Test extends App { - val u: Universe = ??? - import u._ - - val ScalaName: TermName = ??? - locally { - - ??? match { - case Test.ScalaName => ??? - } - import Test.ScalaName._ - - ??? match { - case ScalaName => ??? - } - import ScalaName._ - - // both the pattern and import led to - // stable identifier required, but SN found. Note that value SN - // is not stable because its type, Test.u.TermName, is volatile. - val SN = ScalaName - ??? match { - case SN => ??? - } - import SN._ - } -} diff --git a/tests/pending/pos/t8364.check b/tests/pending/pos/t8364.check deleted file mode 100644 index e69de29bb..000000000 --- a/tests/pending/pos/t8364.check +++ /dev/null diff --git a/tests/pending/pos/t8364.scala b/tests/pending/pos/t8364.scala deleted file mode 100644 index 7a7ea1ff1..000000000 --- a/tests/pending/pos/t8364.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.language.dynamics - -object MyDynamic extends Dynamic { - def selectDynamic(name: String): Any = ??? -} - -object Test extends App { - locally { - import java.lang.String - MyDynamic.id - } -} diff --git a/tests/pending/pos/t8369a.check b/tests/pending/pos/t8369a.check deleted file mode 100644 index e69de29bb..000000000 --- a/tests/pending/pos/t8369a.check +++ /dev/null diff --git a/tests/pending/pos/trait-force-info.flags b/tests/pending/pos/trait-force-info.flags deleted file mode 100644 index eb4d19bcb..000000000 --- a/tests/pending/pos/trait-force-info.flags +++ /dev/null @@ -1 +0,0 @@ --optimise
\ No newline at end of file diff --git a/tests/pending/pos/trait-force-info.scala b/tests/pending/pos/trait-force-info.scala deleted file mode 100644 index c2b33869c..000000000 --- a/tests/pending/pos/trait-force-info.scala +++ /dev/null @@ -1,18 +0,0 @@ -/** This does NOT crash unless it's in the interactive package. - */ - -package scala.tools.nsc -package interactive - -trait MyContextTrees { - val self: Global - val NoContext = self.analyzer.NoContext -} -// -// error: java.lang.AssertionError: assertion failed: trait Contexts.NoContext$ linkedModule: <none>List() -// at scala.Predef$.assert(Predef.scala:160) -// at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.innerSymbol$1(ClassfileParser.scala:1211) -// at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.classSymbol(ClassfileParser.scala:1223) -// at scala.tools.nsc.symtab.classfile.ClassfileParser.classNameToSymbol(ClassfileParser.scala:489) -// at scala.tools.nsc.symtab.classfile.ClassfileParser.sig2type$1(ClassfileParser.scala:757) -// at scala.tools.nsc.symtab.classfile.ClassfileParser.sig2type$1(ClassfileParser.scala:789) diff --git a/tests/pending/pos/virtpatmat_alts_subst.flags b/tests/pending/pos/virtpatmat_alts_subst.flags deleted file mode 100644 index 3f5a3100e..000000000 --- a/tests/pending/pos/virtpatmat_alts_subst.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/tests/pending/pos/virtpatmat_exist1.flags b/tests/pending/pos/virtpatmat_exist1.flags deleted file mode 100644 index 3f5a3100e..000000000 --- a/tests/pending/pos/virtpatmat_exist1.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/tests/pending/pos/virtpatmat_exist3.flags b/tests/pending/pos/virtpatmat_exist3.flags deleted file mode 100644 index 3f5a3100e..000000000 --- a/tests/pending/pos/virtpatmat_exist3.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/tests/pending/run/applydynamic_sip.check b/tests/pending/run/applydynamic_sip.check deleted file mode 100644 index 6d04dc452..000000000 --- a/tests/pending/run/applydynamic_sip.check +++ /dev/null @@ -1,29 +0,0 @@ -qual.applyDynamic(sel)() -qual.applyDynamic(sel)(a) -qual.applyDynamic(sel)(a) -.apply(a2) -qual.applyDynamic(sel)(a) -qual.applyDynamic(sel)(a) -.apply(a2) -qual.applyDynamicNamed(sel)((arg,a)) -qual.applyDynamicNamed(sel)((arg,a)) -qual.applyDynamicNamed(sel)((,a), (arg2,a2)) -qual.updateDynamic(sel)(expr) -qual.selectDynamic(sel) -qual.selectDynamic(sel) -qual.selectDynamic(sel) -.update(1, expr) -qual.selectDynamic(sel) -.update(expr) -qual.selectDynamic(sel) -.apply(1) -qual.selectDynamic(sel) -.apply -.update(1, 1) -qual.applyDynamic(apply)(a) -qual.applyDynamic(apply)(a) -qual.applyDynamic(apply)(a) -qual.applyDynamic(apply)(a) -qual.applyDynamicNamed(apply)((arg,a)) -qual.applyDynamicNamed(apply)((,a), (arg2,a2)) -qual.applyDynamic(update)(a, a2) diff --git a/tests/pending/run/applydynamic_sip.flags b/tests/pending/run/applydynamic_sip.flags deleted file mode 100644 index ba6d37305..000000000 --- a/tests/pending/run/applydynamic_sip.flags +++ /dev/null @@ -1,2 +0,0 @@ --Yrangepos:false --language:dynamics diff --git a/tests/pending/run/applydynamic_sip.scala b/tests/pending/run/applydynamic_sip.scala deleted file mode 100644 index a163ab960..000000000 --- a/tests/pending/run/applydynamic_sip.scala +++ /dev/null @@ -1,66 +0,0 @@ -object Test extends dotty.runtime.LegacyApp { - object stubUpdate { - def update(as: Any*) = println(".update"+as.toList.mkString("(",", ", ")")) - } - - object stub { - def apply = {println(".apply"); stubUpdate} - def apply(as: Any*) = println(".apply"+as.toList.mkString("(",", ", ")")) - def update(as: Any*) = println(".update"+as.toList.mkString("(",", ", ")")) - } - class MyDynamic extends Dynamic { - def applyDynamic[T](n: String)(as: Any*) = {println("qual.applyDynamic("+ n +")"+ as.toList.mkString("(",", ", ")")); stub} - def applyDynamicNamed[T](n: String)(as: (String, Any)*) = {println("qual.applyDynamicNamed("+ n +")"+ as.toList.mkString("(",", ", ")")); stub} - def selectDynamic[T](n: String) = {println("qual.selectDynamic("+ n +")"); stub} - def updateDynamic(n: String)(x: Any): Unit = {println("qual.updateDynamic("+ n +")("+ x +")")} - } - val qual = new MyDynamic - val expr = "expr" - val a = "a" - val a2 = "a2" - type T = String - - // If qual.sel is followed by a potential type argument list [Ts] and an argument list (arg1, …, argn) where none of the arguments argi are named: - // qual.applyDynamic(“sel”)(arg1, …, argn) - qual.sel() - qual.sel(a) - // qual.sel(a, a2: _*) -- should not accept varargs? - qual.sel(a)(a2) - qual.sel[T](a) - qual.sel[T](a)(a2) - - // If qual.sel is followed by a potential type argument list [Ts] - // and a non-empty named argument list (x1 = arg1, …, xn = argn) where some name prefixes xi = might be missing: - // qual.applyDynamicNamed(“sel”)(xs1 -> arg1, …, xsn -> argn) - qual.sel(arg = a) - qual.sel[T](arg = a) - qual.sel(a, arg2 = "a2") - // qual.sel(a)(a2, arg2 = "a2") - // qual.sel[T](a)(a2, arg2 = "a2") - // qual.sel(arg = a, a2: _*) - // qual.sel(arg, arg2 = "a2", a2: _*) - - // If qual.sel appears immediately on the left-hand side of an assigment - // qual.updateDynamic(“sel”)(expr) - qual.sel = expr - - // If qual.sel, possibly applied to type arguments, but is - // not applied to explicit value arguments, - // nor immediately followed by an assignment operator: - // qual.selectDynamic[Ts](“sel”) - qual.sel - qual.sel[T] - - qual.sel(1) = expr // parser turns this into qual.sel.update(1, expr) - qual.sel() = expr // parser turns this into qual.sel.update(expr) - qual.sel.apply(1) - qual.sel.apply(1) = 1 - - qual.apply(a) - qual.apply[String](a) - qual(a) - qual[String](a) - qual[T](arg = a) - qual(a, arg2 = "a2") - qual(a) = a2 -} diff --git a/tests/pending/run/dynamic-anyval.check b/tests/pending/run/dynamic-anyval.check deleted file mode 100644 index dee7bef8e..000000000 --- a/tests/pending/run/dynamic-anyval.check +++ /dev/null @@ -1,4 +0,0 @@ -().dingo(bippy, 5) -List(1, 2, 3).dingo(bippy, 5) -().dingo(bippy, 5) -List(1, 2, 3).dingo(bippy, 5) diff --git a/tests/pending/run/dynamic-anyval.scala b/tests/pending/run/dynamic-anyval.scala deleted file mode 100644 index 605503d37..000000000 --- a/tests/pending/run/dynamic-anyval.scala +++ /dev/null @@ -1,22 +0,0 @@ -import scala.language.dynamics - -object Test { - implicit class DynamicValue[T](val value: T) extends AnyVal with Dynamic { - def applyDynamic(name: String)(args: Any*) = println(s"""$this.$name(${args mkString ", "})""") - override def toString = "" + value - } - implicit class DynamicValue2[T](val value: T) extends Dynamic { - def applyDynamic(name: String)(args: Any*) = println(s"""$this.$name(${args mkString ", "})""") - override def toString = "" + value - } - - def f[T](x: DynamicValue[T]) = x.dingo("bippy", 5) - def g[T](x: DynamicValue2[T]) = x.dingo("bippy", 5) - - def main(args: Array[String]): Unit = { - f(()) - f(List(1, 2, 3)) - g(()) - g(List(1, 2, 3)) - } -} diff --git a/tests/pending/run/t2337.check b/tests/pending/run/t2337.check deleted file mode 100644 index 18f1f66fc..000000000 --- a/tests/pending/run/t2337.check +++ /dev/null @@ -1,4 +0,0 @@ -(Both Int,-1,-1) -(Both Float,1,1) -(Float then Int,0,0) -(Int then Float,0,0) diff --git a/tests/pending/run/t2337.scala b/tests/pending/run/t2337.scala deleted file mode 100644 index edb574cba..000000000 --- a/tests/pending/run/t2337.scala +++ /dev/null @@ -1,21 +0,0 @@ - -object Test { - - def compare(first: Any, second: Any): Any = { - (first, second) match { - case (k: Int, o: Int) => k compare o - //why the next case matches (Float, Int) but does not match (Int, Float) ??? - case (k: Number, o: Number) => k.doubleValue() compare o.doubleValue() - case _ => "BOGON" - // throw new Exception("Unsupported compare " + first + "; " + second) - } - } - - def main(args: Array[String]): Unit = { - println("Both Int", -1, compare(0, 1)) - println("Both Float", 1, compare(1.0, 0.0)) - println("Float then Int", 0, compare(10.0, 10)) - println("Int then Float", 0, compare(10, 10.0)) //this fails with an exception - } -} - diff --git a/tests/pending/run/t298.check b/tests/pending/run/t298.check deleted file mode 100644 index 1cd1d2266..000000000 --- a/tests/pending/run/t298.check +++ /dev/null @@ -1,2 +0,0 @@ -List(42, 24) -List((42,42), (24,24)) diff --git a/tests/pending/run/t298.scala b/tests/pending/run/t298.scala deleted file mode 100644 index 5728bb6c9..000000000 --- a/tests/pending/run/t298.scala +++ /dev/null @@ -1,17 +0,0 @@ -object Test extends dotty.runtime.LegacyApp { - implicit def anyList[T]: List[T] = Nil - - implicit def intList: List[Int] = 42::24::Nil - - def foo[T](implicit x: T) = x - - val s = foo[List[Int]] - - println(s) // correct - prints "List(42, 24)" - - implicit def tupleList[T](implicit t: List[T]): List[(T,T)] = t.map(x => (x,x)) - - val t = foo[List[Tuple2[Int,Int]]] - - println(t) // incorrect - prints "List()" -} diff --git a/tests/pending/run/t3026.check b/tests/pending/run/t3026.check deleted file mode 100644 index 8c29b615f..000000000 --- a/tests/pending/run/t3026.check +++ /dev/null @@ -1,2 +0,0 @@ -RED -YELLOW diff --git a/tests/pending/run/t3026.scala b/tests/pending/run/t3026.scala deleted file mode 100755 index 22dde9cc0..000000000 --- a/tests/pending/run/t3026.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Test { - abstract class Colour - case object RED extends Colour - case object YELLOW extends Colour - val items = Array(RED, YELLOW) - - def main(args: Array[String]): Unit = items foreach println -} diff --git a/tests/pending/run/t3050.scala b/tests/pending/run/t3050.scala deleted file mode 100644 index 160f8b664..000000000 --- a/tests/pending/run/t3050.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test { - def main(args: Array[String]): Unit = { - val x = - try { ("": Any) match { case List(_*) => true } } - catch { case _: Throwable => false } - - assert(!x) - } -} diff --git a/tests/pending/run/t3150.scala b/tests/pending/run/t3150.scala index 034703b5f..dc95af373 100644 --- a/tests/pending/run/t3150.scala +++ b/tests/pending/run/t3150.scala @@ -1,10 +1,26 @@ -object Test { - case object Bob { override def equals(other: Any) = true } - def f(x: Any) = x match { case Bob => Bob } - - def main(args: Array[String]): Unit = { - assert(f(Bob) eq Bob) - assert(f(0) eq Bob) - assert(f(Nil) eq Bob) - } -} + object Test { + case object Bob { override def equals(other: Any) = true } + + class Bob2 { + override def equals(other: Any) = true + } + val Bob2 = new Bob2 + + def f0(x: Any) = x match { case Bob2 => Bob2 } // class cast exception at runtime, dotc only + def f1(x: Any) = x match { case Bob => Bob } // class cast exception at runtime, dotc only + def f2(x: Any): Bob.type = x match { case x @ Bob => x } // class cast exception at runtime, dotc and javac. + + def main(args: Array[String]): Unit = { + assert(f0(Bob2) eq Bob2) + assert(f0(0) eq Bob2) // only dotty fails here + assert(f0(Nil) eq Bob2) + + assert(f1(Bob) eq Bob) + assert(f1(0) eq Bob) // only dotty fails here + assert(f1(Nil) eq Bob) + + assert(f2(Bob) eq Bob) + assert(f2(0) eq Bob) // both dotty and scalac fail here + assert(f2(Nil) eq Bob) + } + } diff --git a/tests/pending/run/t3353.check b/tests/pending/run/t3353.check deleted file mode 100644 index 8b4ae1fe6..000000000 --- a/tests/pending/run/t3353.check +++ /dev/null @@ -1 +0,0 @@ -Got: foo and None diff --git a/tests/pending/run/t3353.scala b/tests/pending/run/t3353.scala deleted file mode 100644 index 472723b3c..000000000 --- a/tests/pending/run/t3353.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test extends dotty.runtime.LegacyApp { - - "foo" match { - case Matcher(result) => println(result) - } - - object Matcher{ - def unapply(s: String)(implicit secondParam: Option[String] = None) = Some("Got: " + s + " and " + secondParam) - } -} diff --git a/tests/pending/run/t4536.check b/tests/pending/run/t4536.check deleted file mode 100644 index 0c5a72ada..000000000 --- a/tests/pending/run/t4536.check +++ /dev/null @@ -1,8 +0,0 @@ -cls: bar -obj: foo -obj: bar -cls: bar -obj: bar -trait: pili -trait: mili -trait: foo
\ No newline at end of file diff --git a/tests/pending/run/t4536.flags b/tests/pending/run/t4536.flags deleted file mode 100644 index 1141f9750..000000000 --- a/tests/pending/run/t4536.flags +++ /dev/null @@ -1 +0,0 @@ --language:dynamics diff --git a/tests/pending/run/t4536.scala b/tests/pending/run/t4536.scala deleted file mode 100644 index 6661eae6a..000000000 --- a/tests/pending/run/t4536.scala +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - -object dynamicObject extends Dynamic { - def applyDynamic(m: String)() = println("obj: " + m); - this.foo() -} - - -class dynamicClass extends Dynamic { - def applyDynamic(m: String)() = println("cls: " + m); - this.bar() - dynamicObject.bar() -} - - -abstract class dynamicAbstractClass extends Dynamic { - def applyDynamic(m: String)(args: Any*): Unit - this.pili(1, new dynamicClass, "hello"); -} - - -trait dynamicTrait extends Dynamic { - def applyDynamic(m: String)(args: Any*) = println("trait: " + m); - def two = 2 - this.mili(1,2,3) - two -} - - -object dynamicMixin extends dynamicAbstractClass with dynamicTrait { - this.foo(None) -} - - -object Test { - - def main(args: Array[String]) { - val cls = new dynamicClass - dynamicMixin - } - -} diff --git a/tests/pending/run/t5040.check b/tests/pending/run/t5040.check deleted file mode 100644 index 3f7b5908a..000000000 --- a/tests/pending/run/t5040.check +++ /dev/null @@ -1 +0,0 @@ -applyDynamic diff --git a/tests/pending/run/t5040.flags b/tests/pending/run/t5040.flags deleted file mode 100644 index 1141f9750..000000000 --- a/tests/pending/run/t5040.flags +++ /dev/null @@ -1 +0,0 @@ --language:dynamics diff --git a/tests/pending/run/t5040.scala b/tests/pending/run/t5040.scala deleted file mode 100644 index 6813c1b27..000000000 --- a/tests/pending/run/t5040.scala +++ /dev/null @@ -1,11 +0,0 @@ -abstract class Prova2 extends Dynamic { - def applyDynamic(m: String)(): Unit - private def privateMethod() = println("private method") -} - -object Test extends dotty.runtime.LegacyApp { - val prova= new Prova2 { - def applyDynamic(m: String)() = println("applyDynamic") - } - prova.privateMethod() -} diff --git a/tests/pending/run/t5733.check b/tests/pending/run/t5733.check deleted file mode 100644 index e697046a9..000000000 --- a/tests/pending/run/t5733.check +++ /dev/null @@ -1,2 +0,0 @@ -Running ABTest asserts -Done diff --git a/tests/pending/run/t5733.scala b/tests/pending/run/t5733.scala deleted file mode 100644 index a9e58d77e..000000000 --- a/tests/pending/run/t5733.scala +++ /dev/null @@ -1,53 +0,0 @@ -import scala.language.dynamics - -object A extends Dynamic { - var a = "a" - - def selectDynamic(method:String): String = a - - def updateDynamic(method:String)(v:String): Unit = { a = v } -} - -class B extends Dynamic { - var b = "b" - - def selectDynamic(method:String): String = b - - def updateDynamic(method:String)(v:String): Unit = { b = v } -} - -object Test extends dotty.runtime.LegacyApp { - assert( A.foo == "a" ) - assert( A.bar == "a" ) - A.aaa = "aaa" - assert( A.bar == "aaa" ) - - val b = new B - assert( b.foo == "b" ) - assert( b.bar == "b" ) - b.bbb = "bbb" - assert( b.bar == "bbb" ) - - { - println("Running ABTest asserts") - A.a = "a" - (new ABTest).test() - } - - println("Done") -} - -class ABTest { - def test(): Unit = { - assert( A.foo == "a" ) - assert( A.bar == "a" ) - A.aaa = "aaa" - assert( A.bar == "aaa" ) - - val b = new B - assert( b.foo == "b" ) - assert( b.bar == "b" ) - b.bbb = "bbb" - assert( b.bar == "bbb" ) - } -} diff --git a/tests/pending/run/t6353.check b/tests/pending/run/t6353.check deleted file mode 100644 index 5676bed24..000000000 --- a/tests/pending/run/t6353.check +++ /dev/null @@ -1 +0,0 @@ -applyDynamic(apply)(9) diff --git a/tests/pending/run/t6353.scala b/tests/pending/run/t6353.scala deleted file mode 100644 index 7077eaeda..000000000 --- a/tests/pending/run/t6353.scala +++ /dev/null @@ -1,12 +0,0 @@ -import language.dynamics - -object Test extends dotty.runtime.LegacyApp { - val x = new X(3) - val y = x(9) - class X(i: Int) extends Dynamic { - def applyDynamic(name: String)(in: Int): Int = { - println(s"applyDynamic($name)($in)") - i + in - } - } -} diff --git a/tests/pending/run/t6355.check b/tests/pending/run/t6355.check deleted file mode 100644 index ce74ab38a..000000000 --- a/tests/pending/run/t6355.check +++ /dev/null @@ -1,2 +0,0 @@ -bippy(x: Int) called with x = 42 -bippy(x: String) called with x = "42" diff --git a/tests/pending/run/t6355.scala b/tests/pending/run/t6355.scala deleted file mode 100644 index f1921391a..000000000 --- a/tests/pending/run/t6355.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.language.dynamics - -class A extends Dynamic { - def applyDynamic(method: String): B = new B(method) -} -class B(method: String) { - def apply(x: Int) = s"$method(x: Int) called with x = $x" - def apply(x: String) = s"""$method(x: String) called with x = "$x"""" -} - -object Test { - def main(args: Array[String]): Unit = { - val x = new A - println(x.bippy(42)) - println(x.bippy("42")) - } -} diff --git a/tests/pending/run/t6663.check b/tests/pending/run/t6663.check deleted file mode 100644 index d81cc0710..000000000 --- a/tests/pending/run/t6663.check +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/tests/pending/run/t6663.flags b/tests/pending/run/t6663.flags deleted file mode 100644 index ea7fc37e1..000000000 --- a/tests/pending/run/t6663.flags +++ /dev/null @@ -1 +0,0 @@ --Yrangepos:false diff --git a/tests/pending/run/t6663.scala b/tests/pending/run/t6663.scala deleted file mode 100644 index bfe464ad6..000000000 --- a/tests/pending/run/t6663.scala +++ /dev/null @@ -1,17 +0,0 @@ -import language.dynamics - -class C(v: Any) extends Dynamic { - def selectDynamic[T](n: String): Option[T] = Option(v.asInstanceOf[T]) - def applyDynamic[T](n: String)(): Option[T] = Option(v.asInstanceOf[T]) -} - -object Test extends dotty.runtime.LegacyApp { - // this should be converted to - // C(42).selectDynamic[Int]("foo").get - // but, before fixing SI-6663, became - // C(42).selectDynamic[Nothing]("foo").get - // leading to a ClassCastException - var v = new C(42).foo[Int].get - println(v) -} - diff --git a/tests/pending/run/unapply.check b/tests/pending/run/unapply.check deleted file mode 100644 index 847e3b381..000000000 --- a/tests/pending/run/unapply.check +++ /dev/null @@ -1,3 +0,0 @@ -unapply.scala:57: warning: comparing values of types Null and Null using `==' will always yield true - assert(doMatch2(b) == null) - ^ diff --git a/tests/pending/run/unapply.scala b/tests/pending/run/unapply.scala deleted file mode 100644 index 43f02b9f3..000000000 --- a/tests/pending/run/unapply.scala +++ /dev/null @@ -1,122 +0,0 @@ -object Test { - def main(args: Array[String]): Unit = { - Foo.run() - Mas.run() - LisSeqArr.run() - StreamFoo.run() - Test1256.run() - } -} - -// this class is used for representation -class Bar { - var size: Int = 50 - var name: String = "medium" -} - -// test basic unapply for 0, 1 and 2 args and with precise type test -object Fii { - def unapply(x: Any): Boolean = x.isInstanceOf[Bar] -} -object Faa { - def unapply(x: Any): Option[String] = if(x.isInstanceOf[Bar]) Some(x.asInstanceOf[Bar].name) else None -} -object FaaPrecise { - def unapply(x: Bar): Option[String] = Some(x.name) -} -object FaaPreciseSome { - def unapply(x: Bar) = Some(x.name) // return type Some[String] -} -object VarFoo { - def unapply(a : Int)(implicit b : Int) : Option[Int] = Some(a + b) -} - -object Foo { - def unapply(x: Any): Option[Product2[Int, String]] = x match { - case y: Bar => Some(y.size, y.name) - case _ => None - } - def doMatch1(b:Bar) = b match { - case Foo(s:Int, n:String) => (s,n) - } - def doMatch2(b:Bar) = b match { - case Fii() => null - } - def doMatch3(b:Bar) = b match { - case Faa(n:String) => n - } - def doMatch4(b:Bar) = (b:Any) match { - case FaaPrecise(n:String) => n - } - def doMatch5(b:Bar) = (b:Any) match { - case FaaPreciseSome(n:String) => n - } - def run(): Unit = { - val b = new Bar - assert(doMatch1(b) == (50,"medium")) - assert(doMatch2(b) == null) - assert(doMatch3(b) == "medium") - assert(doMatch4(b) == "medium") - assert(doMatch5(b) == "medium") - implicit val bc: Int = 3 - assert(7 == (4 match { - case VarFoo(x) => x - })) - } -} - -// same, but now object is not top-level -object Mas { - object Gaz { - def unapply(x: Any): Option[Product2[Int, String]] = x match { - case y: Baz => Some(y.size, y.name) - case _ => None - } - } - class Baz { - var size: Int = 60 - var name: String = "too large" - } - def run(): Unit = { - val b = new Baz - assert((60,"too large") == (b match { - case Gaz(s:Int, n:String) => (s,n) - })) - } -} - -object LisSeqArr { - def run(): Unit = { - assert((1,2) == ((List(1,2,3): Any) match { case List(x,y,_*) => (x,y)})) - assert((1,2) == ((List(1,2,3): Any) match { case Seq(x,y,_*) => (x,y)})) - } -} - -object StreamFoo { - def sum(stream: Stream[Int]): Int = - stream match { - case Stream.Empty => 0 - case Stream.cons(hd, tl) => hd + sum(tl) - } - def run(): Unit = { - val str: Stream[Int] = List(1,2,3).toStream - assert(6 == sum(str)) - } -} - -object Test1256 { - class Sync { - def unapply(scrut: Any): Boolean = false - } - - class Buffer { - val Get = new Sync - val jp: PartialFunction[Any, Any] = { - case Get() => - } - } - - def run(): Unit = { - assert(!(new Buffer).jp.isDefinedAt(42)) - } -} |