| [#324] | project: compiler | priority: high | category: bug | |
|---|---|---|---|---|
| submitter | assigned to | status | date submitted | |
| Matthias | Martin | fixed | 2004-04-30 16:56:54.0 | |
| subject | Looping compiler with polymorphic view | |||
| code |
object Main with Application {
def view[S, T <% Seq[S]](xs: T): List[S] = xs.toList;
val xs = Array(10, 23, 23);
Console.println(xs : List[Int])
}
|
|||
| what happened | The compiler loops when the given program is compiled. |
|||
| what expected | Compiler & runtime positive. | |||
| [back to overview] | ||||
| Martin edited on 2004-05-04 18:55:13.0 |
Actually, the example is illegal. The compiler prints out now the error messages:
test/new/bug324.scala:2: view is potentially self-referential since its result type scala.List[S] is a subtype of its type parameter's view bound scala.Seq[S?]
def view[S, T <% Seq[S]](xs: T): List[S] = xs.toList;
^
test/new/bug324.scala:4: type mismatch;
found : scala.Array[scala.Int]
required: scala.List[scala.Int]
Console.println(xs : List[Int])
^
two errors found
|