diff --git a/core/src/main/scala-3/caliban/schema/ArgBuilderDerivation.scala b/core/src/main/scala-3/caliban/schema/ArgBuilderDerivation.scala index b0d320d05e..d54329bb9b 100644 --- a/core/src/main/scala-3/caliban/schema/ArgBuilderDerivation.scala +++ b/core/src/main/scala-3/caliban/schema/ArgBuilderDerivation.scala @@ -12,7 +12,7 @@ import scala.deriving.Mirror import scala.util.NotGiven trait CommonArgBuilderDerivation { - inline def recurseSum[P, Label, A <: Tuple]( + transparent inline def recurseSum[P, Label <: Tuple, A <: Tuple]( inline values: List[(String, List[Any], ArgBuilder[Any])] = Nil ): List[(String, List[Any], ArgBuilder[Any])] = inline erasedValue[(Label, A)] match { @@ -36,7 +36,7 @@ trait CommonArgBuilderDerivation { } } - inline def recurseProduct[P, Label, A <: Tuple]( + transparent inline def recurseProduct[P, Label <: Tuple, A <: Tuple]( inline values: List[(String, ArgBuilder[Any])] = Nil ): List[(String, ArgBuilder[Any])] = inline erasedValue[(Label, A)] match { diff --git a/core/src/main/scala-3/caliban/schema/ObjectSchema.scala b/core/src/main/scala-3/caliban/schema/ObjectSchema.scala index 1b5169dab5..99b5092270 100644 --- a/core/src/main/scala-3/caliban/schema/ObjectSchema.scala +++ b/core/src/main/scala-3/caliban/schema/ObjectSchema.scala @@ -8,7 +8,7 @@ import scala.annotation.threadUnsafe import scala.reflect.ClassTag final private class ObjectSchema[R, A]( - _constructorFields: => List[(String, Schema[R, Any], Int)], + _constructorFields: => List[ProductFieldInfo[R]], _methodFields: => List[(String, List[Any], Schema[R, ?])], info: TypeInfo, anns: List[Any], @@ -19,7 +19,7 @@ final private class ObjectSchema[R, A]( @threadUnsafe private lazy val fields = { - val fromConstructor = _constructorFields.view.map { (label, schema, index) => + val fromConstructor = _constructorFields.view.map { case ProductFieldInfo(label, schema, index) => val fieldAnns = paramAnnotations.getOrElse(label, Nil) ((getName(fieldAnns, label), fieldAnns, schema), Left(index)) } diff --git a/core/src/main/scala-3/caliban/schema/ProductFieldInfo.scala b/core/src/main/scala-3/caliban/schema/ProductFieldInfo.scala new file mode 100644 index 0000000000..f4a57d1971 --- /dev/null +++ b/core/src/main/scala-3/caliban/schema/ProductFieldInfo.scala @@ -0,0 +1,7 @@ +package caliban.schema + +private final case class ProductFieldInfo[R]( + name: String, + schema: Schema[R, Any], + index: Int +) diff --git a/core/src/main/scala-3/caliban/schema/SchemaDerivation.scala b/core/src/main/scala-3/caliban/schema/SchemaDerivation.scala index 22151b070f..9d5fa55877 100644 --- a/core/src/main/scala-3/caliban/schema/SchemaDerivation.scala +++ b/core/src/main/scala-3/caliban/schema/SchemaDerivation.scala @@ -38,7 +38,7 @@ trait CommonSchemaDerivation { */ def config: DerivationConfig = DerivationConfig() - inline def recurseSum[R, P, Label, A <: Tuple]( + transparent inline def recurseSum[R, P, Label <: Tuple, A <: Tuple]( inline types: List[(String, __Type, List[Any])] = Nil, inline schemas: List[Schema[R, Any]] = Nil ): ( @@ -72,16 +72,16 @@ trait CommonSchemaDerivation { } - inline def recurseProduct[R, P, Label, A <: Tuple]( - inline values: List[(String, Schema[R, Any], Int)] = Nil - )(inline index: Int = 0): List[(String, Schema[R, Any], Int)] = + transparent inline def recurseProduct[R, P, Label <: Tuple, A <: Tuple]( + inline values: List[ProductFieldInfo[R]] = Nil + )(inline index: Int = 0): List[ProductFieldInfo[R]] = inline erasedValue[(Label, A)] match { case (_: EmptyTuple, _) => values.reverse case (_: (name *: names), _: (t *: ts)) => recurseProduct[R, P, names, ts] { inline if (Macros.isFieldExcluded[P, name]) values else - ( + ProductFieldInfo[R]( constValue[name].toString, summonInline[Schema[R, t]].asInstanceOf[Schema[R, Any]], index @@ -89,7 +89,7 @@ trait CommonSchemaDerivation { }(index + 1) } - inline def valueTypeSchema[R, Label, A <: Tuple]: Schema[R, Any] = + transparent inline def valueTypeSchema[R, Label <: Tuple, A <: Tuple]: Schema[R, Any] = inline erasedValue[(Label, A)] match { case (_: EmptyTuple, _) => error("GQLValueType case classes must have at least one field") case (_, _: (t *: _)) => summonInline[Schema[R, t]].asInstanceOf[Schema[R, Any]] diff --git a/core/src/main/scala-3/caliban/schema/macros/Macros.scala b/core/src/main/scala-3/caliban/schema/macros/Macros.scala index d6577e87fc..e5b5a06266 100644 --- a/core/src/main/scala-3/caliban/schema/macros/Macros.scala +++ b/core/src/main/scala-3/caliban/schema/macros/Macros.scala @@ -13,7 +13,8 @@ object Macros { inline def implicitExists[T]: Boolean = ${ implicitExistsImpl[T] } inline def hasAnnotation[T, Ann]: Boolean = ${ hasAnnotationImpl[T, Ann] } - inline def fieldsFromMethods[R, T]: List[(String, List[Any], Schema[R, ?])] = ${ fieldsFromMethodsImpl[R, T] } + transparent inline def fieldsFromMethods[R, T]: List[(String, List[Any], Schema[R, ?])] = + ${ fieldsFromMethodsImpl[R, T] } /** * Tests whether type argument [[FieldT]] in [[Parent]] is annotated with [[GQLExcluded]]