Details

      Description

      It's generally possible in the interpreter to find the type of an expression, even if the evaluation of that expression would diverge. For example:

      scala> def ridiculous(n: Int): Int = ridiculous(n+1)
      ridiculous: (n: Int)Int
      
      scala> :t ridiculous(0)
      Int
      

      However, when the type of an expression is Unit, the interpreter appears to evaluate the expression instead of showing its type:

      scala> def ridiculous(n: Int): Unit = ridiculous(n+1)
      ridiculous: (n: Int)Unit
      
      scala> :t ridiculous(0)
      [ ... interpreter gets stuck ]
      

      A simpler example:

      scala> :t println("ridiculous")
      ridiculous
      

      In either case I'd expect no evaluation and no side effects to occur, and the interpreter to print "Unit". This worked in 2.9.x, and broke somewhere in 2.10 development.

        Activity

        Hide
        Dan Rosen added a comment -

        Took a stab at this and broke stuff: https://github.com/scala/scala/pull/2191

        Show
        Dan Rosen added a comment - Took a stab at this and broke stuff: https://github.com/scala/scala/pull/2191

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Dan Rosen
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development