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

Compile error on Scala 3.5.0 #660

Closed
jqno opened this issue Aug 22, 2024 · 8 comments
Closed

Compile error on Scala 3.5.0 #660

jqno opened this issue Aug 22, 2024 · 8 comments

Comments

@jqno
Copy link

jqno commented Aug 22, 2024

I'm upgrading our project from Scala 3.4.3 to Scala 3.5.0, and I get this new error message:

[error] -- Error: /home/jqno/path/to/my/project/xsd/converters/target/scala-3.5.0/src_managed/main/sbt-scalaxb/scalaxb/scalaxb.scala:727:32
 
[error] 727 |    opt(text ^^ (x => DataRecord(x.node.text)(format)))
[error]     |                      ^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Context bounds will map to context parameters.
[error]     |A `using` clause is needed to pass explicit arguments to them.
[error]     |This code can be rewritten automatically under -rewrite -source 3.4-migration.
[error] one error found

I tried doing what the compiler suggested and added -rewrite -source 3.4-migration to the scalacOptions in our build.sbt. That changed this line:

    opt(text ^^ (x => DataRecord(x.node.text)(format)))

into this one:

    opt(text ^^ (x => DataRecord(x.node.text)(using format)))

Along with some other Scala 3-specific rewrites. I was considering offering a PR with the rewrites to fix this issue, but since these changes break compatibility with Scala 2, I see that that's not an option.

Apart from leaving the -rewrite flag in our build.sbt, is there a workaround or fix for this that we can apply, so that we can upgrade to Scala 3.5?

@eed3si9n
Copy link
Owner

Thanks for the report! I guess we can try not passing in implicit parameters explicitly, or have some flag that emits using?

@jqno
Copy link
Author

jqno commented Aug 24, 2024

Both options sound good. I don't know which one is more appropriate for scalaxb though?

@eed3si9n
Copy link
Owner

Try not passing it first, and if not a flag?

@eed3si9n
Copy link
Owner

eed3si9n commented Aug 24, 2024

By the way, do you have a schema publicly that I can reproduce this error?

The bug was in scalaxb.scala runtime.

@eed3si9n
Copy link
Owner

Oops. This has been fixed in #654. I just have to release it.

@eed3si9n
Copy link
Owner

Here's a PR to get Scala 3.5.0 compiling with -Xfatal-warnings - #661

@eed3si9n
Copy link
Owner

@jqno
Copy link
Author

jqno commented Aug 25, 2024

Awesome, thank you!

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

2 participants