- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Workaround protected[this] bug?
Wed, 2011-10-05, 10:07
Dear all,
I am blocked on a bug that I think is an instance of this:
https://issues.scala-lang.org/browse/SI-3272
trait A { trait C[+T] { protected[this] def f(t: T) {} } trait D[T] extends C[T] { def g(t: T) { f(t) } } }
My understanding is that it should compile.
Is there any way (even very hackish) to modify my program so I can go on?
Do we know what is the last version of the compiler without that bug?
Best regards,
Nicolas.
I am blocked on a bug that I think is an instance of this:
https://issues.scala-lang.org/browse/SI-3272
trait A { trait C[+T] { protected[this] def f(t: T) {} } trait D[T] extends C[T] { def g(t: T) { f(t) } } }
My understanding is that it should compile.
Is there any way (even very hackish) to modify my program so I can go on?
Do we know what is the last version of the compiler without that bug?
Best regards,
Nicolas.
Wed, 2011-10-05, 10:47
#2
Re: Workaround protected[this] bug?
scala> trait C[+T] { | protected[this] def f(t: T @uncheckedVariance) {} | }<console>:8: error: not found: type uncheckedVariance protected[this] def f(t: T @uncheckedVariance) {}
^No, but it looks promising.
(Currently, I have removed the enclosing traits that were just used for top-level modularity. But with a hack like this, I could type check without the enclosing traits and when it is correct, put back the enclosing trait + unsafeAnnotations)
(Currently, I have removed the enclosing traits that were just used for top-level modularity. But with a hack like this, I could type check without the enclosing traits and when it is correct, put back the enclosing trait + unsafeAnnotations)
Wed, 2011-10-05, 10:57
#3
Re: Workaround protected[this] bug?
On Wed, Oct 5, 2011 at 10:39 AM, nicolas.oury@gmail.com
wrote:
> scala> trait C[+T] {
> | protected[this] def f(t: T @uncheckedVariance) {}
> | }
> :8: error: not found: type uncheckedVariance
> protected[this] def f(t: T @uncheckedVariance) {}
> ^
> No, but it looks promising.
You need,
import scala.annotation.unchecked.uncheckedVariance
as well ;-)
Cheers,
Miles
On Wed, Oct 5, 2011 at 10:07 AM, nicolas.oury@gmail.com
wrote:
> Dear all,
> I am blocked on a bug that I think is an instance of this:
> https://issues.scala-lang.org/browse/SI-3272
> trait A {
> trait C[+T] {
> protected[this] def f(t: T) {}
> }
>
> trait D[T] extends C[T] {
> def g(t: T) { f(t) }
> }
> }
> My understanding is that it should compile.
> Is there any way (even very hackish) to modify my program so I can go on?
> Do we know what is the last version of the compiler without that bug?
Does this work for you?
trait C[+T] {
protected[this] def f(t: T @uncheckedVariance) {}
}
Cheers,
Miles