diff options
author | odersky <odersky@gmail.com> | 2015-02-07 18:03:01 +0100 |
---|---|---|
committer | odersky <odersky@gmail.com> | 2015-02-07 18:03:01 +0100 |
commit | 9641b2a417f203b5c2e88e6330b2230713471307 (patch) | |
tree | 7509a675738c13a428d2ecb5a371d242213a4849 /tests | |
parent | 329b6bfa9929c984b40368a1cc5f2f8cdc15b6c8 (diff) | |
parent | 976ed6fd0aa4f0dd3da54889c4d85ef856f6531f (diff) | |
download | dotty-9641b2a417f203b5c2e88e6330b2230713471307.tar.gz dotty-9641b2a417f203b5c2e88e6330b2230713471307.tar.bz2 dotty-9641b2a417f203b5c2e88e6330b2230713471307.zip |
Merge pull request #339 from dotty-staging/fix/#329-and-others
Fix/#329 and others
Diffstat (limited to 'tests')
-rw-r--r-- | tests/disabled/not-representable/pos/t3498-old.scala (renamed from tests/pending/pos/t3498-old.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/structural-type/pos/t3175-pos.scala (renamed from tests/pending/pos/t3175-pos.scala) | 0 | ||||
-rw-r--r-- | tests/disabled/structural-type/pos/t3363-new.scala (renamed from tests/pending/pos/t3363-new.scala) | 2 | ||||
-rw-r--r-- | tests/disabled/structural-type/pos/t3363-old.scala (renamed from tests/pending/pos/t3363-old.scala) | 2 | ||||
-rw-r--r-- | tests/neg/over.scala | 8 | ||||
-rw-r--r-- | tests/neg/overrides.scala | 42 | ||||
-rw-r--r-- | tests/pending/pos/java-override/A.java | 3 | ||||
-rw-r--r-- | tests/pending/pos/java-override/B.scala | 7 | ||||
-rw-r--r-- | tests/pending/pos/self-type-override.scala | 13 | ||||
-rw-r--r-- | tests/pending/pos/t3278.scala | 15 | ||||
-rw-r--r-- | tests/pending/pos/t3480.scala | 2 | ||||
-rw-r--r-- | tests/pos/sammy_poly.scala (renamed from tests/pending/pos/sammy_poly.scala) | 0 | ||||
-rw-r--r-- | tests/pos/scoping1.scala (renamed from tests/pending/pos/scoping1.scala) | 2 | ||||
-rw-r--r-- | tests/pos/sealed-final.scala (renamed from tests/pending/pos/sealed-final.scala) | 0 | ||||
-rw-r--r-- | tests/pos/spec-sealed.scala (renamed from tests/pending/pos/spec-sealed.scala) | 0 | ||||
-rw-r--r-- | tests/pos/subtyping.scala | 29 | ||||
-rw-r--r-- | tests/pos/t319.scala (renamed from tests/pending/pos/t319.scala) | 3 | ||||
-rw-r--r-- | tests/pos/t3252.scala (renamed from tests/pending/pos/t3252.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t3278.scala | 30 | ||||
-rw-r--r-- | tests/pos/t3343.scala (renamed from tests/pending/pos/t3343.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t3411.scala (renamed from tests/pending/pos/t3411.scala) | 0 | ||||
-rw-r--r-- | tests/pos/t344.scala (renamed from tests/pending/pos/t344.scala) | 0 |
22 files changed, 97 insertions, 61 deletions
diff --git a/tests/pending/pos/t3498-old.scala b/tests/disabled/not-representable/pos/t3498-old.scala index 118a8d849..118a8d849 100644 --- a/tests/pending/pos/t3498-old.scala +++ b/tests/disabled/not-representable/pos/t3498-old.scala diff --git a/tests/pending/pos/t3175-pos.scala b/tests/disabled/structural-type/pos/t3175-pos.scala index 89bbf8b5f..89bbf8b5f 100644 --- a/tests/pending/pos/t3175-pos.scala +++ b/tests/disabled/structural-type/pos/t3175-pos.scala diff --git a/tests/pending/pos/t3363-new.scala b/tests/disabled/structural-type/pos/t3363-new.scala index f935cfe1a..835d9471b 100644 --- a/tests/pending/pos/t3363-new.scala +++ b/tests/disabled/structural-type/pos/t3363-new.scala @@ -7,7 +7,7 @@ object TestCase { //if fs was reduced to List (generic type with one parameter) then the code compiles //if you inherit from MapOps[T] instead of MapOps[F] then code compiles fine - implicit def map2ops[T,F](fs: Map[T,F]): TestCase.MapOps[F]{lazy val m: reflect.runtime.universe.TypeTag[T]; def is(xs: List[T]): List[List[T]]} = new MapOps[F] { + implicit def map2ops[T,F](fs: Map[T,F]): TestCase.MapOps[F]{val m: reflect.runtime.universe.TypeTag[T]; def is(xs: List[T]): List[List[T]]} = new MapOps[F] { //if you remove this line, then code compiles lazy val m: TypeTag[T] = sys.error("just something to make it compile") def is(xs: List[T]) = List(xs) diff --git a/tests/pending/pos/t3363-old.scala b/tests/disabled/structural-type/pos/t3363-old.scala index 8e54d4b4a..0088eff3d 100644 --- a/tests/pending/pos/t3363-old.scala +++ b/tests/disabled/structural-type/pos/t3363-old.scala @@ -5,7 +5,7 @@ object TestCase { //if fs was reduced to List (generic type with one parameter) then the code compiles //if you inherit from MapOps[T] instead of MapOps[F] then code compiles fine - implicit def map2ops[T,F](fs: Map[T,F]): TestCase.MapOps[F]{lazy val m: Manifest[T]; def is(xs: List[T]): List[List[T]]} = new MapOps[F] { + implicit def map2ops[T,F](fs: Map[T,F]): TestCase.MapOps[F]{val m: Manifest[T]; def is(xs: List[T]): List[List[T]]} = new MapOps[F] { //if you remove this line, then code compiles lazy val m: Manifest[T] = sys.error("just something to make it compile") def is(xs: List[T]) = List(xs) diff --git a/tests/neg/over.scala b/tests/neg/over.scala index 488d71614..80ce7d09f 100644 --- a/tests/neg/over.scala +++ b/tests/neg/over.scala @@ -8,3 +8,11 @@ class C extends T { override val y = 2 } + +class D extends T { + + def x(): String = "" + +} + + diff --git a/tests/neg/overrides.scala b/tests/neg/overrides.scala index 943cc8bc4..9fe06d930 100644 --- a/tests/neg/overrides.scala +++ b/tests/neg/overrides.scala @@ -79,3 +79,45 @@ class Y2 extends X2 { class X3 { override type T = A1 } + +package p3 { + +// Dotty change of rules: Toverrider#f does not +// override TCommon#f, hence the accidental override rule +// applies. +trait TCommon { + def f: String +} + +class C1 extends TCommon { + def f = "in C1" +} + +trait TOverrider { this: TCommon => + override def f = "in TOverrider" // The overridden self-type member... +} + +class C2 extends C1 with TOverrider // ... fails to override, here. + +} + +package p4 { + + abstract class C[T] { def head: T } + case class D[T](head: Int) extends C[T] + +} + +package p5 { +class A { + def m: String = "foo" +} + +class B extends A { + override val m: Int = 42 +} + +class C extends A { + override def m: Int = 42 +} +} diff --git a/tests/pending/pos/java-override/A.java b/tests/pending/pos/java-override/A.java new file mode 100644 index 000000000..0d7f453e8 --- /dev/null +++ b/tests/pending/pos/java-override/A.java @@ -0,0 +1,3 @@ +public interface A { + void o(Object o); +} diff --git a/tests/pending/pos/java-override/B.scala b/tests/pending/pos/java-override/B.scala new file mode 100644 index 000000000..cb4addbcc --- /dev/null +++ b/tests/pending/pos/java-override/B.scala @@ -0,0 +1,7 @@ +//trait T { def t(o: Object): Unit } + +class B extends A /*with T*/ { + override def o(o: Any): Unit = () + + //override def t(o: AnyRef): Unit = () +} diff --git a/tests/pending/pos/self-type-override.scala b/tests/pending/pos/self-type-override.scala deleted file mode 100644 index 7c40ef37e..000000000 --- a/tests/pending/pos/self-type-override.scala +++ /dev/null @@ -1,13 +0,0 @@ -trait TCommon { - def f: String -} - -class C1 extends TCommon { - def f = "in C1" -} - -trait TOverrider { this: TCommon => - override def f = "in TOverrider" // The overridden self-type member... -} - -class C2 extends C1 with TOverrider // ... fails to override, here. diff --git a/tests/pending/pos/t3278.scala b/tests/pending/pos/t3278.scala deleted file mode 100644 index 458070c5e..000000000 --- a/tests/pending/pos/t3278.scala +++ /dev/null @@ -1,15 +0,0 @@ -class Foo -class Test { - def update[B](x : B, b : Int): Unit = {} - def apply[B](x : B) = 1 -} - -object Test { - def main(a : Array[String]): Unit = { - val a = new Test - val f = new Foo - a(f) = 1 //works - a(f) = a(f) + 1 //works - a(f) += 1 //error: reassignment to val - } -} diff --git a/tests/pending/pos/t3480.scala b/tests/pending/pos/t3480.scala index d9a092e8a..f04ea2933 100644 --- a/tests/pending/pos/t3480.scala +++ b/tests/pending/pos/t3480.scala @@ -1,4 +1,4 @@ object Test { - val List(_*) = List(1) + val List(_: _*) = List(1) val Array( who, what : _* ) = "Eclipse plugin cannot not handle this" split (" ") } diff --git a/tests/pending/pos/sammy_poly.scala b/tests/pos/sammy_poly.scala index f43fa292c..f43fa292c 100644 --- a/tests/pending/pos/sammy_poly.scala +++ b/tests/pos/sammy_poly.scala diff --git a/tests/pending/pos/scoping1.scala b/tests/pos/scoping1.scala index 9fe1b5f3e..83ad1357a 100644 --- a/tests/pending/pos/scoping1.scala +++ b/tests/pos/scoping1.scala @@ -2,7 +2,7 @@ object This extends App { trait A { def foo(): Unit } - class C { self: A => + abstract class C { self: A => def bar() = this.foo() } class D extends C with A { diff --git a/tests/pending/pos/sealed-final.scala b/tests/pos/sealed-final.scala index bdedb5c1f..bdedb5c1f 100644 --- a/tests/pending/pos/sealed-final.scala +++ b/tests/pos/sealed-final.scala diff --git a/tests/pending/pos/spec-sealed.scala b/tests/pos/spec-sealed.scala index d7ecfaaab..d7ecfaaab 100644 --- a/tests/pending/pos/spec-sealed.scala +++ b/tests/pos/spec-sealed.scala diff --git a/tests/pos/subtyping.scala b/tests/pos/subtyping.scala index 29d830dd2..e65bdd16f 100644 --- a/tests/pos/subtyping.scala +++ b/tests/pos/subtyping.scala @@ -1,32 +1,5 @@ -class A { - def test1(): Unit = { - implicitly[this.type <:< this.type] - implicitly[this.type <:< A] - } -} object test { - def tag1[T](x: T): String & T = ??? - def tag2[T](x: T): T & String = ??? - - val x1: Int & String = tag1(0) - val x2: Int & String = tag2(0) - val x3: String & Int = tag1(0) - val x4: String & Int = tag2(0) - -} - -object test2 { - - class A - class B - - val x: A | B = ??? - val y: B | A = x - - val a: A & B = ??? - val b: B & A = a + val x: Int = 1 } - - diff --git a/tests/pending/pos/t319.scala b/tests/pos/t319.scala index eed25eb84..5c06f4db0 100644 --- a/tests/pending/pos/t319.scala +++ b/tests/pos/t319.scala @@ -14,7 +14,8 @@ object test { val a = new A { type T = String }; /** val b: B { type T = String } = functor(a) */ val b: B { type T = String } = { - val tmp = new functor() { val arg = a }; + val tmp = new functor() { val arg: A { type T = String } = a }; + // Dotty deviaton: arg needs an explicit type here, or else the inherited type `A` would be assumed. tmp.res } diff --git a/tests/pending/pos/t3252.scala b/tests/pos/t3252.scala index 3ecc1e7ce..3ecc1e7ce 100644 --- a/tests/pending/pos/t3252.scala +++ b/tests/pos/t3252.scala diff --git a/tests/pos/t3278.scala b/tests/pos/t3278.scala new file mode 100644 index 000000000..05bfbc146 --- /dev/null +++ b/tests/pos/t3278.scala @@ -0,0 +1,30 @@ +class Foo +class Test { + def update[B](x : B, b : Int): Unit = {} + def apply[B](x : B) = 1 +} +class Test2 { + type B = Foo + def update(x : B, b : Int): Unit = {} + def apply(x : B) = 1 +} + +object Test { + def main(a : Array[String]): Unit = { + val a = new Test + val f = new Foo + a(f) = 1 //works + a(f) = a(f) + 1 //works + a(f) += 1 //error: reassignment to val + } +} +object Test2 { + def main(args : Array[String]): Unit = { + args(0) += "a" + val a = new Test2 + val f = new Foo + a(f) = 1 //works + a(f) = a(f) + 1 //works + a(f) += 1 //error: reassignment to val + } +} diff --git a/tests/pending/pos/t3343.scala b/tests/pos/t3343.scala index 9d1bc9355..9d1bc9355 100644 --- a/tests/pending/pos/t3343.scala +++ b/tests/pos/t3343.scala diff --git a/tests/pending/pos/t3411.scala b/tests/pos/t3411.scala index 6d46be4e4..6d46be4e4 100644 --- a/tests/pending/pos/t3411.scala +++ b/tests/pos/t3411.scala diff --git a/tests/pending/pos/t344.scala b/tests/pos/t344.scala index 449a763af..449a763af 100644 --- a/tests/pending/pos/t344.scala +++ b/tests/pos/t344.scala |