Skip to content

Conversation

@jchyb
Copy link
Contributor

@jchyb jchyb commented Jun 23, 2022

Part of an ongoing effort to migrate sangria to Scala 3.
This PR fixes an issue with A.asInstanceOf[A with B] (and operation on which the tagging mechanism is based on) throwing cast exceptions in Scala 3 if B was an empty sealed trait. This was replaced with and empty opaque type serving basically the same purpose. From a users perspective the API itself should not change. I discovered this issue when running code in the main sangria project, here in isolation that code is not run and therefore the problem does not appear.

Fixes an issue with A.asInstanceOf[A with B] throwing cast exceptions
in Scala 3 if B was an empty sealed trait. From a users perspective the
API should not change.
Copy link
Contributor

@yanns yanns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look good, thanks a lot!

@yanns
Copy link
Contributor

yanns commented Jun 25, 2022

A small issue with scalafmt:

[error] org.scalafmt.sbt.ScalafmtSbtReporter$ScalafmtSbtError: scalafmt: /home/runner/work/sangria-marshalling-api/sangria-marshalling-api/src/main/scala-3/sangria/util/tag.scala:7: error: [dialect scala213] ; expected but type found
[error]   opaque type Tagged[U] = Tag[U]
[error]          ^ [/home/runner/work/sangria-marshalling-api/sangria-marshalling-api/src/main/scala-3/sangria/util/tag.scala]
[error] (Compile / scalafmtCheck) org.scalafmt.sbt.ScalafmtSbtReporter$ScalafmtSbtError: scalafmt: /home/runner/work/sangria-marshalling-api/sangria-marshalling-api/src/main/scala-3/sangria/util/tag.scala:7: error: [dialect scala213] ; expected but type found
[error]   opaque type Tagged[U] = Tag[U]
[error]          ^ [/home/runner/work/sangria-marshalling-api/sangria-marshalling-api/src/main/scala-3/sangria/util/tag.scala]
[error] Total time: 5 s, completed Jun 25, 2022 5:38:18 PM

https://github.com/sangria-graphql/sangria-marshalling-api/runs/7055347676?check_suite_focus=true
Do you want to take care of it?

@jchyb
Copy link
Contributor Author

jchyb commented Jun 28, 2022

I've updated the scalafmt config and it seems to be ok now (sorry for the late response)

@yanns yanns merged commit aa7c68f into sangria-graphql:main Jun 28, 2022
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

Successfully merging this pull request may close these issues.

2 participants