-
Notifications
You must be signed in to change notification settings - Fork 39
Cannot auto-extract case class #228
Comments
It's interesting that when copy/pasting this into the REPL I get:
|
Note that the following works fine:
|
I've noticed that if I change the test to this, it compiles: package com.test
import org.scalatest.{FlatSpec, ShouldMatchers}
import rapture.json._
import rapture.json.jsonBackends.spray._
class RaptureTest extends FlatSpec with ShouldMatchers {
case class CC(s: String, t: String)
"Case class" should "be extracted from JSON" in {
val json = json"""{"s":"abc","t":"def"}"""
val cc = json.as[CC]
cc shouldBe CC("abc", "def")
}
} My best guess is that there's a macro in ScalaTest (I'm not overly familiar with it), and it's getting confused in some way. Does that help you at all? |
Actually, I extracted the issue into a case so I could share with you. This is happening in our codebase, basically the same thing with some actual business logic around. I worked around it defining a custom CC JSON extractor, however I'll investigate further this week. |
Thanks for spending the time on it. I seem to remember I saw something similar a while ago (and was able to fix it in the same way), though I was never able to reduce it to such a small test case. As with your example, it worked fine copy/pasting into the REPL... Let me know if you'd like me to schedule some time to investigate it further. If it's the same issue I was having, I'd really like to get to the bottom of it... |
Environment:
This fails with
We've spent the whole afternoon on this, not sure where the problem lays.
The text was updated successfully, but these errors were encountered: