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

Bogus type mismatch reported against default implicit argument

    Details

      Description

      With trunk as of 2.10.0.r26093-b20111130020250 compiling the following,

      class A[T]
      class B {
        def m(a: A[this.type] = new A[this.type]) { }
      }
       
      object DefaultArgBogusTypeMismatch {
        def newB = new B
       
        newB.m()
       
        // this compiles
        // val stableB = new B
        // stableB.m()
      }
      

      Results in the error report below,

      t5259.scala:9: error: type mismatch;
       found   : A[_2.type] where val _2: B
       required: A[_1.type] where val _1: B
        newB.m()
             ^
      

      Adriaan's comment is that it shouldn't be necessary to existentially abstract over the "this" reference, which is what's causing the problem here.

        Attachments

          Activity

            People

            • Assignee:
              rytz Lukas Rytz
              Reporter:
              milessabin Miles Sabin
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: