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

VerifyError with implicit objects #473

Closed
scabug opened this issue Feb 12, 2008 · 6 comments
Closed

VerifyError with implicit objects #473

scabug opened this issue Feb 12, 2008 · 6 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Feb 12, 2008

The following code compiles but upon being run produces a VerifyError:

package test;

class Foo(implicit val foo : Foo);

object Test extends Application{
implicit object Bar extends Foo;
Bar.foo
}

java.lang.VerifyError: (class: test/Test$$Bar$$, method: signature: ()V) Expecting to find object/array on stack
at test.Test$$.(test.scala:7)
at test.Test$$.(test.scala)
at test.Test.main(test.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala.tools.nsc.ObjectRunner$$$$anonfun$$run$$1.apply(ObjectRunner.scala:75)
at scala.tools.nsc.ObjectRunner$$.withContextClassLoader(ObjectRunner.scala:49)
at scala.tools.nsc.ObjectRunner$$.run(ObjectRunner.scala:74)
at scala.tools.nsc.MainGenericRunner$$.main(MainGenericRunner.scala:161)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

The problem exists in both 2.6.1 and 2.7.0-RC1.

@scabug
Copy link
Author

scabug commented Feb 12, 2008

Imported From: https://issues.scala-lang.org/browse/SI-473?orig=1
Reporter: @DRMacIver

@scabug
Copy link
Author

scabug commented Feb 13, 2008

@dragos said:
This looks like something that should be forbidden: the superclass constructor needs an implicit Foo, and the compiler passes the implicit object being constructed. The verification error simply says that the object passed to the super constructor is not initialized.

@scabug
Copy link
Author

scabug commented Feb 22, 2008

@dragos said:
This should be checked by the type checker.

@scabug
Copy link
Author

scabug commented Nov 7, 2008

@paulp said:
I don't think this is specific to implicits. Observe:

case class Foo(x: Foo)
case object Bar extends Foo(null)
case object Quux extends Foo(Bar)
case object Voop extends Foo(Voop)

This will compile fine, but the self-referential object triggers the same error:

scala> Bar 
res0: Bar.type = Bar

scala> Quux
res1: Quux.type = Quux

scala> Voop
java.lang.VerifyError: (class: Voop$$, method: <init> signature: ()V) Expecting to find object/array on stack

@scabug
Copy link
Author

scabug commented Jan 14, 2009

@odersky said:
Milestone next_bugfix deleted

@scabug
Copy link
Author

scabug commented Feb 16, 2009

@paulp said:
Fixed in r17118.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants