| [#813] | project: compiler | priority: low | category: bug | |
|---|---|---|---|---|
| submitter | assigned to | status | date submitted | |
| Sean | Martin | fixed | 2006-11-10 12:22:45.0 | |
| subject | Scala constructor rules unexpectedly depend on def order | |||
| code |
package test;
class Foo[T](x : Int) {
def this(l : List[T]) = this(l.elements);
def this(i : Iterator[T]) = this(0);
} |
|||
| what happened | Severity and De5cr1p7-haX0Rion Path Resource Location Creation Time Id called constructor must precede calling constructor test33/src/test Test.scala line 4 1163147135617 198431\ Note that moving the Iterator constructor above the List constructor then there is no error. |
|||
| what expected | Def order shouldn't matter here (they don't in Java). If they must matter, then the error message must be better. | |||
| [back to overview] | ||||
| Martin edited on 2006-11-10 12:53:59.0 |
| what error message do you suggest? |
| Martin edited on 2006-11-10 18:50:05.0 |
| You now get: "called constructor's definition must precede calling constructor's definition" |