Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.1
    • Fix Version/s: Scala 2.11.0-M8
    • Component/s: Misc Compiler
    • Labels:
    • Environment:

      Windows. Java 1.6.0_23

      Description

      Compiler crash. Both in repl and scalac.

      class Arne[@specialized (Int) T](val v:T, next: =>T){
        lazy val pelle = next
      }
      
      Error: uncaught exception during compilation: java.lang.AssertionError
      ava.lang.AssertionError: assertion failed:
          while compiling: <console>
             during phase: global=mixin, atPhase=cleanup
          library version: version 2.10.1
         compiler version: version 2.10.1
       reconstructed args:
      
       last tree to typer: TypeTree(object Int)
                   symbol: object Int in package scala (flags: <module>)
        symbol definition: class Int extends AnyValCompanion
                      tpe: Int.type
            symbol owners: object Int -> package scala
           context owners: method pelle$mcI$sp$lzycompute -> class iw$Arne$mcI$sp -> package $line3
      

        Activity

        Hide
        Paul Phillips added a comment -

        Regression between 2.9 and 2.10.0.

        Show
        Paul Phillips added a comment - Regression between 2.9 and 2.10.0.
        Hide
        Paul Phillips added a comment -

        Further minimized.

        class Arne[@specialized(Int) T](x: T) { lazy val y = x }
        
        Show
        Paul Phillips added a comment - Further minimized. class Arne[@specialized(Int) T](x: T) { lazy val y = x }
        Hide
        Paul Phillips added a comment -

        Regressed in f7d5f45aa7 courtesy of one E. Osheim.

         commit f7d5f45aa7
         Author: Erik Osheim <d_m@plastic-idolatry.com>
         Date:   11 months ago
         
             Specialize lazy vals (closes SI-5552)
             
             Previously, specialized lazy vals would not work at all when used in
             specialized classes, and would just return an uninitialized value.
             After this patch, they work in the same way as other specialized fields
             do (i.e. a new specialized field is created, and the specialized class
             uses that instead of the base class' field).
             
             Note that there are still known problems with specialized lazy vals
             (for instance SI-4717) but it seemed to me that this was better than
             nothing.
         
        Show
        Paul Phillips added a comment - Regressed in f7d5f45aa7 courtesy of one E. Osheim. commit f7d5f45aa7 Author: Erik Osheim <d_m@plastic-idolatry.com> Date: 11 months ago Specialize lazy vals (closes SI-5552) Previously, specialized lazy vals would not work at all when used in specialized classes, and would just return an uninitialized value. After this patch, they work in the same way as other specialized fields do (i.e. a new specialized field is created, and the specialized class uses that instead of the base class' field). Note that there are still known problems with specialized lazy vals (for instance SI-4717) but it seemed to me that this was better than nothing.
        Hide
        Paul Phillips added a comment -

        Although in fairness, like the comment says – in 2.9 it doesn't crash, but it also doesn't work. So "regression" is being applied liberally here.

        Show
        Paul Phillips added a comment - Although in fairness, like the comment says – in 2.9 it doesn't crash, but it also doesn't work. So "regression" is being applied liberally here.
        Show
        Jason Zaugg added a comment - https://github.com/scala/scala/pull/3297

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Raul Bache
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development