File: ticket2251.scala

package info (click to toggle)
scala 2.9.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 67,252 kB
  • ctags: 6,602
  • sloc: java: 27,488; xml: 4,412; python: 2,297; sh: 734; makefile: 16; ansic: 6
file content (25 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

// Martin: I am not sure this is a solvable problem right now. I'll leave it in pending.
// 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)
}