| [#80] | project: compiler | priority: medium | category: missing feature | |
|---|---|---|---|---|
| submitter | assigned to | status | date submitted | |
| Matthias | Martin | won't fix | 2003-07-21 14:26:37.0 | |
| subject | Local type inference restriction? | |||
| code |
trait X[A, B <: X[A, B]] {}
class Y[A] with X[A, Y[A]] {}
class Z[A, B <: X[A, B]](obj: B) {}
object Main {
def main(args: Array[String]) = {
val z = new Z(new Y[Int]);
}
}
|
|||
| what happened | I am not quite sure if this is a bug, or if this is a restriction of the local type inference algorithm. The pro\
gram above does not compile, it yields the following message:
|
|||
| what expected | No compile-time error. | |||
| [back to overview] | ||||
| Martin edited on 2003-07-31 12:04:53.0 |
| It's a shortcoming of the local type inference algorithm. The problem is that type parameters are minimized so that arguments fit formal parameters. The minimization might violate an F-bound. It seems to be quite hard to specify and implement an algorithm that takes care of F-bounds at the same time as solving minimization constraints. |