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 anon class passed to right assoc method in constructor argument of anon class that extends trait #6506

Closed
scabug opened this issue Oct 10, 2012 · 6 comments

Comments

@scabug
Copy link

@scabug scabug commented Oct 10, 2012

https://github.com/espringe/wisp/blob/04a2c643933b0fec871ba186e233da0019802ebe/src/main/scala/wisp/reader.scala#L64

If you remove that temporary variable (and put the statement inline), the code the compiler generates results in:

Caught1: java.lang.VerifyError: (class:
wisp/Reader$$anonfun$wisp$Reader$$literalListParser$1$$anonfun$apply$36$$anon$7,
method: signature:
(Lwisp/Reader$$anonfun$wisp$Reader$$literalListParser$1$$anonfun$apply$36;Lscala/collection/immutable/List;)V)
Expecting to find object/array on stack

Easy enough to reproduce:

$ git clone git@github.com:espringe/wisp.git
$ cd wisp && git checkout 04a2c643933b0fe
$ sbt test # all works fine
// remove tmp variable /src/main/scala/wisp/reader.scala:L64
$ sbt test # watch it asplode

@scabug
Copy link
Author

@scabug scabug commented Oct 10, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6506?orig=1
Reporter: Eric Springer (espringe)
See #6666

@scabug
Copy link
Author

@scabug scabug commented Oct 11, 2012

@retronym said:

[info] Resolving org.specs2#specs2_2.10.0-M7;1.13-SNAPSHOT ...
[warn] 	module not found: org.specs2#specs2_2.10.0-M7;1.13-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/jason/.ivy2/local/org.specs2/specs2_2.10.0-M7/1.13-SNAPSHOT/ivys/ivy.xml
[warn] ==== Sonatype OSS Snapshots: tried
[warn]   https://oss.sonatype.org/content/repositories/snapshots/org/specs2/specs2_2.10.0-M7/1.13-SNAPSHOT/specs2_2.10.0-M7-1.13-SNAPSHOT.pom
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/specs2/specs2_2.10.0-M7/1.13-SNAPSHOT/specs2_2.10.0-M7-1.13-SNAPSHOT.pom
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	::          UNRESOLVED DEPENDENCIES         ::
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	:: org.specs2#specs2_2.10.0-M7;1.13-SNAPSHOT: not found
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/jason/code/wisp/}default-5a12e1/*:update: sbt.ResolveException: unresolved dependency: org.specs2#specs2_2.10.0-M7;1.13-SNAPSHOT: not found
[error] Total time: 3 s, completed Oct 11, 2012 8:19:15 AM

@scabug
Copy link
Author

@scabug scabug commented Oct 11, 2012

@retronym said:
I can reproduce by changing the Specs version and forcing use of Java 7.

https://gist.github.com/3870578

@scabug
Copy link
Author

@scabug scabug commented Oct 11, 2012

@retronym said (edited on Oct 11, 2012 8:03:50 AM UTC):
Here's a minimization. Demonstrated in 2.8.1; this isn't a regression.

 ~/code/scala scala28
Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.

scala> object S { def #::(a: Any): Any = () }              
defined module S

scala> trait T; class WL(a: Any); new WL(new {} #:: S) with T 
java.lang.VerifyError: (class: $anon$1, method: <init> signature: ()V) Expecting to find object/array on stack
	at .<init>(<console>:8)

scala> trait T; class WL(a: Any); new WL(S.#::(new {})) with T
defined trait T
defined class WL

scala> class WL(a: Any); new WL(new {} #:: S)           
defined class WL

scala> trait T; class WL(a: Any); object X extends WL(new {} #:: S) with T; X     
defined trait T
defined class WL
defined module X

@scabug
Copy link
Author

@scabug scabug commented Jan 11, 2013

@gkossakowski said:
I heard from James Iry that Jason is looking into this problem so I'm reassigning it.

My opinion is that we should reject declaring classes in super constructor calls.

@scabug
Copy link
Author

@scabug scabug commented Jan 16, 2013

@retronym said:
Looks like a variation of #6666.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants