Last active
August 29, 2015 14:05
-
-
Save Klasu/100922f1204d003a03ba to your computer and use it in GitHub Desktop.
Scala 2.10 compiler crashes on the following code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.specs2.mutable.Specification | |
case class A(id: Int, created: String) | |
case class B(id: Int, aId: Int) | |
case class C(id: Int, created: String) | |
object ACreator { | |
val a = A( | |
id = 1, | |
created = "A" | |
) | |
} | |
object BCreator { | |
val b = B( | |
id = 1, | |
aId = 2 | |
) | |
} | |
object CObject extends Specification { | |
def create(bId: Int, c: C) = {c} | |
} | |
class AFailure extends Specification { | |
val testC = C(id = 1, created = "C") | |
"A" should { | |
"fail" in { | |
val createdA = ACreator.a.copy(id = 2) // Giving this a type fixes the crash | |
val createdB = BCreator.b.copy(aId = createdA.id) | |
val created = CObject.create(createdB.id, testC) // Renaming the val created fixes the crash | |
created.id == 1 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Scala 2.11 this is fixed.