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
Explicit return causes scalac -optimize to fail #7792
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7792?orig=1
|
@retronym said:
|
@retronym said: |
@retronym said: |
@magarciaEPFL said: |
@retronym said (edited on Aug 29, 2013 10:22:58 AM UTC): object Return {
class Box[A](a: A) {
// @noinline avoids crash.
final def map[B](f: A => B): Box[B] = new Box(f(a))
}
def test(oi: Box[Int]) {
var res: Any = null;
try {
res = {
val f = (a: Any) => throw new RuntimeException()
oi.map(f)
()
}
} finally ()
()
}
}
|
Closing since it appears fixed in the new optimizer. |
Given this code:
When the
return
keyword is explicitly used and you try to compile it with-optimize
, it causes the compiler to fail with the following message:could not find init in: Return.test
The full trace is at https://gist.github.com/dkristian/6348965 (also attached).
It compiles fine without the
-optimize
flag, and works with the flag if the method definition is changed tooi.map(i => i.toString)
Discussion started at https://groups.google.com/forum/#!topic/scala-language/WTzjZ5dpPdo
The text was updated successfully, but these errors were encountered: