Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-3272

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

    Details

      Description

      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 SI-465.

        Attachments

          Activity

            People

            • Assignee:
              extempore Paul Phillips
              Reporter:
              imaier Ingo Maier
              TracCC:
              Paul Phillips
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: