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

Usage of macrame crashes Presentation compiler in Scala IDE #73

Open
kiritsuku opened this issue Oct 23, 2015 · 4 comments
Open

Usage of macrame crashes Presentation compiler in Scala IDE #73

kiritsuku opened this issue Oct 23, 2015 · 4 comments
Labels

Comments

@kiritsuku
Copy link

I have the following piece of code:

import macrame.enum

object Test {
  import Color._

  def method(c: Color) = {
  }
  method(Red)
}
@enum class Color {
  Red
  Blue
  Yellow
}

And the following build.sbt, which depends on macrame:

name := "paradise-test"
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(
   "com.chrisneveu" %% "macrame" % "1.0.1",
   compilerPlugin("org.scalamacros" % "paradise" % "2.1.0-M5" cross CrossVersion.full))

If I introduce a compilation error in Test or try to trigger code completion (actually I think it doesn't matter what is done as long as the PC in involved) it often (but not always) happens that the PC crashes. There are error messages shown like the following:

2015-10-23 11:20:23,673 ERROR [main] - org.scala-ide.sdt.core - org.scala-ide.sdt.core - org.scala-ide.sdt.core - 0 - Throwable during asyncExec
java.lang.AssertionError: assertion failed: module Color#17793 with TypeRef
    at scala.tools.nsc.Global.assert(Global.scala:261)
    at org.scalamacros.paradise.reflect.StdAttachments$class.backupCompleter(StdAttachments.scala:17)
    at org.scalamacros.paradise.Plugin.backupCompleter(Plugin.scala:8)
    at org.scalamacros.paradise.typechecker.Namers$Namer$class.finishSymbolMaybeExpandeeCompanion(Namers.scala:407)
    at org.scalamacros.paradise.typechecker.Namers$$anon$3.finishSymbolMaybeExpandeeCompanion(Namers.scala:13)
    at org.scalamacros.paradise.typechecker.Namers$Namer$class.finishSymbol(Namers.scala:199)
    at org.scalamacros.paradise.typechecker.Namers$$anon$3.finishSymbol(Namers.scala:13)
    at org.scalamacros.paradise.typechecker.Namers$Namer$class.dispatch$1(Namers.scala:34)
    at org.scalamacros.paradise.typechecker.Namers$Namer$class.enterSym(Namers.scala:40)
    at org.scalamacros.paradise.typechecker.Namers$$anon$3.enterSym(Namers.scala:13)
    at org.scalamacros.paradise.typechecker.AnalyzerPlugins$MacroPlugin$.pluginsEnterSym(AnalyzerPlugins.scala:36)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$13.custom(AnalyzerPlugins.scala:429)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$2.apply(AnalyzerPlugins.scala:371)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$2.apply(AnalyzerPlugins.scala:371)
    at scala.collection.immutable.List.map(List.scala:273)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.invoke(AnalyzerPlugins.scala:371)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.pluginsEnterSym(AnalyzerPlugins.scala:423)
    at org.scalaide.core.internal.compiler.ScalaPresentationCompiler$$anon$1.pluginsEnterSym(ScalaPresentationCompiler.scala:76)
    at scala.tools.nsc.typechecker.Namers$Namer.enterSym(Namers.scala:275)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$enterSyms$1.apply(Namers.scala:501)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$enterSyms$1.apply(Namers.scala:500)
    at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:124)
    at scala.collection.immutable.List.foldLeft(List.scala:84)
    at scala.tools.nsc.typechecker.Namers$Namer.enterSyms(Namers.scala:500)
    at org.scalamacros.paradise.typechecker.Namers$Namer$$anonfun$finishSymbolNotExpandee$1.apply(Namers.scala:220)
    at org.scalamacros.paradise.typechecker.Namers$Namer$class.savingLock$1(Namers.scala:214)
    at org.scalamacros.paradise.typechecker.Namers$Namer$class.finishSymbolNotExpandee(Namers.scala:218)
    at org.scalamacros.paradise.typechecker.Namers$$anon$3.finishSymbolNotExpandee(Namers.scala:13)
    at org.scalamacros.paradise.typechecker.Namers$Namer$class.finishSymbol(Namers.scala:182)
    at org.scalamacros.paradise.typechecker.Namers$$anon$3.finishSymbol(Namers.scala:13)
    at org.scalamacros.paradise.typechecker.Namers$Namer$class.dispatch$1(Namers.scala:34)
    at org.scalamacros.paradise.typechecker.Namers$Namer$class.enterSym(Namers.scala:40)
    at org.scalamacros.paradise.typechecker.Namers$$anon$3.enterSym(Namers.scala:13)
    at org.scalamacros.paradise.typechecker.AnalyzerPlugins$MacroPlugin$.pluginsEnterSym(AnalyzerPlugins.scala:36)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$13.custom(AnalyzerPlugins.scala:429)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$2.apply(AnalyzerPlugins.scala:371)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$2.apply(AnalyzerPlugins.scala:371)
    at scala.collection.immutable.List.map(List.scala:273)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.invoke(AnalyzerPlugins.scala:371)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.pluginsEnterSym(AnalyzerPlugins.scala:423)
    at org.scalaide.core.internal.compiler.ScalaPresentationCompiler$$anon$1.pluginsEnterSym(ScalaPresentationCompiler.scala:76)
    at scala.tools.nsc.typechecker.Namers$Namer.enterSym(Namers.scala:275)
    at scala.tools.nsc.typechecker.Analyzer$namerFactory$$anon$1.apply(Analyzer.scala:43)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:440)
    at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:431)
    at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:440)
    at scala.tools.nsc.Global$Run$$anonfun$compileLate$2$$anonfun$apply$1.apply(Global.scala:1609)
    at scala.tools.nsc.Global$Run$$anonfun$compileLate$2$$anonfun$apply$1.apply(Global.scala:1609)
    at scala.reflect.internal.SymbolTable.enteringPhase(SymbolTable.scala:235)
    at scala.tools.nsc.Global$Run$$anonfun$compileLate$2.apply(Global.scala:1609)
    at scala.tools.nsc.Global$Run$$anonfun$compileLate$2.apply(Global.scala:1608)
    at scala.collection.Iterator$class.foreach(Iterator.scala:742)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1194)
    at scala.tools.nsc.Global$Run.compileLate(Global.scala:1608)
    at scala.tools.nsc.interactive.Global.scala$tools$nsc$interactive$Global$$parseAndEnter(Global.scala:656)
    at scala.tools.nsc.interactive.Global$$anonfun$scala$tools$nsc$interactive$Global$$getParsedEnteredNow$1$$anonfun$apply$23.apply(Global.scala:1198)
    at scala.tools.nsc.interactive.Global$$anonfun$scala$tools$nsc$interactive$Global$$getParsedEnteredNow$1$$anonfun$apply$23.apply(Global.scala:1197)
    at scala.tools.nsc.interactive.CompilerControl$class.onUnitOf(CompilerControl.scala:63)
    at scala.tools.nsc.interactive.Global.onUnitOf(Global.scala:104)
    at scala.tools.nsc.interactive.Global$$anonfun$scala$tools$nsc$interactive$Global$$getParsedEnteredNow$1.apply(Global.scala:1197)
    at scala.tools.nsc.interactive.Global$$anonfun$scala$tools$nsc$interactive$Global$$getParsedEnteredNow$1.apply(Global.scala:1197)
    at scala.tools.nsc.interactive.Global$$anonfun$respond$1.apply(Global.scala:699)
    at scala.tools.nsc.interactive.Global$$anonfun$respond$1.apply(Global.scala:699)
    at scala.tools.nsc.interactive.Global.respondGradually(Global.scala:706)
    at scala.tools.nsc.interactive.Global.respond(Global.scala:699)
    at scala.tools.nsc.interactive.Global.scala$tools$nsc$interactive$Global$$getParsedEnteredNow(Global.scala:1196)
    at scala.tools.nsc.interactive.Global.getParsedEntered(Global.scala:1187)
    at scala.tools.nsc.interactive.CompilerControl$AskParsedEnteredItem.apply$mcV$sp(CompilerControl.scala:392)
    at scala.tools.nsc.interactive.Global$$anonfun$pollForWork$1.apply$mcV$sp(Global.scala:504)
    at scala.util.control.Breaks.breakable(Breaks.scala:38)
    at scala.tools.nsc.interactive.Global.pollForWork(Global.scala:429)
    at scala.tools.nsc.interactive.PresentationCompilerThread.run(PresentationCompilerThread.scala:22)
@xeno-by
Copy link
Member

xeno-by commented Oct 26, 2015

Hi! Thanks for the report - I'll try to take a look this week. Maybe you have any idea what's going on?

@kiritsuku
Copy link
Author

On 10/26/2015 11:09 AM, Eugene Burmako wrote:

Maybe you have any idea what's going on?

No, not at all. The typechecker is a complete mystery to me. Maybe
@dragos has an idea where this problem is coming from. Since the
exception comes from paradise I assume the IDE or the PC in general
lacks some special initialization, which happens in the normal compiler.

@dragos
Copy link

dragos commented Oct 26, 2015

Since macros can do anything, there's nothing to learn from normal execution of the typer w.r.t. why this failed :)

@xeno-by
Copy link
Member

xeno-by commented Oct 26, 2015

Here it's not macros per se, it's the macro annotation engine interacting in bad ways with the presentation compiler. It seems that I've missed some of the invariants that aren't held when we move from the batch compiler to the interactive one.

SethTisue pushed a commit to scalacommunitybuild/paradise that referenced this issue Nov 21, 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

3 participants