ghostdogpr / caliban

Functional GraphQL library for Scala
https://ghostdogpr.github.io/caliban/
Apache License 2.0
947 stars 248 forks source link

Update Scala 3 to 3.3.4 #2422

Closed kyri-petrou closed 1 month ago

kyri-petrou commented 1 month ago

In Scala 3.3.4, a warning is raised when we create a new anonymous class within an inline method. In the cases of Schema.Auto and ArgBuilder.Auto we can't do much about it since the automatic derivation only works by creating a new anonymous class so we just suppress the warning. In the case of SubscriptionSchema though we can fix it by creating a final class and then creating new instances of it.

Note that we could also do this, but since SubscriptionSchemas are not that common, I think it's better to just keep the code cleaner:

inline def derived[A]: SubscriptionSchema[A] =
  inline summonInline[Mirror.ProductOf[A]] match {
    case m: Mirror.ProductOf[A] =>
      checkParams[m.MirroredElemTypes]
      ProductSubscriptionSchema.asInstanceOf[SubscriptionSchema[A]]
  }

private object ProductSubscriptionSchema extends SubscriptionSchema[?]