[#449] | project: compiler | priority: low | category: bug | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Gilles | Martin | fixed | 2005-06-15 18:06:36.0 | |
subject | View in scope makes overloaded methods ambiguous in a strange way | |||
code |
class C; class B; class D; object Convert { implicit def view (value:B): C = new C; implicit def view (value:C): B = new B; } object Test { def tata (value:B): D = new D; def tata (value:C): D = new D; import Convert._; val toto: D = tata(new B()); } |
|||
what happened | Compilation fails:ambiguous reference to overloaded definition, both method tata: (C)D and method tata: (B)D match argument types (B) and expected result type D val toto: D = tata(new B()); ^What makes it even stranger is that if any one method tata or view is removed, the compilation behaves normaly, \ including when the second view (that just can't be used in this example) is removed. |
|||
what expected | A sucessful compilation. As far as I understand, no view should even approach the code when the type of an expression can be inferred without using such a view (which is the case in my example). |
|||
[back to overview] |
Gilles edited on 2006-03-24 18:11:32.0 |
Fixed in Scala2 |