[#172] | project: specification | priority: low | category: feature | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Erik | Martin | won't fix | 2003-10-01 16:23:25.0 | |
subject | List(...) in package scala | |||
code |
A.scala: --- class A() { def l:List[A] = List(this); } ------ B.scala: --- package scala; class B() { def l:List[B] = List(this); } ----- C.scala --- package scala; class C() { def l:List[C] = this::Nil; } ----- D.scala --- package scala; class D() { def l:List[D] = Predef.List(this); } |
|||
what happened | B.scala gives the error B.scala:4: object scala.List of type scala.List cannot be applied to (scala.B) w ith expected result type scala.List[scala.B] def l:List[B] = List(this); ^ one error found |
|||
what expected | That all four files should compile... | |||
[back to overview] |
Martin edited on 2003-10-06 12:26:38.0 |
This is what the spec mandates. Every program is implicitly
prefixed by the three import clauses. The example program becomes:
import java.lang._; import scala._; import scala.Predef._; package scala { ... List ... }Furthermore, in package scala there exists a module List. The reference to List inside the package is to that module; it shadows the List which was previously imported from Predef. |