diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-02-14 23:49:53 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-02-14 23:49:53 +0100 |
commit | 465e538ef59171ac7d9e811dbdaec776f8a64ac7 (patch) | |
tree | 159f11ee7736daffa1a25abaaca9da49418a7ab6 /test/files/neg | |
parent | 3dff364399d63c2dd317eb7bdf03f9d5216b2936 (diff) | |
parent | e86675f582ed8fef880f71744241f30e0d57a51c (diff) | |
download | scala-465e538ef59171ac7d9e811dbdaec776f8a64ac7.tar.gz scala-465e538ef59171ac7d9e811dbdaec776f8a64ac7.tar.bz2 scala-465e538ef59171ac7d9e811dbdaec776f8a64ac7.zip |
Merge remote-tracking branch 'origin/master' into topic/palladium0
Diffstat (limited to 'test/files/neg')
36 files changed, 186 insertions, 179 deletions
diff --git a/test/files/neg/name-lookup-stable.check b/test/files/neg/name-lookup-stable.check new file mode 100644 index 0000000000..751df9505e --- /dev/null +++ b/test/files/neg/name-lookup-stable.check @@ -0,0 +1,11 @@ +name-lookup-stable.scala:15: error: reference to PrimaryKey is ambiguous; +it is both defined in class A and imported subsequently by +import ColumnOption._ + (null: Any) match { case PrimaryKey => } + ^ +name-lookup-stable.scala:17: error: reference to PrimaryKey is ambiguous; +it is both defined in class A and imported subsequently by +import ColumnOption._ + PrimaryKey // was already ambigious in 2.10.3 + ^ +two errors found diff --git a/test/files/neg/name-lookup-stable.scala b/test/files/neg/name-lookup-stable.scala new file mode 100644 index 0000000000..0d862f06e1 --- /dev/null +++ b/test/files/neg/name-lookup-stable.scala @@ -0,0 +1,20 @@ +// This used to compile under 2.10.3 but the ambiguity is now noticed +// in 2.11.x (after a70c8219). I think the new behaviour is correct; +// we shouldn't discard names based on "expected stability" before +// evaluating ambiguity. +object ColumnOption { + object PrimaryKey +} + +class A { + def PrimaryKey: Any = ??? + + { + import ColumnOption._ + + (null: Any) match { case PrimaryKey => } + + PrimaryKey // was already ambigious in 2.10.3 + } +} + diff --git a/test/files/neg/package-ob-case.check b/test/files/neg/package-ob-case.check deleted file mode 100644 index 9b0ede1c6d..0000000000 --- a/test/files/neg/package-ob-case.check +++ /dev/null @@ -1,10 +0,0 @@ -package-ob-case.scala:3: warning: it is not recommended to define classes/objects inside of package objects. -If possible, define class X in package foo instead. - case class X(z: Int) { } - ^ -package-ob-case.scala:3: warning: class X should be placed directly in package foo instead of package object foo. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954. - case class X(z: Int) { } - ^ -error: No warnings can be incurred under -Xfatal-warnings. -two warnings found -one error found diff --git a/test/files/neg/package-ob-case.flags b/test/files/neg/package-ob-case.flags deleted file mode 100644 index 6c1dd108ae..0000000000 --- a/test/files/neg/package-ob-case.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings -Xlint
\ No newline at end of file diff --git a/test/files/neg/package-ob-case.scala b/test/files/neg/package-ob-case.scala deleted file mode 100644 index 91a1fb7e48..0000000000 --- a/test/files/neg/package-ob-case.scala +++ /dev/null @@ -1,5 +0,0 @@ -package foo { - package object foo { - case class X(z: Int) { } - } -} diff --git a/test/files/neg/t0764.check b/test/files/neg/t0764.check index 6156b52712..0c7cff1e1e 100644 --- a/test/files/neg/t0764.check +++ b/test/files/neg/t0764.check @@ -2,6 +2,6 @@ t0764.scala:13: error: type mismatch; found : Node{type T = _1.type} where val _1: Node{type T = NextType} required: Node{type T = Main.this.AType} (which expands to) Node{type T = Node{type T = NextType}} - new Main[AType]( (value: AType).prepend ) + new Main[AType]( (value: AType).prepend ) ^ one error found diff --git a/test/files/neg/t0764.scala b/test/files/neg/t0764.scala index f2cc65cf7d..9f77a59414 100644 --- a/test/files/neg/t0764.scala +++ b/test/files/neg/t0764.scala @@ -1,14 +1,45 @@ class Top[A] { - type AType = A + type AType = A } trait Node { outer => - type T <: Node - def prepend = new Node { type T = outer.type } + type T <: Node + def prepend = new Node { type T = outer.type } } class Main[NextType <: Node](value: Node { type T = NextType }) - extends Top[Node { type T = NextType }] { + extends Top[Node { type T = NextType }] { - new Main[AType]( (value: AType).prepend ) + new Main[AType]( (value: AType).prepend ) } + +/* we've been back-and-forth on this one -- see PRs on SI-8177 for the reasoning +I think it should compile and that the following error is due to broken =:= on existentials + found : Node{type T = _1.type} where val _1: Node{type T = NextType} + required: Node{type T = Main.this.AType} + (which expands to) Node{type T = Node{type T = NextType}} + +I claim (omitting the forSome for brevity, even though the premature skolemization is probably the issue) +_1.type =:= Main.this.AType +because +(1) _1.type <:< Main.this.AType and (2) Main.this.AType <:< _1.type +(1), because: +_1.type <:< Node{type T = NextType} (because skolemization and _1's upper bound) +(2), because: +Node{type T = NextType} <:< _1.type forSome val _1: Node{type T = NextType} +because: +Node{type T = NextType} <:< T forSome {type T <: Node{type T = NextType} with Singleton} +because +Node{type T = NextType} <:< Node{type T = NextType} with Singleton + +hmmm.. might the with Singleton be throwing a wrench in our existential house? + +Behold the equivalent program which type checks without the fix for SI-8177. +(Expand type alias, convert type member to type param; +note the covariance to encode subtyping on type members.) + +class Node[+T <: Node[_]] { def prepend = new Node[this.type] } +class Main[NextType <: Node[_]](value: Node[NextType]) { + new Main(value.prepend) +} +*/
\ No newline at end of file diff --git a/test/files/neg/t0764b.check b/test/files/neg/t0764b.check index d74a9efbfe..4040954e7c 100644 --- a/test/files/neg/t0764b.check +++ b/test/files/neg/t0764b.check @@ -2,15 +2,9 @@ t0764b.scala:27: error: type mismatch; found : p1.t0764.Node{type T = p1.t0764.<refinement>.type} required: p1.t0764.NodeAlias[p1.t0764.NodeAlias[A]] (which expands to) p1.t0764.Node{type T = p1.t0764.Node{type T = A}} - private[this] def f1 = new Main1(v.prepend) // fail - ^ -t0764b.scala:28: error: type mismatch; - found : p1.t0764.Node{type T = p1.t0764.<refinement>.type} - required: p1.t0764.NodeAlias[p1.t0764.NodeAlias[A]] - (which expands to) p1.t0764.Node{type T = p1.t0764.Node{type T = A}} private[this] def f2 = new Main1[NodeAlias[A]](v.prepend) // fail ^ -t0764b.scala:29: error: type mismatch; +t0764b.scala:28: error: type mismatch; found : p1.t0764.Node{type T = p1.t0764.<refinement>.type} required: p1.t0764.NodeAlias[p1.t0764.Node{type T = A}] (which expands to) p1.t0764.Node{type T = p1.t0764.Node{type T = A}} @@ -18,27 +12,22 @@ t0764b.scala:29: error: type mismatch; ^ t0764b.scala:34: error: type mismatch; found : p1.t0764.Node{type T = p1.t0764.<refinement>.type} - required: p1.t0764.Node{type T = p1.t0764.Node{type T = A}} - private[this] def f1 = new Main2(v.prepend) // fail - ^ -t0764b.scala:35: error: type mismatch; - found : p1.t0764.Node{type T = p1.t0764.<refinement>.type} required: p1.t0764.Node{type T = p1.t0764.NodeAlias[A]} (which expands to) p1.t0764.Node{type T = p1.t0764.Node{type T = A}} private[this] def f2 = new Main2[NodeAlias[A]](v.prepend) // fail ^ -t0764b.scala:36: error: type mismatch; +t0764b.scala:35: error: type mismatch; found : p1.t0764.Node{type T = p1.t0764.<refinement>.type} required: p1.t0764.Node{type T = p1.t0764.Node{type T = A}} private[this] def f3 = new Main2[Node { type T = A }](v.prepend) // fail ^ -t0764b.scala:52: error: type mismatch; +t0764b.scala:51: error: type mismatch; found : p2.t0764.Node{type T = p2.t0764.<refinement>.type} required: p2.t0764.NodeAlias[p2.t0764.NodeAlias[A]] (which expands to) p2.t0764.Node{type T = p2.t0764.Node{type T = A}} private[this] def f2 = new Main1[NodeAlias[A]](v.prepend) // fail ^ -t0764b.scala:53: error: type mismatch; +t0764b.scala:52: error: type mismatch; found : p2.t0764.Node{type T = p2.t0764.<refinement>.type} required: p2.t0764.NodeAlias[p2.t0764.Node{type T = A}] (which expands to) p2.t0764.Node{type T = p2.t0764.Node{type T = A}} @@ -46,18 +35,13 @@ t0764b.scala:53: error: type mismatch; ^ t0764b.scala:58: error: type mismatch; found : p2.t0764.Node{type T = p2.t0764.<refinement>.type} - required: p2.t0764.Node{type T = p2.t0764.Node{type T = A}} - private[this] def f1 = new Main2(v.prepend) // fail - ^ -t0764b.scala:59: error: type mismatch; - found : p2.t0764.Node{type T = p2.t0764.<refinement>.type} required: p2.t0764.Node{type T = p2.t0764.NodeAlias[A]} (which expands to) p2.t0764.Node{type T = p2.t0764.Node{type T = A}} private[this] def f2 = new Main2[NodeAlias[A]](v.prepend) // fail ^ -t0764b.scala:60: error: type mismatch; +t0764b.scala:59: error: type mismatch; found : p2.t0764.Node{type T = p2.t0764.<refinement>.type} required: p2.t0764.Node{type T = p2.t0764.Node{type T = A}} private[this] def f3 = new Main2[Node { type T = A }](v.prepend) // fail ^ -11 errors found +8 errors found diff --git a/test/files/neg/t0764b.scala b/test/files/neg/t0764b.scala index 4ad5ecdc03..14c623c67a 100644 --- a/test/files/neg/t0764b.scala +++ b/test/files/neg/t0764b.scala @@ -1,7 +1,4 @@ -/** Note that this should compile! It's a neg test to track the -behavior. If you have broken this test by making it compile, that -means you have fixed it and it should be moved to pos. -**/ +// see neg/t0764 why this should probably be a pos/ test -- alas something's wrong with existential subtyping (?) // In all cases when calling "prepend" the receiver 'v' // has static type NodeAlias[A] or (equivalently) Node { type T = A }. @@ -15,6 +12,8 @@ means you have fixed it and it should be moved to pos. // new Main[Node { type T = A }](v.prepend) // new Main(v.prepend) +// the `fail` comments below denote what didn't compile before SI-8177 fixed all of them + package p1 { object t0764 { type NodeAlias[A] = Node { type T = A } diff --git a/test/files/neg/t3873.check b/test/files/neg/t3873.check index 54d6abdf63..f9f413aeaf 100644 --- a/test/files/neg/t3873.check +++ b/test/files/neg/t3873.check @@ -1,6 +1,6 @@ t3873.scala:11: error: type mismatch; found : Test.a.B - required: a.B - wrongf(new A)(a.b) // should not compile -- TODO: improve error message? the "a" is ambiguous + required: a.B where val a: A + wrongf(new A)(a.b) // should not compile ^ one error found diff --git a/test/files/neg/t3873.scala b/test/files/neg/t3873.scala index e7815f0937..b27b4e9c9d 100644 --- a/test/files/neg/t3873.scala +++ b/test/files/neg/t3873.scala @@ -8,5 +8,5 @@ object Test { val a = new A wrongf(a)(a.b) - wrongf(new A)(a.b) // should not compile -- TODO: improve error message? the "a" is ambiguous + wrongf(new A)(a.b) // should not compile }
\ No newline at end of file diff --git a/test/files/neg/t4818.check b/test/files/neg/t4818.check index 8a2c024b30..a5e15e456b 100644 --- a/test/files/neg/t4818.check +++ b/test/files/neg/t4818.check @@ -1,6 +1,6 @@ t4818.scala:4: error: type mismatch; found : Int(5) - required: A + required: Nothing def f(x: Any) = x match { case Fn(f) => f(5) } ^ one error found diff --git a/test/files/neg/t5189.check b/test/files/neg/t5189.check index aecc1d11c4..4885de99cd 100644 --- a/test/files/neg/t5189.check +++ b/test/files/neg/t5189.check @@ -1,5 +1,5 @@ t5189.scala:3: error: type mismatch; - found : T => U + found : Nothing => Any required: Any => Any def f(x: Any): Any => Any = x match { case Foo(bar) => bar } ^ diff --git a/test/files/neg/t5760-pkgobj-warn.check b/test/files/neg/t5760-pkgobj-warn.check deleted file mode 100644 index a89398c3f7..0000000000 --- a/test/files/neg/t5760-pkgobj-warn.check +++ /dev/null @@ -1,4 +0,0 @@ -stalepkg_2.scala:6: error: Foo is already defined as class Foo in package object stalepkg - class Foo - ^ -one error found diff --git a/test/files/neg/t5760-pkgobj-warn/stalepkg_1.scala b/test/files/neg/t5760-pkgobj-warn/stalepkg_1.scala deleted file mode 100644 index ed4b731bb0..0000000000 --- a/test/files/neg/t5760-pkgobj-warn/stalepkg_1.scala +++ /dev/null @@ -1,11 +0,0 @@ - -package object stalepkg { - class Foo -} - -package stalepkg { - object Test { - def main(args: Array[String]) { - } - } -} diff --git a/test/files/neg/t5760-pkgobj-warn/stalepkg_2.scala b/test/files/neg/t5760-pkgobj-warn/stalepkg_2.scala deleted file mode 100644 index 9abcdbab17..0000000000 --- a/test/files/neg/t5760-pkgobj-warn/stalepkg_2.scala +++ /dev/null @@ -1,11 +0,0 @@ - -package object stalepkg { -} - -package stalepkg { - class Foo - object Test { - def main(args: Array[String]) { - } - } -} diff --git a/test/files/neg/t5954.check b/test/files/neg/t5954.check deleted file mode 100644 index 3950d14e4e..0000000000 --- a/test/files/neg/t5954.check +++ /dev/null @@ -1,18 +0,0 @@ -t5954.scala:36: warning: class D should be placed directly in package A instead of package object A. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954. - case class D() - ^ -t5954.scala:35: warning: object C should be placed directly in package A instead of package object A. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954. - object C - ^ -t5954.scala:34: warning: trait C should be placed directly in package A instead of package object A. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954. - trait C - ^ -t5954.scala:33: warning: object B should be placed directly in package A instead of package object A. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954. - object B - ^ -t5954.scala:32: warning: class B should be placed directly in package A instead of package object A. Under some circumstances companion objects and case classes in package objects can fail to recompile. See https://issues.scala-lang.org/browse/SI-5954. - class B - ^ -error: No warnings can be incurred under -Xfatal-warnings. -5 warnings found -one error found diff --git a/test/files/neg/t5954.flags b/test/files/neg/t5954.flags deleted file mode 100644 index 85d8eb2ba2..0000000000 --- a/test/files/neg/t5954.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings diff --git a/test/files/neg/t5954.scala b/test/files/neg/t5954.scala deleted file mode 100644 index 3ccb5ed3ff..0000000000 --- a/test/files/neg/t5954.scala +++ /dev/null @@ -1,46 +0,0 @@ -// if you ever think you've fixed the underlying reason for the warning -// imposed by SI-5954, then here's a test that should pass with two "succes"es -// -//import scala.tools.partest._ -// -//object Test extends DirectTest { -// def code = ??? -// -// def problemCode = """ -// package object A { -// class B -// object B -// case class C() -// } -// """ -// -// def compileProblemCode() = { -// val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") -// compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(problemCode) -// } -// -// def show() : Unit = { -// for (i <- 0 until 2) { -// compileProblemCode() -// println(s"success ${i + 1}") -// } -// } -//} - -package object A { - // these should be prevented by the implementation restriction - 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/test/files/neg/t6680a.flags b/test/files/neg/t6680a.flags new file mode 100644 index 0000000000..19243266d1 --- /dev/null +++ b/test/files/neg/t6680a.flags @@ -0,0 +1 @@ +-Xstrict-inference
\ No newline at end of file diff --git a/test/files/neg/t6829.check b/test/files/neg/t6829.check index a0b43e3b52..914a1c9260 100644 --- a/test/files/neg/t6829.check +++ b/test/files/neg/t6829.check @@ -16,32 +16,32 @@ t6829.scala:49: error: not found: value nextState val (s,a,s2) = (state,actions(agent),nextState) ^ t6829.scala:50: error: type mismatch; - found : s.type (with underlying type T1) + found : s.type (with underlying type Any) required: _53.State where val _53: G val r = rewards(agent).r(s,a,s2) ^ t6829.scala:50: error: type mismatch; - found : a.type (with underlying type T2) + found : a.type (with underlying type Any) required: _53.Action where val _53: G val r = rewards(agent).r(s,a,s2) ^ t6829.scala:50: error: type mismatch; - found : s2.type (with underlying type T3) + found : s2.type (with underlying type Any) required: _53.State where val _53: G val r = rewards(agent).r(s,a,s2) ^ t6829.scala:51: error: type mismatch; - found : s.type (with underlying type T1) + found : s.type (with underlying type Any) required: _50.State agent.learn(s,a,s2,r): G#Agent ^ t6829.scala:51: error: type mismatch; - found : a.type (with underlying type T2) + found : a.type (with underlying type Any) required: _50.Action agent.learn(s,a,s2,r): G#Agent ^ t6829.scala:51: error: type mismatch; - found : s2.type (with underlying type T3) + found : s2.type (with underlying type Any) required: _50.State agent.learn(s,a,s2,r): G#Agent ^ diff --git a/test/files/neg/t7886.check b/test/files/neg/t7886.check deleted file mode 100644 index 338eee9708..0000000000 --- a/test/files/neg/t7886.check +++ /dev/null @@ -1,6 +0,0 @@ -t7886.scala:10: error: type mismatch; - found : Contra[A] - required: Contra[Any] - case Unravel(m, msg) => g(m) - ^ -one error found diff --git a/test/files/neg/t7886.scala b/test/files/neg/t7886.scala deleted file mode 100644 index 55d80a0a43..0000000000 --- a/test/files/neg/t7886.scala +++ /dev/null @@ -1,22 +0,0 @@ -trait Covariant[+A] -trait Contra[-A] { def accept(p: A): Unit } -trait Invariant[A] extends Covariant[A] with Contra[A] - -case class Unravel[A](m: Contra[A], msg: A) - -object Test extends Covariant[Any] { - def g(m: Contra[Any]): Unit = m accept 5 - def f(x: Any): Unit = x match { - case Unravel(m, msg) => g(m) - case _ => - } - def main(args: Array[String]) { - f(Unravel[String](new Contra[String] { def accept(x: String) = x.length }, "")) - } -} -// java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String -// at Test$$anon$1.accept(a.scala:18) -// at Test$.g(a.scala:13) -// at Test$.f(a.scala:15) -// at Test$.main(a.scala:18) -// at Test.main(a.scala) diff --git a/test/files/neg/t8104/Test_2.scala b/test/files/neg/t8104/Test_2.scala index 585f76c00f..a3bd940188 100644 --- a/test/files/neg/t8104/Test_2.scala +++ b/test/files/neg/t8104/Test_2.scala @@ -9,7 +9,7 @@ object Test extends App { case class C(x: Int, y: Int) import scala.reflect.runtime.universe._ - def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr], tag: TypeTag[Repr]) = println(tag) + def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr], tag: WeakTypeTag[Repr]) = println(tag) reprify(C(40, 2)) // this is a compilation error at the moment as explained in SI-8104 diff --git a/test/files/neg/t8177a.check b/test/files/neg/t8177a.check new file mode 100644 index 0000000000..0d01206e0c --- /dev/null +++ b/test/files/neg/t8177a.check @@ -0,0 +1,6 @@ +t8177a.scala:5: error: type mismatch; + found : A{type Result = Int} + required: A{type Result = String} + : A { type Result = String} = x + ^ +one error found diff --git a/test/files/neg/t8177a.scala b/test/files/neg/t8177a.scala new file mode 100644 index 0000000000..d1e47f8c1e --- /dev/null +++ b/test/files/neg/t8177a.scala @@ -0,0 +1,6 @@ +trait A { type Result } + +class PolyTests { + def wrong(x: A { type Result = Int }) + : A { type Result = String} = x +}
\ No newline at end of file diff --git a/test/files/neg/t8244.check b/test/files/neg/t8244.check new file mode 100644 index 0000000000..90b2bf6f46 --- /dev/null +++ b/test/files/neg/t8244.check @@ -0,0 +1,4 @@ +Test_2.scala:9: error: value exxx is not a member of ?0 + raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X + ^ +one error found diff --git a/test/files/neg/t8244/Raw_1.java b/test/files/neg/t8244/Raw_1.java new file mode 100644 index 0000000000..0c667f1106 --- /dev/null +++ b/test/files/neg/t8244/Raw_1.java @@ -0,0 +1,4 @@ +public abstract class Raw_1<T>{ + public Raw_1 raw() { return new Raw_1<String>() { public String t() { return ""; } }; } + public abstract T t(); +} diff --git a/test/files/neg/t8244/Test_2.scala b/test/files/neg/t8244/Test_2.scala new file mode 100644 index 0000000000..152bb0b870 --- /dev/null +++ b/test/files/neg/t8244/Test_2.scala @@ -0,0 +1,12 @@ +class X extends Raw_1[X] { + override def t = this + def exxx = 0 +} + +object Test extends App { + def c(s: X) = { + val raw = s.raw + raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X + } + c(new X()) +} diff --git a/test/files/neg/t8244b.check b/test/files/neg/t8244b.check new file mode 100644 index 0000000000..f6cbf99eb5 --- /dev/null +++ b/test/files/neg/t8244b.check @@ -0,0 +1,4 @@ +t8244b.scala:15: error: value exxx is not a member of _$1 + raw.t.exxx + ^ +one error found diff --git a/test/files/neg/t8244b.scala b/test/files/neg/t8244b.scala new file mode 100644 index 0000000000..2fb4f451a1 --- /dev/null +++ b/test/files/neg/t8244b.scala @@ -0,0 +1,18 @@ +class Raw_1[T]{ + def raw(): Raw_1[_] = { new Raw_1[String] { def t() = "" } } + def t(): T +} + + +class X extends Raw_1[X] { + override def t = this + def exxx = 0 +} + +object Test extends App { + def c(s: X) = { + val raw = s.raw + raw.t.exxx + } + c(new X()) +} diff --git a/test/files/neg/t8244c.check b/test/files/neg/t8244c.check new file mode 100644 index 0000000000..fd58a5847c --- /dev/null +++ b/test/files/neg/t8244c.check @@ -0,0 +1,4 @@ +t8244c.scala:15: error: value exxx is not a member of _$1 + raw.t.exxx + ^ +one error found diff --git a/test/files/neg/t8244c.scala b/test/files/neg/t8244c.scala new file mode 100644 index 0000000000..2fb4f451a1 --- /dev/null +++ b/test/files/neg/t8244c.scala @@ -0,0 +1,18 @@ +class Raw_1[T]{ + def raw(): Raw_1[_] = { new Raw_1[String] { def t() = "" } } + def t(): T +} + + +class X extends Raw_1[X] { + override def t = this + def exxx = 0 +} + +object Test extends App { + def c(s: X) = { + val raw = s.raw + raw.t.exxx + } + c(new X()) +} diff --git a/test/files/neg/t8244e.check b/test/files/neg/t8244e.check new file mode 100644 index 0000000000..ebd74036e5 --- /dev/null +++ b/test/files/neg/t8244e.check @@ -0,0 +1,4 @@ +Test.scala:9: error: value exxx is not a member of ?0 + raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X + ^ +one error found diff --git a/test/files/neg/t8244e/Raw.java b/test/files/neg/t8244e/Raw.java new file mode 100644 index 0000000000..53202e319d --- /dev/null +++ b/test/files/neg/t8244e/Raw.java @@ -0,0 +1,4 @@ +public abstract class Raw<T>{ + public Raw raw() { return new Raw<String>() { public String t() { return ""; } }; } + public abstract T t(); +} diff --git a/test/files/neg/t8244e/Test.scala b/test/files/neg/t8244e/Test.scala new file mode 100644 index 0000000000..ca2a90583f --- /dev/null +++ b/test/files/neg/t8244e/Test.scala @@ -0,0 +1,12 @@ +class X extends Raw[X] { + override def t = this + def exxx = 0 +} + +object Test extends App { + def c(s: X) = { + val raw = s.raw + raw.t.exxx // java.lang.ClassCastException: java.lang.String cannot be cast to X + } + c(new X()) +} |