You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
trait Foo { implicit val timeout = 1 second }
trait Bar extends Foo { implicit override val timeout = 2 seconds }
In2.10.0-RC2 and 2.10.0-RC3, the implicit conversion that gives the seconds method to Intfails:
Welcome to Scala version 2.10.0-RC3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :load foo.scala
Loading foo.scala...
import scala.concurrent.duration._
warning: there were 1 feature warnings; re-run with -feature for details
defined trait Foo
:11: error: value seconds is not a member of Int
trait Bar extends Foo { implicit override val timeout = 2 seconds }
^
{code}
When the implicit keyword is removed from the overridden val, the implicit conversion works properly.
The text was updated successfully, but these errors were encountered:
@paulp said:
For some reason if the overriding implicit is typed without an expected type, the failure is reported. It looks to me like it proceeds to type the override with an expected type of Int, at which point it finds the implicit, but it's too late. Supposed to be a silent context being used somewhere?
Consider this:
{code}import scala.concurrent.duration._
trait Foo { implicit val timeout = 1 second }
trait Bar extends Foo { implicit override val timeout = 2 seconds }
Welcome to Scala version 2.10.0-RC3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :load foo.scala
Loading foo.scala...
import scala.concurrent.duration._
warning: there were 1 feature warnings; re-run with -feature for details
defined trait Foo
:11: error: value seconds is not a member of Int
trait Bar extends Foo { implicit override val timeout = 2 seconds }
^
{code}
When the implicit keyword is removed from the overridden val, the implicit conversion works properly.
The text was updated successfully, but these errors were encountered: