From abc5b5f47f4bb963e229cb90a6ff93152ee09a98 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Thu, 13 Aug 2009 08:37:29 +0000 Subject: fixed #2251 --- test/files/neg/bug987.check | 29 +++++++++++++---------------- test/files/pos/ticket2251.scala | 23 +++++++++++++++++++++++ 2 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 test/files/pos/ticket2251.scala (limited to 'test') diff --git a/test/files/neg/bug987.check b/test/files/neg/bug987.check index 4cad622ab8..ec2ca621fd 100644 --- a/test/files/neg/bug987.check +++ b/test/files/neg/bug987.check @@ -1,19 +1,16 @@ -bug987.scala:15: error: illegal inheritance; - class E inherits different type instances of trait B: -B[D] and B[C] +bug987.scala:15: error: the type intersection D with ScalaObject is malformed + --- because --- +no common type instance of base types B[C], and B[D] exists. class E extends D - ^ -bug987.scala:20: error: illegal inheritance; - class F inherits different type instances of trait B: -B[D] and B[C] + ^ +bug987.scala:20: error: the type intersection D with ScalaObject is malformed + --- because --- +no common type instance of base types B[C], and B[D] exists. class F extends D - ^ -bug987.scala:25: error: illegal inheritance; - class D inherits different type instances of trait B: -B[D] and B[C] + ^ +bug987.scala:25: error: the type intersection C with B[D] with ScalaObject is malformed + --- because --- +no common type instance of base types B[D], and B[C] exists. abstract class D extends C with B[D] {} - ^ -bug987.scala:25: error: type arguments [D] do not conform to trait B's type parameter bounds [T <: B[T]] -abstract class D extends C with B[D] {} - ^ -four errors found + ^ +three errors found diff --git a/test/files/pos/ticket2251.scala b/test/files/pos/ticket2251.scala new file mode 100644 index 0000000000..1e8727e999 --- /dev/null +++ b/test/files/pos/ticket2251.scala @@ -0,0 +1,23 @@ +// derived from pos/bug1001 +class A +trait B[T <: B[T]] extends A +class C extends B[C] +class D extends B[D] + +class Data { + // force computing lub of C and D (printLubs enabled:) + +/* +lub of List(D, C) at depth 2 + lub of List(D, C) at depth 1 + lub of List(D, C) at depth 0 + lub of List(D, C) is A + lub of List(D, C) is B[_1] forSome { type _1 >: D with C <: A } +lub of List(D, C) is B[_2] forSome { type _2 >: D with C{} <: B[_1] forSome { type _1 >: D with C{} <: A } } +*/ +// --> result = WRONG + + // should be: B[X] forSome {type X <: B[X]} -- can this be done automatically? for now, just detect f-bounded polymorphism and fall back to more coarse approximation + + val data: List[A] = List(new C, new D) +} -- cgit v1.2.3