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

compiler fails with assertion when trait defines a closure over private[this] member

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.1, Scala 2.10.0
    • Fix Version/s: Scala 2.11.0-M8
    • Component/s: Misc Compiler
    • Environment:

      I've reproduced this bug in clear gentoo environment.

      Description

      There was strange assertion fail while compiling a project. I know scala very basic and don't sure if used construction is valid in language reference, but compiler should generate more sensible error output in my opinion.

      I've attached example file with several sections. Clear ones are ok, commented make compiler fail

        Issue Links

          Activity

          Hide
          Paul Phillips added a comment -

          Let me just say WHAT A GREAT TEST CASE. If everyone came up with such great test cases by now you'd be able to use the scala compiler to operate nuclear reactors in low earth orbit.

          Show
          Paul Phillips added a comment - Let me just say WHAT A GREAT TEST CASE. If everyone came up with such great test cases by now you'd be able to use the scala compiler to operate nuclear reactors in low earth orbit.
          Hide
          Adriaan Moors added a comment -

          simplified:

          object Test {
            trait NestedTrait { // must be nested and a trait
              private[this] val _st : Int = 0 // must be private[this]
              val escape = { () => _st }
            }
          }
          
          Show
          Adriaan Moors added a comment - simplified: object Test { trait NestedTrait { // must be nested and a trait private[this] val _st : Int = 0 // must be private[this] val escape = { () => _st } } }
          Hide
          Adriaan Moors added a comment -

          Paul, I can only assume your all-caps enthusiasm means you'd like to go nuclear on this one? If not, please reassign.

          Show
          Adriaan Moors added a comment - Paul, I can only assume your all-caps enthusiasm means you'd like to go nuclear on this one? If not, please reassign.
          Hide
          Adriaan Moors added a comment -

          Un-assigning to foster work stealing, as announced in https://groups.google.com/forum/?fromgroups=#!topic/scala-internals/o8WG4plpNkw

          Show
          Adriaan Moors added a comment - Un-assigning to foster work stealing, as announced in https://groups.google.com/forum/?fromgroups=#!topic/scala-internals/o8WG4plpNkw
          Hide
          Adriaan Moors added a comment -

          Unassigning and rescheduling to M6 as previous deadline was missed.

          Show
          Adriaan Moors added a comment - Unassigning and rescheduling to M6 as previous deadline was missed.
          Hide
          Jason Zaugg added a comment -

          Here's an analysis and one solution:

          https://github.com/retronym/scala/tree/ticket/5508

          Show
          Jason Zaugg added a comment - Here's an analysis and one solution: https://github.com/retronym/scala/tree/ticket/5508
          Show
          Jason Zaugg added a comment - https://github.com/scala/scala/pull/3199

            People

            • Assignee:
              Jason Zaugg
              Reporter:
              ayvango
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development