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

Previously compiled package object on classpath crashes scalac #8134

Closed
scabug opened this issue Jan 9, 2014 · 5 comments
Closed

Previously compiled package object on classpath crashes scalac #8134

scabug opened this issue Jan 9, 2014 · 5 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Jan 9, 2014

This one is also in 2.10, not a regression. The code is essentially the same as the code in #8133, except instead of an implicit class I have a non-implicit class and an implicit conversion, and combined into one file because it no longer depends on separate compilation (but it still depends on AnyOps extending AnyVal.)

// a.scala
package object pkg {
  class AnyOps(val x: Any) extends AnyVal { def to_s: String = "" + x }
  implicit def mkAnyOps(x: Any): AnyOps = new AnyOps(x)
}
package pkg {
  package object other { }
  package other { class Crash { def f() = List(1) map (_.to_s) } }
}

Outcome of successive compilations:

% scalac3 a.scala && scalac3 a.scala
error: EmptyScope.enter
error: scala.reflect.internal.FatalError:
  EmptyScope.enter
     while compiling: a.scala
        during phase: extmethods
     library version: version 2.11.0-20140109-065029-992050a619
    compiler version: version 2.11.0-20140109-065029-992050a619
  reconstructed args:

  last tree to typer: Ident(x)
       tree position: line 2 of a.scala
            tree tpe: Boolean
              symbol: value x
   symbol definition: x: Boolean (a TermSymbol)
      symbol package: <none>
       symbol owners: value x
           call site: constructor AnyOps in class AnyOps in package pkg

== Source file context for tree position ==

     0 package object pkg {
     1   class AnyOps(val x: Any) extends AnyVal { def to_s: String = "" + x }
     2   implicit def mkAnyOps(x: Any): AnyOps = new AnyOps(x)
     3 }
     4 package pkg {
     5   package object other { }
     6   package other { class Crash { def f() = List(1) map (_.to_s) } }
	at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:56)
	at scala.tools.nsc.Global.abort(Global.scala:263)
	at scala.reflect.internal.Scopes$EmptyScope$.enterEntry(Scopes.scala:460)
	at scala.reflect.internal.Scopes$Scope.enter(Scopes.scala:131)
	at scala.tools.nsc.transform.ExtensionMethods$Extender.makeExtensionMethodSymbol$1(ExtensionMethods.scala:215)
	at scala.tools.nsc.transform.ExtensionMethods$Extender.transform(ExtensionMethods.scala:218)
	at scala.tools.nsc.transform.ExtensionMethods$Extender.transform(ExtensionMethods.scala:125)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2666)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2664)
@scabug
Copy link
Author

scabug commented Jan 9, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8134?orig=1
Reporter: @paulp
Affected Versions: 2.11.0-M7
See #5954

@scabug
Copy link
Author

scabug commented Jan 15, 2014

@retronym said:
Same crash with:

package object pkg {
  class AnyOps(val x: Any) extends AnyVal
}
% rm -rf pkg/; for i in 1 2; do qbin/scalac sandbox/t8134.scala; done
...
	at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:56)
	at scala.tools.nsc.Global.abort(Global.scala:263)
	at scala.reflect.internal.Scopes$EmptyScope$.enterEntry(Scopes.scala:460)
	at scala.reflect.internal.Scopes$Scope.enter(Scopes.scala:131)
	at scala.tools.nsc.transform.ExtensionMethods$Extender.makeExtensionMethodSymbol$1(ExtensionMethods.scala:215)

@scabug
Copy link
Author

scabug commented Jan 15, 2014

@retronym said:
Related to, or maybe a dupe, of #5954

@scabug
Copy link
Author

scabug commented Jan 15, 2014

@scabug
Copy link
Author

scabug commented Jan 20, 2014

@retronym said:
scala/scala#3389

@scabug scabug closed this as completed Feb 13, 2014
@scabug scabug added the has PR label Apr 7, 2017
@scabug scabug added this to the 2.11.0-RC1 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants