Scala Programming Language
  1. Scala Programming Language
  2. SI-6891

parameterized value class and tail call: crash

    Details

      Description

      import scala.annotation.tailrec
      
      object Foo {
        implicit class Foo[A](val x: Int) extends AnyVal {
          def bippy() = {
            @tailrec def loop(x: A): Unit = loop(x)
            ()
          }
        }
        // uncaught exception during compilation: Types$TypeError("type mismatch;
        //  found   : A(in method bippy$extension)
        //  required: A(in class Foo)") @ scala.tools.nsc.typechecker.Contexts$Context.issueCommon(Contexts.scala:396)
        // error: scala.reflect.internal.Types$TypeError: type mismatch;
        //  found   : A(in method bippy$extension)
        //  required: A(in class Foo)
      }
      

        Issue Links

          Activity

          Hide
          Jason Zaugg added a comment -

          See the fix of SI-6482 for some inspiration.

          Diagnosis and a first cut at a fix:

          https://github.com/retronym/scala/compare/ticket/6891

          I've posed some questions in the commit comment that are puzzling me.

          Show
          Jason Zaugg added a comment - See the fix of SI-6482 for some inspiration. Diagnosis and a first cut at a fix: https://github.com/retronym/scala/compare/ticket/6891 I've posed some questions in the commit comment that are puzzling me.
          Hide
          Jason Zaugg added a comment -

          I think I can see the correct fix for this.

          Wish me luck: https://scala-webapps.epfl.ch/jenkins/job/scala-checkin-manual/755/console

          Show
          Jason Zaugg added a comment - I think I can see the correct fix for this. Wish me luck: https://scala-webapps.epfl.ch/jenkins/job/scala-checkin-manual/755/console
          Hide
          Paul Phillips added a comment -

          Alas, poor retronym, we knew him well.

          Show
          Paul Phillips added a comment - Alas, poor retronym, we knew him well.
          Hide
          Jason Zaugg added a comment -
          Show
          Jason Zaugg added a comment - Back from the brink: https://github.com/scala/scala/pull/1936

            People

            • Assignee:
              Jason Zaugg
              Reporter:
              Paul Phillips
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development