Details

      Description

      A simple return statement fails when CPS transformed. The same statement without CPS annotations works properly so the code structure itself is OK.

      This form should be able to be transformed.

      import scala.util.continuations._
      
      object Test {
      
        def test1(): Int @cps[Int] = {
          return 1
        }
      
        def main(args: Array[String]): Any = {
          println(reset(test1()))
        }
      
      }
      
      $ ~/opt/scala-2.10.0.dev-1302-g6a33a20/bin/scala -P:continuations:enable returnX.scala
      /p/scala/bugs/returnX.scala:8: error: type mismatch;
       found   : Int(1)
       required: Int @util.continuations.cps[Int]
          return 1
                 ^
      one error found
      

        Activity

        Hide
        Rich Dougherty added a comment -

        Happens in typer phase before (I think) continuations plugin even gets a chance to run.

        Show
        Rich Dougherty added a comment - Happens in typer phase before (I think) continuations plugin even gets a chance to run.
        Hide
        Grzegorz Kossakowski added a comment -
        Show
        Grzegorz Kossakowski added a comment - Fixed in https://github.com/scala/scala/pull/994
        Hide
        Adriaan Moors added a comment -
        Show
        Adriaan Moors added a comment - fixed for 2.9.3 in https://github.com/scala/scala/pull/1560

          People

          • Assignee:
            Philipp Haller
            Reporter:
            Rich Dougherty
          • Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development