Skip to content
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

circe json string interpolator does not work when invoiced directly via a wrapper class #770

Open
hoshikon opened this issue Jan 8, 2025 · 0 comments

Comments

@hoshikon
Copy link

hoshikon commented Jan 8, 2025

This does not compile:

test("This does not compile") {
    import io.circe.Json
    import io.circe.literal.json
    case class Wrapper(json: Json)

    expect(Wrapper(json"{}").json == Json.obj())
}

error:

[error] 670 |    expect(Wrapper(json"{}").json == Json.obj())
[error]     |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |    Found:    (String, io.circe.Json)*
[error]     |    Required: (String, io.circe.Json)
[error]     |---------------------------------------------------------------------------
[error]     |Inline stack trace
[error]     |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]     |This location contains code that was inlined from JsonLiteralMacros.scala:91
[error]      ---------------------------------------------------------------------------
[error]     |
[error]     | longer explanation available when compiling with `-explain`

Whereas this does:

test("blah".only) {
    import io.circe.Json
    import io.circe.literal.json
    case class Wrapper(json: Json)

    val wrapper = Wrapper(json"{}")
    expect(wrapper.json == Json.obj())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant