-
Notifications
You must be signed in to change notification settings - Fork 21
regression: assertion error in Mixin.transformInfo, with $$anon script wrapper #4202
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4202?orig=1 |
@paulp said: Welcome to Scala version 2.9.0.r24136-b20110128174513 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_22).
scala> object o {
| def x[N[_]] = ()
|
| trait ExistT[M[_]] {
| x[M]
| }
| }
defined module o
scala> o.x
Welcome to Scala version 2.9.0.r24068-b20110123233401 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_22).
scala> object o {
| def x[N[_]] = ()
|
| trait ExistT[M[_]] {
| x[M]
| }
| }
defined module o
scala> o.x
|
@retronym said: object Main {
def x[N[_]] = ()
def main = {
class $$anon { // rename to 'anon' to get rid of crash
object scratch {
trait ExistT[M[_]] { // s/trait/class/ to get rid of crash
x[M]
}
}
}
}
}
Gives: ~/code/scratch: scalac -version
Scala compiler version 2.8.1.final -- Copyright 2002-2010, LAMP/EPFL
~/code/scratch: scalac /Users/jason/code/scalaz/core/scratch.scala ~/code/scratch: ~/usr/scala-2.9.0.r24145-b20110130020134/bin/scalac /Users/jason/code/scalaz/core/scratch.scala
Exception in thread "main" java.lang.AssertionError: assertion failed
at scala.Predef$$.assert(Predef.scala:85)
at scala.tools.nsc.transform.Mixin.transformInfo(Mixin.scala:375)
|
@adriaanm said: object Main {
def x = 1
class $$anon { // rename to 'anon' to get rid of crash
object scratch {
trait ExistT { // s/trait/class/ to get rid of crash
x
}
}
}
} look ma, no type constructors! |
@retronym said: For the record, my use of '$$' was just to replicate the inner machinations of the script runner. The following crashes, when run as a script. script.scala: |
@retronym said: object t4202 {
() => {
trait T {
def t = ()
}
object T2 extends T {
t
}
}
} |
@paulp said: Putting r24206 to work, here it is after lazyvals: // I'm using: () => { trait T { def t = () } }
object t4202 final
constructor t4202
value <local t4202>
anonymous class $$anonfun final <synthetic>
constructor $$anonfun
method apply final
method apply final <bridge>
value <local $$anonfun> And then here after lambdalift. Notice the trait implementation class is being renamed to "T$$class$$1" which is pretty clearly wrong. I'm able to push the error downfield by excluding .isImplClass but the problem is deeper. object t4202 final
anonymous class $$anonfun$$1 final <synthetic>
constructor $$anonfun$$1
method apply final
method apply final <bridge>
* trait T$$1 abstract
* method t
* value <local T>
* value t4202$$$$anonfun$$T$$$$$$outer <synthetic> <stable>
* trait T$$class$$1 abstract
* method $$init$$
* method t
* value <local T$$class>
value <local $$anonfun> |
@paulp said: -rw-r--r-- 1 paulp staff 309 Feb 6 01:08 t4202$$$$anonfun$$1$$T$$1.class
-rw-r--r-- 1 paulp staff 442 Feb 6 01:08 t4202$$$$anonfun$$1$$T$$class$$1.class
-rw-r--r-- 1 paulp staff 754 Feb 6 01:08 t4202$$$$anonfun$$1.class
-rw-r--r-- 1 paulp staff 407 Feb 6 01:08 t4202$$.class
-rw-r--r-- 1 paulp staff 435 Feb 6 01:08 t4202.class Drives me nuts trying to infer everything from the implementation. Is this documented somewhere? |
@adriaanm said: we don't officially deal in dollars anyway (at least not in user-supplied names) Paul, I'm sorry I can't provide more insight on the use of the dollar in generated names, but I think we can settle for a pragmatic solution here. Could the deeper problem simply be that calling this class val ANON_CLASS_NAME: NameType = "$$anon"
[...]
final def isAnonymousClass = isClass && (name containsName tpnme.ANON_CLASS_NAME) |
@retronym said: object t4202 {
() => {
trait T {
def t = ()
}
}
} |
@adriaanm said: In any case, it does not seem to be a REPL issue, based on Jason's latest comment. |
@hubertp said: |
@paulp said: object t4202 {
() => {
trait T {
def t = ()
}
object T2 extends T {
t
}
}
} |
@paulp said:
r8575 For whatever you may be able to make of that. |
@hubertp said:
Yeah, I used my svn skills to find that too, though the actual comment isn't very informative. Also I assumed that it might be no longer valid given that it was 6 years ago ;) |
=== What steps will reproduce the problem ===
=== What is the expected behavior? ===
Compiles okay, as per 2.8.1
=== What do you see instead? ===
=== Additional information ===
No crash after s/trait/class/.
I was actually trying to reproduce the following spurious compile error from the scalaz branch for Scala 2.9.x, from this tree: https://github.com/scalaz/scalaz/tree/3a58739500416eeda09d5150a2f3f7d1db2ad86e
I plan to isolate it further and lodge a separate ticket.
=== What versions of the following are you using? ===
The text was updated successfully, but these errors were encountered: