From 06e1905aed315d5199936797c9e9493326b74595 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Sat, 4 Apr 2015 01:15:30 +0200 Subject: Enable untried pos tests related to value classes Each test needs to have its own package because pos_all will try to compile the whole valueclasses directory at once. --- test/dotc/tests.scala | 2 +- tests/pos/valueclasses/nullAsInstanceOfVC.scala | 2 + tests/pos/valueclasses/t5853.scala | 57 ++++++++++++++++++++++ tests/pos/valueclasses/t6029.scala | 5 ++ tests/pos/valueclasses/t6034.scala | 3 ++ tests/pos/valueclasses/t6215.scala | 3 ++ tests/pos/valueclasses/t6260.scala | 19 ++++++++ tests/pos/valueclasses/t6260b.scala | 5 ++ tests/pos/valueclasses/t6358.scala | 8 +++ tests/pos/valueclasses/t6358_2.scala | 8 +++ .../valueclasses/t6601/PrivateValueClass_1.scala | 3 ++ .../t6601/UsePrivateValueClass_2.scala | 12 +++++ tests/pos/valueclasses/t6651.scala | 35 +++++++++++++ tests/pos/valueclasses/t7818.scala | 12 +++++ .../value-class-override-no-spec.flags | 1 + .../value-class-override-no-spec.scala | 11 +++++ .../valueclasses/value-class-override-spec.scala | 11 +++++ tests/pos/valueclasses/xlint1.flags | 1 + tests/pos/valueclasses/xlint1.scala | 15 ++++++ tests/untried/pos/delambdafy_t6260_method.check | 13 ----- tests/untried/pos/delambdafy_t6260_method.flags | 1 - tests/untried/pos/delambdafy_t6260_method.scala | 17 ------- tests/untried/pos/t5853.scala | 55 --------------------- tests/untried/pos/t6029.scala | 3 -- tests/untried/pos/t6034.scala | 1 - tests/untried/pos/t6215.scala | 1 - tests/untried/pos/t6260.flags | 1 - tests/untried/pos/t6260.scala | 17 ------- tests/untried/pos/t6260b.scala | 3 -- tests/untried/pos/t6358.scala | 6 --- tests/untried/pos/t6358_2.scala | 6 --- tests/untried/pos/t6601/PrivateValueClass_1.scala | 1 - .../untried/pos/t6601/UsePrivateValueClass_2.scala | 10 ---- tests/untried/pos/t6651.scala | 33 ------------- tests/untried/pos/t7818.scala | 10 ---- .../untried/pos/value-class-override-no-spec.flags | 1 - .../untried/pos/value-class-override-no-spec.scala | 9 ---- tests/untried/pos/value-class-override-spec.scala | 9 ---- tests/untried/pos/xlint1.flags | 1 - tests/untried/pos/xlint1.scala | 13 ----- 40 files changed, 212 insertions(+), 212 deletions(-) create mode 100644 tests/pos/valueclasses/t5853.scala create mode 100644 tests/pos/valueclasses/t6029.scala create mode 100644 tests/pos/valueclasses/t6034.scala create mode 100644 tests/pos/valueclasses/t6215.scala create mode 100644 tests/pos/valueclasses/t6260.scala create mode 100644 tests/pos/valueclasses/t6260b.scala create mode 100644 tests/pos/valueclasses/t6358.scala create mode 100644 tests/pos/valueclasses/t6358_2.scala create mode 100644 tests/pos/valueclasses/t6601/PrivateValueClass_1.scala create mode 100644 tests/pos/valueclasses/t6601/UsePrivateValueClass_2.scala create mode 100644 tests/pos/valueclasses/t6651.scala create mode 100644 tests/pos/valueclasses/t7818.scala create mode 100644 tests/pos/valueclasses/value-class-override-no-spec.flags create mode 100644 tests/pos/valueclasses/value-class-override-no-spec.scala create mode 100644 tests/pos/valueclasses/value-class-override-spec.scala create mode 100644 tests/pos/valueclasses/xlint1.flags create mode 100644 tests/pos/valueclasses/xlint1.scala delete mode 100644 tests/untried/pos/delambdafy_t6260_method.check delete mode 100644 tests/untried/pos/delambdafy_t6260_method.flags delete mode 100644 tests/untried/pos/delambdafy_t6260_method.scala delete mode 100644 tests/untried/pos/t5853.scala delete mode 100644 tests/untried/pos/t6029.scala delete mode 100644 tests/untried/pos/t6034.scala delete mode 100644 tests/untried/pos/t6215.scala delete mode 100644 tests/untried/pos/t6260.flags delete mode 100644 tests/untried/pos/t6260.scala delete mode 100644 tests/untried/pos/t6260b.scala delete mode 100644 tests/untried/pos/t6358.scala delete mode 100644 tests/untried/pos/t6358_2.scala delete mode 100644 tests/untried/pos/t6601/PrivateValueClass_1.scala delete mode 100644 tests/untried/pos/t6601/UsePrivateValueClass_2.scala delete mode 100644 tests/untried/pos/t6651.scala delete mode 100644 tests/untried/pos/t7818.scala delete mode 100644 tests/untried/pos/value-class-override-no-spec.flags delete mode 100644 tests/untried/pos/value-class-override-no-spec.scala delete mode 100644 tests/untried/pos/value-class-override-spec.scala delete mode 100644 tests/untried/pos/xlint1.flags delete mode 100644 tests/untried/pos/xlint1.scala diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 4e2edd4df..7761589ad 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -76,7 +76,7 @@ class tests extends CompilerTest { @Test def pos_overloadedAccess = compileFile(posDir, "overloadedAccess", twice) @Test def pos_approximateUnion = compileFile(posDir, "approximateUnion", twice) @Test def pos_tailcall = compileDir(posDir, "tailcall", twice) - @Test def pos_valueclasses = compileDir(posDir, "valueclasses", twice) + @Test def pos_valueclasses = compileFiles(posDir + "valueclasses/", twice) @Test def pos_nullarify = compileFile(posDir, "nullarify", args = "-Ycheck:nullarify" :: Nil) @Test def pos_subtyping = compileFile(posDir, "subtyping", twice) @Test def pos_t2613 = compileFile(posSpecialDir, "t2613")(allowDeepSubtypes) diff --git a/tests/pos/valueclasses/nullAsInstanceOfVC.scala b/tests/pos/valueclasses/nullAsInstanceOfVC.scala index 0c1232883..43af839ec 100644 --- a/tests/pos/valueclasses/nullAsInstanceOfVC.scala +++ b/tests/pos/valueclasses/nullAsInstanceOfVC.scala @@ -1,3 +1,5 @@ +package nullAsInstanceOfVC + // These issues were originally reported in SI-5866 and SI-8097 // FIXME: Make this a run test once we have run tests. diff --git a/tests/pos/valueclasses/t5853.scala b/tests/pos/valueclasses/t5853.scala new file mode 100644 index 000000000..82ac9dd1d --- /dev/null +++ b/tests/pos/valueclasses/t5853.scala @@ -0,0 +1,57 @@ +package t5853 + + + + + + + + +final class C(val x: Int) extends AnyVal { + def ppp[@specialized(Int) T](y: T) = () +} + + +class Foo { + def f = new C(1) ppp 2 +} + + +/* Original SI-5853 test-case. */ + +object Bippy { + implicit final class C(val x: Int) extends AnyVal { + def +++[@specialized T](y: T) = () + } + def f = 1 +++ 2 +} + + +/* Few more examples. */ + +final class C2(val x: Int) extends AnyVal { + def +++[@specialized(Int) T](y: T) = () +} + + +class Foo2 { + def f = new C2(1) +++ 2 +} + + +object Arrow { + implicit final class ArrowAssoc[A](val __leftOfArrow: A) extends AnyVal { + @inline def ->>[B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y) + } + + def foo = 1 ->> 2 +} + + +object SpecArrow { + implicit final class ArrowAssoc[A](val __leftOfArrow: A) extends AnyVal { + @inline def ->> [@specialized(Int) B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y) + } + + def foo = 1 ->> 2 +} diff --git a/tests/pos/valueclasses/t6029.scala b/tests/pos/valueclasses/t6029.scala new file mode 100644 index 000000000..13f8f8830 --- /dev/null +++ b/tests/pos/valueclasses/t6029.scala @@ -0,0 +1,5 @@ +package t6029 + +final case class V[A](x: A) extends AnyVal { + def flatMap[B](f: A => V[B]) = if (true) this else f(x) +} diff --git a/tests/pos/valueclasses/t6034.scala b/tests/pos/valueclasses/t6034.scala new file mode 100644 index 000000000..8e2fb625c --- /dev/null +++ b/tests/pos/valueclasses/t6034.scala @@ -0,0 +1,3 @@ +package t6034 + +final class OptPlus[+A](val x: A) extends AnyVal { } diff --git a/tests/pos/valueclasses/t6215.scala b/tests/pos/valueclasses/t6215.scala new file mode 100644 index 000000000..579503e6c --- /dev/null +++ b/tests/pos/valueclasses/t6215.scala @@ -0,0 +1,3 @@ +package t6215 + +class Foo(val v: String) extends AnyVal { private def len = v.length ; def f = len } diff --git a/tests/pos/valueclasses/t6260.scala b/tests/pos/valueclasses/t6260.scala new file mode 100644 index 000000000..675c3c16a --- /dev/null +++ b/tests/pos/valueclasses/t6260.scala @@ -0,0 +1,19 @@ +package t6260 + +class Box[X](val x: X) extends AnyVal { + def map[Y](f: X => Y): Box[Y] = + ((bx: Box[X]) => new Box(f(bx.x)))(this) +} + +object Test { + def map2[X, Y](self: Box[X], f: X => Y): Box[Y] = + ((bx: Box[X]) => new Box(f(bx.x)))(self) + + def main(args: Array[String]): Unit = { + val f = (x: Int) => x + 1 + val g = (x: String) => x + x + + map2(new Box(42), f) + new Box("abc") map g + } +} diff --git a/tests/pos/valueclasses/t6260b.scala b/tests/pos/valueclasses/t6260b.scala new file mode 100644 index 000000000..fb9a2961b --- /dev/null +++ b/tests/pos/valueclasses/t6260b.scala @@ -0,0 +1,5 @@ +package t6260b + + +class X(val value: Object) extends AnyVal { def or(alt: => X): X = this } +class Y { def f = new X("") or new X("") } diff --git a/tests/pos/valueclasses/t6358.scala b/tests/pos/valueclasses/t6358.scala new file mode 100644 index 000000000..291ae2e9e --- /dev/null +++ b/tests/pos/valueclasses/t6358.scala @@ -0,0 +1,8 @@ +package t6358 + +class L(val t: Int) extends AnyVal { + def lazyString = { + lazy val x = t.toString + () => x + } +} diff --git a/tests/pos/valueclasses/t6358_2.scala b/tests/pos/valueclasses/t6358_2.scala new file mode 100644 index 000000000..effac505a --- /dev/null +++ b/tests/pos/valueclasses/t6358_2.scala @@ -0,0 +1,8 @@ +package t6358_2 + +class Y[T](val i: Option[T]) extends AnyVal { + def q: List[T] = { + lazy val e: List[T] = i.toList + e + } +} diff --git a/tests/pos/valueclasses/t6601/PrivateValueClass_1.scala b/tests/pos/valueclasses/t6601/PrivateValueClass_1.scala new file mode 100644 index 000000000..fc6f3e422 --- /dev/null +++ b/tests/pos/valueclasses/t6601/PrivateValueClass_1.scala @@ -0,0 +1,3 @@ +package t6601 + +class V private (val a: Any) extends AnyVal diff --git a/tests/pos/valueclasses/t6601/UsePrivateValueClass_2.scala b/tests/pos/valueclasses/t6601/UsePrivateValueClass_2.scala new file mode 100644 index 000000000..acd0dbef9 --- /dev/null +++ b/tests/pos/valueclasses/t6601/UsePrivateValueClass_2.scala @@ -0,0 +1,12 @@ +package t6601 + +object Test { + // After the first attempt to make seprately compiled value + // classes respect the privacy of constructors, we got: + // + // exception when typing v.a().==(v.a())/class scala.reflect.internal.Trees$Apply + // constructor V in class V cannot be accessed in object Test in file test/files/pos/t6601/UsePrivateValueClass_2.scala + // scala.reflect.internal.Types$TypeError: constructor V in class V cannot be accessed in object Test + def foo(v: V) = v.a == v.a + def bar(v: V) = v == v +} diff --git a/tests/pos/valueclasses/t6651.scala b/tests/pos/valueclasses/t6651.scala new file mode 100644 index 000000000..6201b6de3 --- /dev/null +++ b/tests/pos/valueclasses/t6651.scala @@ -0,0 +1,35 @@ +package t6651 + +class YouAreYourself[A <: AnyRef](val you: A) extends AnyVal { + def yourself: you.type = you +} + +object Test { + val s = "" + val s1: s.type = new YouAreYourself[s.type](s).yourself +} + +trait Path { + type Dep <: AnyRef +} + +final class ValueClass[P <: Path](val path: P) extends AnyVal { + import path.Dep + + def apply(dep: Dep)(d2: dep.type, foo: Int): (Dep, d2.type) = (d2, d2) + + // This generates dodgy code; note `ValueClass.this`: + // + // final def bounds$extension[D >: Nothing <: ValueClass.this.path.Dep, + // P >: Nothing <: Path] + // ($this: ValueClass[P]) + // (dep: D) + // (d2: dep.type, foo: Int): (D, d2.type) = scala.Tuple2.apply[D, d2.type](d2, d2); + // + // Nothing crashes down the line, but it certainly doesn't conform to best-practices. + // + // An better alternative would be to add a type parameter for the (singleton) type of + // the wrapped value. + def bounds[D <: Dep](dep: D)(d2: dep.type, foo: Int): (D, d2.type) = (d2, d2) +} + diff --git a/tests/pos/valueclasses/t7818.scala b/tests/pos/valueclasses/t7818.scala new file mode 100644 index 000000000..31f542366 --- /dev/null +++ b/tests/pos/valueclasses/t7818.scala @@ -0,0 +1,12 @@ +package t7818 + +class Observable1[+T](val asJava: JObservable[_ <: T]) extends AnyVal { + private def foo[X](a: JObservable[X]): JObservable[X] = ??? + // was generating a type error as the type of the RHS included an existential + // skolem based on the class type parameter `T`, which did not conform + // to the typer parameter of the extension method into which the RHS is + // transplanted. + def synchronize: Observable1[T] = new Observable1(foo(asJava)) +} + +class JObservable[T] diff --git a/tests/pos/valueclasses/value-class-override-no-spec.flags b/tests/pos/valueclasses/value-class-override-no-spec.flags new file mode 100644 index 000000000..a7e64e4f0 --- /dev/null +++ b/tests/pos/valueclasses/value-class-override-no-spec.flags @@ -0,0 +1 @@ +-no-specialization \ No newline at end of file diff --git a/tests/pos/valueclasses/value-class-override-no-spec.scala b/tests/pos/valueclasses/value-class-override-no-spec.scala new file mode 100644 index 000000000..058e3e911 --- /dev/null +++ b/tests/pos/valueclasses/value-class-override-no-spec.scala @@ -0,0 +1,11 @@ +package value_class_override_no_spec + +// There are two versions of this tests: one with and one without specialization. +// The bug was only exposed *without* specialization. +trait T extends Any { + def x: Any +} + +final class StringOps(val repr0: String) extends AnyVal with T { + def x = () +} diff --git a/tests/pos/valueclasses/value-class-override-spec.scala b/tests/pos/valueclasses/value-class-override-spec.scala new file mode 100644 index 000000000..c315be8d0 --- /dev/null +++ b/tests/pos/valueclasses/value-class-override-spec.scala @@ -0,0 +1,11 @@ +package value_class_override_spec + +// There are two versions of this tests: one with and one without specialization. +// The bug was only exposed *without* specialization. +trait T extends Any { + def x: Any +} + +final class StringOps(val repr0: String) extends AnyVal with T { + def x = () +} diff --git a/tests/pos/valueclasses/xlint1.flags b/tests/pos/valueclasses/xlint1.flags new file mode 100644 index 000000000..7949c2afa --- /dev/null +++ b/tests/pos/valueclasses/xlint1.flags @@ -0,0 +1 @@ +-Xlint -Xfatal-warnings diff --git a/tests/pos/valueclasses/xlint1.scala b/tests/pos/valueclasses/xlint1.scala new file mode 100644 index 000000000..c2f39f9b3 --- /dev/null +++ b/tests/pos/valueclasses/xlint1.scala @@ -0,0 +1,15 @@ +package xlint1 + +package object foo { + implicit class Bar[T](val x: T) extends AnyVal { + def bippy = 1 + } +} + +package foo { + object Baz { + def main(args: Array[String]): Unit = { + "abc".bippy + } + } +} diff --git a/tests/untried/pos/delambdafy_t6260_method.check b/tests/untried/pos/delambdafy_t6260_method.check deleted file mode 100644 index f5cd6947d..000000000 --- a/tests/untried/pos/delambdafy_t6260_method.check +++ /dev/null @@ -1,13 +0,0 @@ -delambdafy_t6260_method.scala:3: error: bridge generated for member method apply: (bx: Object)Object in class map$extension1 -which overrides method apply: (v1: Object)Object in trait Function1 -clashes with definition of the member itself; -both have erased type (bx: Object)Object - ((bx: Box[X]) => new Box(f(bx.x)))(this) - ^ -delambdafy_t6260_method.scala:8: error: bridge generated for member method apply: (bx: Object)Object in class map21 -which overrides method apply: (v1: Object)Object in trait Function1 -clashes with definition of the member itself; -both have erased type (bx: Object)Object - ((bx: Box[X]) => new Box(f(bx.x)))(self) - ^ -two errors found diff --git a/tests/untried/pos/delambdafy_t6260_method.flags b/tests/untried/pos/delambdafy_t6260_method.flags deleted file mode 100644 index 48b438ddf..000000000 --- a/tests/untried/pos/delambdafy_t6260_method.flags +++ /dev/null @@ -1 +0,0 @@ --Ydelambdafy:method diff --git a/tests/untried/pos/delambdafy_t6260_method.scala b/tests/untried/pos/delambdafy_t6260_method.scala deleted file mode 100644 index 8edfe4ac3..000000000 --- a/tests/untried/pos/delambdafy_t6260_method.scala +++ /dev/null @@ -1,17 +0,0 @@ -class Box[X](val x: X) extends AnyVal { - def map[Y](f: X => Y): Box[Y] = - ((bx: Box[X]) => new Box(f(bx.x)))(this) -} - -object Test { - def map2[X, Y](self: Box[X], f: X => Y): Box[Y] = - ((bx: Box[X]) => new Box(f(bx.x)))(self) - - def main(args: Array[String]): Unit = { - val f = (x: Int) => x + 1 - val g = (x: String) => x + x - - map2(new Box(42), f) - new Box("abc") map g - } -} diff --git a/tests/untried/pos/t5853.scala b/tests/untried/pos/t5853.scala deleted file mode 100644 index 2ebb6667d..000000000 --- a/tests/untried/pos/t5853.scala +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - -final class C(val x: Int) extends AnyVal { - def ppp[@specialized(Int) T](y: T) = () -} - - -class Foo { - def f = new C(1) ppp 2 -} - - -/* Original SI-5853 test-case. */ - -object Bippy { - implicit final class C(val x: Int) extends AnyVal { - def +++[@specialized T](y: T) = () - } - def f = 1 +++ 2 -} - - -/* Few more examples. */ - -final class C2(val x: Int) extends AnyVal { - def +++[@specialized(Int) T](y: T) = () -} - - -class Foo2 { - def f = new C2(1) +++ 2 -} - - -object Arrow { - implicit final class ArrowAssoc[A](val __leftOfArrow: A) extends AnyVal { - @inline def ->>[B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y) - } - - def foo = 1 ->> 2 -} - - -object SpecArrow { - implicit final class ArrowAssoc[A](val __leftOfArrow: A) extends AnyVal { - @inline def ->> [@specialized(Int) B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y) - } - - def foo = 1 ->> 2 -} diff --git a/tests/untried/pos/t6029.scala b/tests/untried/pos/t6029.scala deleted file mode 100644 index 8f1bbb4eb..000000000 --- a/tests/untried/pos/t6029.scala +++ /dev/null @@ -1,3 +0,0 @@ -final case class V[A](x: A) extends AnyVal { - def flatMap[B](f: A => V[B]) = if (true) this else f(x) -} diff --git a/tests/untried/pos/t6034.scala b/tests/untried/pos/t6034.scala deleted file mode 100644 index 3558d7ff0..000000000 --- a/tests/untried/pos/t6034.scala +++ /dev/null @@ -1 +0,0 @@ -final class OptPlus[+A](val x: A) extends AnyVal { } diff --git a/tests/untried/pos/t6215.scala b/tests/untried/pos/t6215.scala deleted file mode 100644 index 2f66892b6..000000000 --- a/tests/untried/pos/t6215.scala +++ /dev/null @@ -1 +0,0 @@ -class Foo(val v: String) extends AnyVal { private def len = v.length ; def f = len } diff --git a/tests/untried/pos/t6260.flags b/tests/untried/pos/t6260.flags deleted file mode 100644 index 2349d8294..000000000 --- a/tests/untried/pos/t6260.flags +++ /dev/null @@ -1 +0,0 @@ --Ydelambdafy:inline diff --git a/tests/untried/pos/t6260.scala b/tests/untried/pos/t6260.scala deleted file mode 100644 index 8edfe4ac3..000000000 --- a/tests/untried/pos/t6260.scala +++ /dev/null @@ -1,17 +0,0 @@ -class Box[X](val x: X) extends AnyVal { - def map[Y](f: X => Y): Box[Y] = - ((bx: Box[X]) => new Box(f(bx.x)))(this) -} - -object Test { - def map2[X, Y](self: Box[X], f: X => Y): Box[Y] = - ((bx: Box[X]) => new Box(f(bx.x)))(self) - - def main(args: Array[String]): Unit = { - val f = (x: Int) => x + 1 - val g = (x: String) => x + x - - map2(new Box(42), f) - new Box("abc") map g - } -} diff --git a/tests/untried/pos/t6260b.scala b/tests/untried/pos/t6260b.scala deleted file mode 100644 index 73e2e58f7..000000000 --- a/tests/untried/pos/t6260b.scala +++ /dev/null @@ -1,3 +0,0 @@ - -class X(val value: Object) extends AnyVal { def or(alt: => X): X = this } -class Y { def f = new X("") or new X("") } diff --git a/tests/untried/pos/t6358.scala b/tests/untried/pos/t6358.scala deleted file mode 100644 index 25539c885..000000000 --- a/tests/untried/pos/t6358.scala +++ /dev/null @@ -1,6 +0,0 @@ -class L(val t: Int) extends AnyVal { - def lazyString = { - lazy val x = t.toString - () => x - } -} diff --git a/tests/untried/pos/t6358_2.scala b/tests/untried/pos/t6358_2.scala deleted file mode 100644 index 7c2beb60d..000000000 --- a/tests/untried/pos/t6358_2.scala +++ /dev/null @@ -1,6 +0,0 @@ -class Y[T](val i: Option[T]) extends AnyVal { - def q: List[T] = { - lazy val e: List[T] = i.toList - e - } -} diff --git a/tests/untried/pos/t6601/PrivateValueClass_1.scala b/tests/untried/pos/t6601/PrivateValueClass_1.scala deleted file mode 100644 index dc0137420..000000000 --- a/tests/untried/pos/t6601/PrivateValueClass_1.scala +++ /dev/null @@ -1 +0,0 @@ -class V private (val a: Any) extends AnyVal diff --git a/tests/untried/pos/t6601/UsePrivateValueClass_2.scala b/tests/untried/pos/t6601/UsePrivateValueClass_2.scala deleted file mode 100644 index ec9793751..000000000 --- a/tests/untried/pos/t6601/UsePrivateValueClass_2.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test { - // After the first attempt to make seprately compiled value - // classes respect the privacy of constructors, we got: - // - // exception when typing v.a().==(v.a())/class scala.reflect.internal.Trees$Apply - // constructor V in class V cannot be accessed in object Test in file test/files/pos/t6601/UsePrivateValueClass_2.scala - // scala.reflect.internal.Types$TypeError: constructor V in class V cannot be accessed in object Test - def foo(v: V) = v.a == v.a - def bar(v: V) = v == v -} diff --git a/tests/untried/pos/t6651.scala b/tests/untried/pos/t6651.scala deleted file mode 100644 index 55a3b74e4..000000000 --- a/tests/untried/pos/t6651.scala +++ /dev/null @@ -1,33 +0,0 @@ -class YouAreYourself[A <: AnyRef](val you: A) extends AnyVal { - def yourself: you.type = you -} - -object Test { - val s = "" - val s1: s.type = new YouAreYourself[s.type](s).yourself -} - -trait Path { - type Dep <: AnyRef -} - -final class ValueClass[P <: Path](val path: P) extends AnyVal { - import path.Dep - - def apply(dep: Dep)(d2: dep.type, foo: Int): (Dep, d2.type) = (d2, d2) - - // This generates dodgy code; note `ValueClass.this`: - // - // final def bounds$extension[D >: Nothing <: ValueClass.this.path.Dep, - // P >: Nothing <: Path] - // ($this: ValueClass[P]) - // (dep: D) - // (d2: dep.type, foo: Int): (D, d2.type) = scala.Tuple2.apply[D, d2.type](d2, d2); - // - // Nothing crashes down the line, but it certainly doesn't conform to best-practices. - // - // An better alternative would be to add a type parameter for the (singleton) type of - // the wrapped value. - def bounds[D <: Dep](dep: D)(d2: dep.type, foo: Int): (D, d2.type) = (d2, d2) -} - diff --git a/tests/untried/pos/t7818.scala b/tests/untried/pos/t7818.scala deleted file mode 100644 index 77b99e7d5..000000000 --- a/tests/untried/pos/t7818.scala +++ /dev/null @@ -1,10 +0,0 @@ -class Observable1[+T](val asJava: JObservable[_ <: T]) extends AnyVal { - private def foo[X](a: JObservable[X]): JObservable[X] = ??? - // was generating a type error as the type of the RHS included an existential - // skolem based on the class type parameter `T`, which did not conform - // to the typer parameter of the extension method into which the RHS is - // transplanted. - def synchronize: Observable1[T] = new Observable1(foo(asJava)) -} - -class JObservable[T] diff --git a/tests/untried/pos/value-class-override-no-spec.flags b/tests/untried/pos/value-class-override-no-spec.flags deleted file mode 100644 index a7e64e4f0..000000000 --- a/tests/untried/pos/value-class-override-no-spec.flags +++ /dev/null @@ -1 +0,0 @@ --no-specialization \ No newline at end of file diff --git a/tests/untried/pos/value-class-override-no-spec.scala b/tests/untried/pos/value-class-override-no-spec.scala deleted file mode 100644 index 79de5d930..000000000 --- a/tests/untried/pos/value-class-override-no-spec.scala +++ /dev/null @@ -1,9 +0,0 @@ -// There are two versions of this tests: one with and one without specialization. -// The bug was only exposed *without* specialization. -trait T extends Any { - def x: Any -} - -final class StringOps(val repr0: String) extends AnyVal with T { - def x = () -} diff --git a/tests/untried/pos/value-class-override-spec.scala b/tests/untried/pos/value-class-override-spec.scala deleted file mode 100644 index 79de5d930..000000000 --- a/tests/untried/pos/value-class-override-spec.scala +++ /dev/null @@ -1,9 +0,0 @@ -// There are two versions of this tests: one with and one without specialization. -// The bug was only exposed *without* specialization. -trait T extends Any { - def x: Any -} - -final class StringOps(val repr0: String) extends AnyVal with T { - def x = () -} diff --git a/tests/untried/pos/xlint1.flags b/tests/untried/pos/xlint1.flags deleted file mode 100644 index 7949c2afa..000000000 --- a/tests/untried/pos/xlint1.flags +++ /dev/null @@ -1 +0,0 @@ --Xlint -Xfatal-warnings diff --git a/tests/untried/pos/xlint1.scala b/tests/untried/pos/xlint1.scala deleted file mode 100644 index 27936d8b1..000000000 --- a/tests/untried/pos/xlint1.scala +++ /dev/null @@ -1,13 +0,0 @@ -package object foo { - implicit class Bar[T](val x: T) extends AnyVal { - def bippy = 1 - } -} - -package foo { - object Baz { - def main(args: Array[String]): Unit = { - "abc".bippy - } - } -} -- cgit v1.2.3