New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method call in subclass ruins protected[this]-ness once again #3272

Closed
scabug opened this Issue Apr 8, 2010 · 6 comments

Comments

Projects
None yet
2 participants
@scabug
Copy link

scabug commented Apr 8, 2010

trait A {
 trait C[+T] { 
   protected[this] def f(t: T) {}
 } 
 
 trait D[T] extends C[T] {
   def g(t: T) { f(t) } 
 }
}

gives:

a.scala:3: error: covariant type T occurs in contravariant position in type T of value t
   protected[this] def f(t: T) {}
                         ^
one error found

Compiles if g doesn't call f or if C and D are top-level traits. Seems to be related to #465.

@scabug

This comment has been minimized.

Copy link

scabug commented Apr 8, 2010

Imported From: https://issues.scala-lang.org/browse/SI-3272?orig=1
Reporter: @ingoem
Other Milestones: 2.10.0

@scabug

This comment has been minimized.

Copy link

scabug commented Mar 22, 2011

@paulp said:
See also #4345, which I'm glad I didn't assume was a duplicate because the fix for that seems to have left this unaffected.

@scabug

This comment has been minimized.

Copy link

scabug commented Apr 2, 2012

@ingoem said:
Is there a chance of this ever getting fixed? I keep coming up with the weirdest workarounds. If this exposes some loophole that is too hard to fix, it would be good to know.

@scabug

This comment has been minimized.

Copy link

scabug commented Apr 2, 2012

@paulp said:
I took a look, I think it was easy to fix. I probably have to go to the dentist before the tests finish, but maybe you will see a fix in the next couple hours.

@scabug

This comment has been minimized.

Copy link

scabug commented Apr 2, 2012

@paulp said:
03f32bd22f

@scabug scabug closed this Apr 2, 2012

@scabug

This comment has been minimized.

Copy link

scabug commented Apr 2, 2012

@ingoem said:
Awesome, that was quick! Thanks, Paul!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment