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

runtime reflection crashes when package object has eponymous method and module #9182

Closed
scabug opened this issue Feb 25, 2015 · 4 comments
Closed
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Feb 25, 2015

// Main.scala
package object ops {
  object A
  def A(a: Any) = ()
}

object Test {
  def main(args: Array[String]): Unit = {
    val pack = scala.reflect.runtime.currentMirror.staticModule("ops.package")
    println(pack.info.decls.toList.map(_.toString).sorted.mkString("\n"))
  }
}

Triggers:

java.lang.AssertionError: assertion failed: pkgClass = package ops, sym = method A, existing = object A (depth=0)
	at scala.reflect.runtime.SymbolLoaders$PackageScope.enter(SymbolLoaders.scala:110)
	at scala.reflect.internal.SymbolTable$$anonfun$openPackageModule$2.apply(SymbolTable.scala:297)
	at scala.reflect.internal.SymbolTable$$anonfun$openPackageModule$2.apply(SymbolTable.scala:295)
	at scala.collection.Iterator$class.foreach(Iterator.scala:750)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
	at scala.reflect.internal.SymbolTable.openPackageModule(SymbolTable.scala:295)
	at scala.reflect.internal.SymbolTable.openPackageModule(SymbolTable.scala:341)

Reported by [~lihaoyi] on https://groups.google.com/d/msg/scala-internals/fkqU-dD1be4/g68tbhh3dHQJ

@scabug
Copy link
Author

scabug commented Feb 25, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9182?orig=1
Reporter: @retronym
Affected Versions: 2.11.5
See #7940

@scabug
Copy link
Author

scabug commented Feb 25, 2015

@retronym said:
scala/scala#4361

@scabug
Copy link
Author

scabug commented Feb 25, 2015

@retronym said:
Workaround for [~lihaoyi]: rather than using an implicit class, define a class and implicit conversion manually (with a different name to the class).

@scabug
Copy link
Author

scabug commented Feb 25, 2015

@retronym said:
#7940 involves a similar code pattern, but seems distinct.

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

No branches or pull requests

2 participants