Skip to content
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
Closed

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

scabug opened this issue Apr 8, 2010 · 6 comments
Assignees
Milestone

Comments

@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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

scabug commented Apr 2, 2012

@paulp said:
03f32bd22f

@scabug scabug closed this as completed Apr 2, 2012
@scabug
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants