Aladdin - Scala Bugtracking
[#1096] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Iulian Martin fixed 2007-05-10 14:32:01.0
subject [contrib #463] VerifyError with early field initializer (again)
code
VerifyError:

trait A
class B extends {
  val obj = new Object {}
} with A


It works without anonymous subclassing:

trait A
class B extends {
  val obj = new Object
} with A
what happened
java.lang.VerifyError: (class: B, method:  signature: ()V) Expecting to find object/array on stack
        at .(:5)
        at .()
        at RequestResult$.(:3)
        at RequestResult$.()
        at RequestResult$result()
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Native...
what expected No VerifyError.
[back to overview]
Changes of this bug report
Iulian  edited on  2007-05-10 15:46:59.0
This should not pass typing, since the anonymous class created in the early initialization section is taking an 'outer' parameter, the uninitialized 'this': new template $anon(B.this) Writing such code by hand is properly rejected, it seems the explicit outer phase is typing these statements in a more relaxed mode.
Martin  edited on  2007-05-11 02:31:45.0