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
DelayedInit crashes following $outer pointers #4683
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4683?orig=1 |
Flávio W. Brasil (fwbrasil) said: |
@lexn82 said: The following code will generate "java.lang.NoSuchFieldError: a$1" at run-time: object Error {
def main(args: Array[String]) {
val a: A = new A
var b: B = null
new Bug {
val b = foo(a)
}
}
}
class A
class B
class Bug extends DelayedInit {
def foo(a: A) :B = new B
def delayedInit(init: => Unit) { init }
} |
@jrudolph said: https://groups.google.com/d/topic/spray-user/LzV4lEVVccI/discussion The same code works with 2.10 but fails to compile in 2.9.2. |
Jesse Luehrs (doy) said: class Foo extends DelayedInit {
def delayedInit (newBody: => Unit) {
body = () => newBody
}
def foo = "FOO"
var body: () => Unit = _
}
class Bar extends Foo {
def bar = foo
private class Baz extends Foo {
bar
}
} This is on version 2.10.0-20121205-235900-18481cef9b. |
@retronym said: trait MatExpWorld { self =>
class T extends Runner { val expWorld: self.type = self }
}
trait Runner extends DelayedInit {
val expWorld: MatExpWorld
} |
@JamesIry said: |
@retronym said: class Entity extends DelayedInit {
def delayedInit(x: => Unit) {x}
class Field
protected def EntityField[T <: Entity: Manifest] = new Field
def find[T <: Entity: Manifest] {
Nil.map(dbo => {
class EntityHolder extends Entity {
val entity = EntityField[T]
}
})
}
} |
Thornton Chamberlain (tchamberlain) said: trait T extends DelayedInit {
def delayedInit(body: => Unit) = {
println("In delayedInit")
body
}
}
val f = {(p1: Int) => new T{println(p1)}}
f(5) In 2.10.3, this fails with 'error: symbol value p1$1 does not exist in $anonfun$1$$anon$1$delayedInit$body.apply' I encountered this when trying to use a Specs2 After context with a data table. |
@retronym said: |
@retronym said: class C extends DelayedInit {
def delayedInit(body: => Unit) {}
}
class Injector {
def test = {
val name = ""
class crash extends C {
println(name)
}
}
} |
@lrytz said: |
[Elided, replaced.]
The text was updated successfully, but these errors were encountered: