Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scalac crash specialized lazy val #7406

Closed
scabug opened this issue Apr 22, 2013 · 6 comments
Closed

Scalac crash specialized lazy val #7406

scabug opened this issue Apr 22, 2013 · 6 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Apr 22, 2013

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
@scabug
Copy link
Author

scabug commented Apr 22, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7406?orig=1
Reporter: Raul Bache (arneball)
Affected Versions: 2.10.1

@scabug
Copy link
Author

scabug commented Apr 22, 2013

@paulp said:
Regression between 2.9 and 2.10.0.

@scabug
Copy link
Author

scabug commented Apr 22, 2013

@paulp said:
Further minimized.

class Arne[@specialized(Int) T](x: T) { lazy val y = x }

@scabug
Copy link
Author

scabug commented Apr 22, 2013

@paulp said:
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.

@scabug
Copy link
Author

scabug commented Apr 22, 2013

@paulp said:
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.

@scabug scabug closed this as completed Dec 31, 2013
@scabug
Copy link
Author

scabug commented Dec 31, 2013

@retronym said:
scala/scala#3297

@scabug scabug added this to the 2.11.0-M8 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants