Closed scabug closed 9 years ago
Imported From: https://issues.scala-lang.org/browse/SI-8900?orig=1 Reporter: Tony Sloane (asloane) Affected Versions: 2.11.3 Attachments:
Tony Sloane (asloane) said: Forgot to say explicitly that the relevant version is the latest in this repo:
hg clone https://code.google.com/p/kiama/
The log mentions org.kiama.example.lambda2.LambdaTree
so I presume the crash is triggered there somewhere, but I haven't narrowed it down yet.
Tony Sloane (asloane) said: The relevant commit seems to be
https://github.com/scala/scala/commit/63207e115a46634d47446a87a7f4bc3c2651b0e7
@retronym said:
@lrytz We're getting a false positive from isDelambdafyFunction
. The symbol name in question is LambdaTests$$anonfun$org$kiama$example$lambda2$LambdaTests$$canons$1$1
. I don't have a smaller reproduction yet.
@gkossakowski said: Tony, can this issue be reproduced with released version of Kiama?
@Sciss said: Are the labels correct? It says affects 2.10.3 / fixed 2.10.4. Should it be 2.11.3?
@lrytz said:
Hi @retronym, [~asloane]. The failing file is library/src/org/kiama/example/lambda2/LambdaTests.scala
. As a reduced version, replace the content of the file by the follwing, it triggers the same error.
package org.kiama
package example.lambda2
import org.kiama.util.RegexParserTests
import scala.language.experimental.macros
class LambdaTests {
import org.kiama.rewriting.Strategy
def rule[T] (f : PartialFunction[T, T]) : Strategy = ???
case class Var(x: Int)
def canon = {
def canons: Strategy = rule[Var] { case Var (n) => Var (n) } + canons
}
}
The fishy thing is that Strategy.+
is a macro, and I could not reproduce the failure without the macro call. So it's possible that the assertion doesn't fail on compiler-generated code.
However, the implementation of isDelambdafyFunction
(as well as isAnonymousFunction
) is not robust at all against false positives:
final def isAnonymousFunction = isSynthetic && (name containsName tpnme.ANON_FUN_NAME)
final def isDelambdafyFunction = isSynthetic && (name containsName tpnme.DELAMBDAFY_LAMBDA_CLASS_NAME)
So an assert(!sym.isDelambdafyFunction)
is unsafe. I think for now we should just remove the assertion, longer term there should be a better implementation of the above.
@lrytz said: https://github.com/scala/scala/pull/4049
Tony Sloane (asloane) said: Grzegorz: yes, the same problem occurs with Kiama 1.7.0 which is the most recent release.
@gkossakowski said: Tony, would you be interested in adding Kiama 1.7.0 to the community build that we use to test Scala compiler? Given that you guys found a regression that none of 77 projects that are already there caught, it would be great to welcome you to the family!
Tony Sloane (asloane) said: Grzegorz, yes, no objections from me if you want to include Kiama in the community build. Is there anything I need to do?
@gkossakowski said: Tony, I was wondering if you could help with adding Kiama to community build. Adding a project to community build very often requires understanding of project's build so it's best done by project maintainers. Also, we are trying to spread the effort amongst community members so we can Scale the whole process to 100+ projects.
@sjrd said: This is also hit in Scala.js (see https://github.com/scala-js/scala-js/issues/1147).
In the case of Scala.js, I can tell you that it's not generated by a macro, because there's no macro in the Scala.js repository. The failing project is the test suite, which is not compiled with -Ydelambdafy:method
. There is however, on the classpath of that compilation, another project which is compiled with -Ydelambdafy:method
(the test-bridge).
Tony Sloane (asloane) said: Grzegorz, ok, I'll look into adding Kiama to the community build. Shouldn't be a problem.
Tony Sloane (asloane) said: Grzegorz, on the community build question, it appears that only git and svn are supported by dbuild at the moment. This limits what I can do since Kiama is in a Mercurial repository. I've added a ticket over at the dbuild tracker to flag this issue:
@gkossakowski said (edited on Oct 20, 2014 12:50:21 PM UTC): Oh, it's a bummer we can't add Kiama to community build right away! Thanks for opening an issue against dbuild so we have that limitation documented. I hope dbuild can learn how to read Mercurial repos at some point.
Here's link to PR that fixes the original issue reported in this ticket: https://github.com/scala/scala/pull/4049
When using the 2.11.3 version that is currently on Maven Central or the most recent SNAPSHOT, I get an assertion failure when compiling the latest development version of our Kiama library. The build log is in the attached file, but the stack trace starts: