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

zio-schema regression in kitlangton/neotype #17611

Closed
szymon-rd opened this issue May 29, 2023 · 2 comments
Closed

zio-schema regression in kitlangton/neotype #17611

szymon-rd opened this issue May 29, 2023 · 2 comments
Assignees
Labels
area:metaprogramming:quotes Issues related to quotes and splices itype:bug regression This worked in a previous version but doesn't anymore stat:needs minimization Needs a self contained minimization
Milestone

Comments

@szymon-rd
Copy link
Contributor

Compiler version

First fail in 3.3.1-RC1-bin-20230524-5262680-NIGHTLY, working before that

Minimized code

I tried minimizing the code, but the project structure must be influencing it somehow. Error is happening here. If the test is minimized to:

package neotype.zioschema

import neotype.{Newtype, Subtype}
import zio.*
import zio.schema.codec.DecodeError.ReadError
import zio.schema.codec.JsonCodec.JsonDecoder
import zio.schema.codec.JsonCodec.JsonEncoder.charSequenceToByteChunk
import zio.schema.codec.{DecodeError, JsonCodec}
import zio.schema.{DeriveSchema, Schema}
import zio.stream.ZStream
import zio.test.*
import zio.test.Assertion.*
import zio.json.{DeriveJsonEncoder, JsonEncoder}
import zio.json.*

import java.nio.CharBuffer
import java.nio.charset.StandardCharsets


final case class Person(name: String, age: Int, address: String)

object ZioSchemaSpec extends ZIOSpecDefault:
  def spec = suite("zioSchemaSpec")(
    suite("Person")(
      test("parse failure") {
        DeriveSchema.gen[Person]
      }
    )
  )

Then the suite is still failing. After extracting it to another scala-cli project, it stops failing.

Output

[error] -- Error: /workspaces/java/neotype/modules/neotype-zio-schema/src/test/scala/neotype/zioschema/ZioSchemaSpec.scala:26:24 
[error] 26 |        DeriveSchema.gen[Person]
[error]    |        ^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |Exception occurred while executing macro expansion.
[error]    |java.lang.AssertionError: assertion failed: privateWithin must be a type symbol or `Symbol.noSymbol`
[error]    |    at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error]    |    at scala.quoted.runtime.impl.QuotesImpl$reflect$Symbol$.newVal(QuotesImpl.scala:3094)
[error]    |    at scala.quoted.runtime.impl.QuotesImpl$reflect$Symbol$.newVal(QuotesImpl.scala:2547)
[error]    |    at zio.schema.DeriveSchema.deriveCaseClass(DeriveSchema.scala:153)
[error]    |    at zio.schema.DeriveSchema.deriveSchema(DeriveSchema.scala:94)
[error]    |    at zio.schema.DeriveSchema$.deriveSchema(DeriveSchema.scala:18)
[error]    |    at zio.schema.DeriveSchema$.inline$deriveSchema(DeriveSchema.scala:17)
[error]    |
[error]    |----------------------------------------------------------------------------
[error]    |Inline stack trace
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from DeriveSchema.scala:15
[error]     ----------------------------------------------------------------------------

Expectation

No failure, as before 3.3.1-RC1-bin-20230524-5262680-NIGHTLY

@szymon-rd szymon-rd added itype:bug regression This worked in a previous version but doesn't anymore area:metaprogramming:quotes Issues related to quotes and splices labels May 29, 2023
@szymon-rd szymon-rd added this to the 3.3.1 milestone May 29, 2023
@szymon-rd szymon-rd added the stat:needs minimization Needs a self contained minimization label May 29, 2023
@jchyb
Copy link
Contributor

jchyb commented May 30, 2023

scala-cli minimization (with dependencies):

//> using lib "dev.zio::zio-schema-json::0.4.11"
//> using scala "3.3.1-RC1-bin-20230524-5262680-NIGHTLY"
//> using option "-Xcheck-macros"

import zio.schema.DeriveSchema

final case class Person(age: Int)
def main = DeriveSchema.gen[`Person]

-Xcheck-macros seems to be causing problems here.

@KacperFKorban
Copy link
Member

It's an intended change from #17352 and changed to only be checked under -Xcheck-macros in #17437
It also has been fixed in zio-schema: zio/zio-schema#555 (no release yet though)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metaprogramming:quotes Issues related to quotes and splices itype:bug regression This worked in a previous version but doesn't anymore stat:needs minimization Needs a self contained minimization
Projects
None yet
Development

No branches or pull requests

3 participants