Closed scabug closed 10 years ago
Imported From: https://issues.scala-lang.org/browse/SI-8809?orig=1 Reporter: Markus Stoy (mstoy) Affected Versions: 2.10.4, 2.11.2 Attachments:
@retronym said: This looks like a bug in Scalatest's assert macro.
/cc [~cheeseng]
Here's a minimal reproduction:
% tail build.sbt test.scala
==> build.sbt <==
scalaVersion := "2.11.2"
libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.1"
==> test.scala <==
import org.scalatest._
class PossibleScalacBug {
import DiagrammedAssertions._
assert(new Object() == "")
}
% sbt compile
[info] Loading global plugins from /Users/jason/.sbt/0.13/plugins
[info] Loading project definition from /Users/jason/code/scratch3/project
[info] Set current project to scratch3 (in build file:/Users/jason/code/scratch3/)
[info] Compiling 1 Scala source to /Users/jason/code/scratch3/target/scala-2.11/classes...
[error]
[error] Unexpected New(TypeTree(class Object)/Object) received in icode.
[error] Call was genLoad(new Object,package <empty> { class PossibleScalacBug { def PossibleScalacBug.<init> { bb=1 } } },REF(class Object))
[error] while compiling: /Users/jason/code/scratch3/test.scala
[error] during phase: icode
...
Chua Chee Seng (cheeseng) said: Thanks Jason, I'll take a look.
Chua Chee Seng (cheeseng) said: fyi, I submitted a pull request to fix in ScalaTest:
https://github.com/scalatest/scalatest/pull/371
Hopefully it will be pulled and and be included in 2.2.3 release.
Thanks for letting use know the problem!
@bvenners said: Markus,
I made a 2.2.3-SNAP1 release with the fix for this. Can you try it and verify it works for you?
Thanks.
https://oss.sonatype.org/content/groups/public/org/scalatest/scalatest_2.11/2.2.3-SNAP1/
Bill
Markus Stoy (mstoy) said: Ah, the joy of macros... (had no idea what was going on, therefore posted it here). Thanks everyone for the very quick feedback on this, the 2.2.3-SNAP1 release works as expected.
Trying to compile the following code using scala2.11.2 and scalatest-2.2.1 gives me the attached error stacktrace. (Same behaviour in scala-2.10.4 and scalatest-2.2.0). Everything works as expected after either