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
assertion failed: List(value c$1, value c$1) #65
Comments
This error looks really similar to owner chain corruption issues that can sometimes happen in def macros. Are you using any def macros in your project? |
I'm only using one macro annotation which uses lots of quasiquotes to pattern match and generate code. I think the biggest architectural difference to my previous version is that I introduced objects inside the macro which contain methods using the Tree type. Could that be the issue? The objects are inside as I don't know yet how to use the Tree type outside the macro. |
It looks like this crash is caused by the macro paradise compiler plugin. In the plugin, I've patched the naming/typing infrastructure to accommodate macro annotations, and as a side-effect that fixed SI-3772. Or I thought that it fixed it, because as your example shows that the fix sometimes crashes the backend. If you try to compile your code without the macro paradise plugin enabled, you'll get a bunch of compilation errors along the following lines:
The solution would be to avoid writing explicit companions below case classes. Just moving the definitions above should be enough. Macro paradise makes the compilation error very mysterious, so it's definitely a bug on my side, so I'll keep it open for now. |
I disabled the compiler plugin and fixed all the errors: But even now the compiler crashes with the same error. Thanks for helping out! |
Hmm, looks like this is a Scala backend bug (or, maybe, an issue with how quasiquotes are implemented, but that's less likely). Could you minimize the test file to something smaller that still exhibits the problem, and then we could submit the issue ot JIRA? |
Sure, I will do that. |
I was able to boil it down to a simple example: import scala.language.experimental.macros
import scala.reflect.macros.whitebox
object Macro {
def macroImpl(c: whitebox.Context)(annottees: c.Expr[Any]*): c.Expr[Any] = {
import c.universe._
trait A {
def a_term = TermName("a")
}
trait B {
def b_term = TermName("b")
}
case class C() extends A with B
c.Expr[Any](q" object X ")
}
} sbt project: https://github.com/renesca/renesca-magic/tree/70ecadc90a55c9ad797662a82ef5fafdc540ff07 |
Here's an even smaller reproduction:
|
Submitted to https://issues.scala-lang.org/browse/SI-9284 |
Hi, I'm getting an assertion when compiling this project:
https://github.com/renesca/renesca-magic/tree/b064d5ab59c534dd485e950559394649afa4212a
Do you have any Idea where this error comes from? Macros? Scala compiler?
Thank you!
The text was updated successfully, but these errors were encountered: