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
with Scala 2.10.0-RC1 I found an issue with stackable traits that
doesn't come up with Scala 2.9.2. Based on trait X
traitX { deffoo:PartialFunction[Int, Int] }
and two stackable traits Y and Z (that extend X):
traitYextendsX { abstractoverridedeffoo= { case i =>super.foo(i) *2 } }
traitZextendsX { abstractoverridedeffoo= { case i =>super.foo(i) +3 } }
I have another stackable trait Comb that combines what Y and Z are doing
(and that does some additional work):
traitCombextendsYwithZ { abstractoverridedeffoo:PartialFunction[Int, Int] = { case i =>super.foo(i) -2 } }
This compiles with Scala 2.9.2 without problems but with Scala
2.10.0-RC1 I'm getting the following error:
[error] ...: missing parameter typefor expanded function
[error] The argument types of an anonymous function must be fully known.
(SLS8.5)
[error] Expectedtypewas:
scala.runtime.AbstractPartialFunction[Int,Int] withSerializable
[error] traitCombextendsYwithZ { abstractoverridedeffoo= {
case i =>super.foo(i) -2 } }
[error] ^
[error] one error found
Of course I can get around this issue by writing the foo method type
explicitly
traitYextendsX { abstractoverridedeffoo:PartialFunction[Int, Int]
= { case i =>super.foo(i) *2 } }
traitZextendsX { abstractoverridedeffoo:PartialFunction[Int, Int]
= { case i =>super.foo(i) +3 } }
traitCombextendsYwithZ { abstractoverridedeffoo:PartialFunction[Int, Int] = { case i =>super.foo(i) -2 } }
but then any concrete class that should be modified with Comb must add
the foo method type as well i.e.
classTempextendsX { deffoo:PartialFunction[Int, Int] = { case i =>
i } }
valtmp=newTempwithComb// ...
which wasn't necessary with Scala 2.9.2 either. If the type is omitted i.e.
classTempextendsX { deffoo= { case i => i } }
valtmp=newTempwithComb// ...
I'm getting
[error] ...: overriding method foo in classTemp of type=>
scala.runtime.AbstractPartialFunction[Int,Int] withSerializable;
[error] method foo in traitComb of type=>PartialFunction[Int,Int]
has incompatible type
[error] valtmp2=newTempwithComb
[error] ^
[error] one error found
The text was updated successfully, but these errors were encountered:
(From at https://groups.google.com/d/topic/scala-user/2pcH-ck46Qg/discussion)
with Scala 2.10.0-RC1 I found an issue with stackable traits that
doesn't come up with Scala 2.9.2. Based on trait X
and two stackable traits Y and Z (that extend X):
I have another stackable trait Comb that combines what Y and Z are doing
(and that does some additional work):
This compiles with Scala 2.9.2 without problems but with Scala
2.10.0-RC1 I'm getting the following error:
Of course I can get around this issue by writing the foo method type
explicitly
but then any concrete class that should be modified with Comb must add
the foo method type as well i.e.
which wasn't necessary with Scala 2.9.2 either. If the type is omitted i.e.
I'm getting
The text was updated successfully, but these errors were encountered: