Skip to content

Commit 72d368f

Browse files
authored
Merge branch 'main' into update/scala-library-2.13.16
2 parents 88207f7 + fac4826 commit 72d368f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2330
-2214
lines changed

Diff for: .git-blame-ignore-revs

+6
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ ff6150276488d99b50b99f850885927e8da91b9d
99

1010
# Scala Steward: Reformat with scalafmt 3.8.3
1111
e4af65308dbd509e021f2b50c31d6bc5fda41d4a
12+
13+
# Scala Steward: Reformat with scalafmt 3.8.5
14+
d9458f6a8812d77c07b3ef275c3dfaff3390d4a0
15+
16+
# Scala Steward: Reformat with scalafmt 3.9.3
17+
07a8dced3008b511567637a1a11c6833e50c0f82

Diff for: .scalafmt.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = 3.8.3
1+
version = 3.9.3
22

33
runner.dialect = scala213
44

Diff for: modules/ast/src/main/scala/sangria/ast/QueryAst.scala

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ case class Document(
1919
with WithTrailingComments {
2020

2121
/** Map of operation name to its definition. */
22-
lazy val operations: Map[Option[String], OperationDefinition] = Map(definitions.collect {
23-
case op: OperationDefinition =>
22+
lazy val operations: Map[Option[String], OperationDefinition] = Map(
23+
definitions.collect { case op: OperationDefinition =>
2424
op.name -> op
25-
}: _*)
25+
}: _*)
2626

2727
/** Map of fragment name to its definition. */
28-
lazy val fragments: Map[String, FragmentDefinition] = Map(definitions.collect {
29-
case fragment: FragmentDefinition =>
28+
lazy val fragments: Map[String, FragmentDefinition] = Map(
29+
definitions.collect { case fragment: FragmentDefinition =>
3030
fragment.name -> fragment
31-
}: _*)
31+
}: _*)
3232

3333
lazy val source: Option[String] = sourceMapper.map(_.source)
3434

Diff for: modules/core/src/main/scala/sangria/execution/FutureResolver.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private[execution] class FutureResolver[Ctx](
143143
.asInstanceOf[scheme.Result[Ctx, marshaller.Node]]
144144

145145
case es: ExecutionScheme.StreamBasedExecutionScheme[
146-
({ type X[_] })#X @unchecked] @unchecked =>
146+
({ type X [_] })#X @unchecked] @unchecked =>
147147
val (_, res) = resolveSubs(
148148
ExecutionPath.empty,
149149
tpe,

Diff for: modules/core/src/main/scala/sangria/execution/ValueCollector.scala

+3-4
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,9 @@ object ValueCollector {
223223
}
224224

225225
case class VariableValue(
226-
fn: (
227-
ResultMarshaller,
228-
ResultMarshaller,
229-
InputType[_]) => Either[Vector[Violation], Trinary[ResultMarshaller#Node]]) {
226+
fn: (ResultMarshaller, ResultMarshaller, InputType[_]) => Either[
227+
Vector[Violation],
228+
Trinary[ResultMarshaller#Node]]) {
230229
private val cache =
231230
Cache.empty[(Int, Int), Either[Vector[Violation], Trinary[ResultMarshaller#Node]]]
232231

Diff for: modules/core/src/main/scala/sangria/introspection/package.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,8 @@ package object introspection {
465465
name = "__schema",
466466
fieldType = __Schema,
467467
description = Some("Access the current type schema of this server."),
468-
resolve = _.schema.asInstanceOf[Schema[Any, Any]])
468+
resolve = _.schema.asInstanceOf[Schema[Any, Any]]
469+
)
469470

470471
val TypeMetaField: Field[Unit, Unit] = Field(
471472
name = "__type",

Diff for: modules/core/src/main/scala/sangria/schema/AstSchemaMaterializer.scala

+18-18
Original file line numberDiff line numberDiff line change
@@ -434,18 +434,18 @@ class AstSchemaMaterializer[Ctx] private (
434434
var iteration = 0
435435

436436
while ({
437-
prevCount = typeDefCache.size
438-
iteration += 1
437+
prevCount = typeDefCache.size
438+
iteration += 1
439439

440-
typeDefCache.forEachValue {
441-
case o: ObjectLikeType[_, _] => o.fields
442-
case o: InputObjectType[_] => o.fields
443-
case _ => // do nothing
444-
}
440+
typeDefCache.forEachValue {
441+
case o: ObjectLikeType[_, _] => o.fields
442+
case o: InputObjectType[_] => o.fields
443+
case _ => // do nothing
444+
}
445445

446-
newCount = typeDefCache.size
447-
prevCount != newCount && iteration < 20
448-
}) ()
446+
newCount = typeDefCache.size
447+
prevCount != newCount && iteration < 20
448+
}) ()
449449
}
450450

451451
def getTypeFromExistingType(origin: MatOrigin, tpe: OutputType[_]): OutputType[Any] = tpe match {
@@ -476,8 +476,8 @@ class AstSchemaMaterializer[Ctx] private (
476476
origin = origin,
477477
definition = directive,
478478
arguments =
479-
directive.arguments.flatMap(buildArgument(origin, Left(directive), None, _)) toList,
480-
locations = directive.locations.map(buildDirectiveLocation) toSet,
479+
directive.arguments.flatMap(buildArgument(origin, Left(directive), None, _)).toList,
480+
locations = directive.locations.map(buildDirectiveLocation).toSet,
481481
mat = this
482482
))
483483

@@ -659,7 +659,7 @@ class AstSchemaMaterializer[Ctx] private (
659659
typeDefinition: Either[ast.TypeDefinition, ObjectLikeType[Ctx, _]],
660660
extensions: Vector[ast.ObjectLikeTypeExtensionDefinition],
661661
field: ast.FieldDefinition): Option[Field[Ctx, Any]] = {
662-
val args = field.arguments.flatMap(buildArgument(origin, typeDefinition, Some(field), _)) toList
662+
val args = field.arguments.flatMap(buildArgument(origin, typeDefinition, Some(field), _)).toList
663663
val fieldType = builder.buildFieldType(origin, typeDefinition, extensions, field, args, this)
664664

665665
builder.buildField(origin, typeDefinition, extensions, field, fieldType, args, this)
@@ -772,7 +772,7 @@ class AstSchemaMaterializer[Ctx] private (
772772
val extraFields = extensions.flatMap(_.fields)
773773

774774
val fieldsFn = () => {
775-
val ef = extraFields.flatMap(buildInputField(origin, Right(tpe), _, extensions)) toList
775+
val ef = extraFields.flatMap(buildInputField(origin, Right(tpe), _, extensions)).toList
776776
val f = tpe.fields.map(extendInputField(origin, tpe, _))
777777

778778
f ++ ef
@@ -899,7 +899,7 @@ class AstSchemaMaterializer[Ctx] private (
899899
origin,
900900
extensions,
901901
tpe,
902-
withExtensions.map(getObjectType(origin, _)) toList,
902+
withExtensions.map(getObjectType(origin, _)).toList,
903903
this)
904904
}
905905

@@ -908,7 +908,7 @@ class AstSchemaMaterializer[Ctx] private (
908908
val extraTypes = extensions.flatMap(_.types)
909909

910910
val t = tpe.types.map(getTypeFromDef(origin, _))
911-
val et = extraTypes.map(getObjectType(origin, _)) toList
911+
val et = extraTypes.map(getObjectType(origin, _)).toList
912912

913913
builder.extendUnionType(origin, extensions, tpe, t ++ et, this)
914914
}
@@ -935,7 +935,7 @@ class AstSchemaMaterializer[Ctx] private (
935935
origin,
936936
extensions,
937937
tpe,
938-
() => withExtensions.flatMap(buildInputField(origin, Left(tpe), _, extensions)) toList,
938+
() => withExtensions.flatMap(buildInputField(origin, Left(tpe), _, extensions)).toList,
939939
this)
940940
}
941941

@@ -954,7 +954,7 @@ class AstSchemaMaterializer[Ctx] private (
954954
origin,
955955
extensions,
956956
tpe,
957-
withExtensions.flatMap(buildEnumValue(origin, Left(tpe), _, extensions)) toList,
957+
withExtensions.flatMap(buildEnumValue(origin, Left(tpe), _, extensions)).toList,
958958
this)
959959
}
960960

Diff for: modules/core/src/main/scala/sangria/schema/AstSchemaResolver.scala

+10-11
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,16 @@ object InstanceCheck {
161161
def field[Ctx, T: InputUnmarshaller](fieldName: String): InstanceCheck[Ctx] = {
162162
val iu = implicitly[InputUnmarshaller[T]]
163163

164-
InstanceCheck(c =>
165-
(value, _) => {
166-
val node = value.asInstanceOf[T]
167-
168-
if (!iu.isMapNode(node)) false
169-
else
170-
iu.getMapValue(node, fieldName) match {
171-
case Some(v) => iu.isScalarNode(v) && iu.getScalaScalarValue(v) == c.definition.name
172-
case None => false
173-
}
174-
})
164+
InstanceCheck { c => (value, _) =>
165+
val node = value.asInstanceOf[T]
166+
167+
if (!iu.isMapNode(node)) false
168+
else
169+
iu.getMapValue(node, fieldName) match {
170+
case Some(v) => iu.isScalarNode(v) && iu.getScalaScalarValue(v) == c.definition.name
171+
case None => false
172+
}
173+
}
175174
}
176175
}
177176

Diff for: modules/core/src/main/scala/sangria/schema/SchemaComparator.scala

+11-7
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,9 @@ object SchemaChange {
841841
oldDefault: Option[ast.Value],
842842
newDefault: Option[ast.Value])
843843
extends AbstractChange(
844-
s"`${tpe.name}.${field.name}` default value changed from ${oldDefault.fold("none")(d => s"`${QueryRenderer.renderCompact(d)}`")} to ${newDefault.fold("none")(d => s"`${QueryRenderer.renderCompact(d)}`")}",
844+
s"`${tpe.name}.${field.name}` default value changed from ${oldDefault.fold("none")(d =>
845+
s"`${QueryRenderer.renderCompact(d)}`")} to ${newDefault.fold("none")(d =>
846+
s"`${QueryRenderer.renderCompact(d)}`")}",
845847
breakingChange = false
846848
)
847849
with TypeChange
@@ -854,7 +856,8 @@ object SchemaChange {
854856
newDefault: Option[ast.Value])
855857
extends AbstractChange(
856858
s"`${tpe.name}.${field.name}(${argument.name})` default value changed from ${oldDefault
857-
.fold("none")(d => s"`${QueryRenderer.renderCompact(d)}`")} to ${newDefault.fold("none")(d => s"`${QueryRenderer.renderCompact(d)}`")}",
859+
.fold("none")(d => s"`${QueryRenderer.renderCompact(d)}`")} to ${newDefault.fold(
860+
"none")(d => s"`${QueryRenderer.renderCompact(d)}`")}",
858861
breakingChange = false,
859862
dangerousChange = true
860863
)
@@ -866,7 +869,9 @@ object SchemaChange {
866869
oldDefault: Option[ast.Value],
867870
newDefault: Option[ast.Value])
868871
extends AbstractChange(
869-
s"`${directive.name}(${argument.name})` default value changed from ${oldDefault.fold("none")(d => "`" + QueryRenderer.renderCompact(d) + "`")} to ${newDefault.fold("none")(d => "`" + QueryRenderer.renderCompact(d) + "`")}",
872+
s"`${directive.name}(${argument.name})` default value changed from ${oldDefault.fold(
873+
"none")(d => "`" + QueryRenderer.renderCompact(d) + "`")} to ${newDefault.fold("none")(
874+
d => "`" + QueryRenderer.renderCompact(d) + "`")}",
870875
breakingChange = false,
871876
dangerousChange = true
872877
)
@@ -1175,15 +1180,14 @@ object SchemaChange {
11751180
case class SchemaMutationTypeChanged(
11761181
oldType: Option[ObjectType[_, _]],
11771182
newType: Option[ObjectType[_, _]])
1178-
extends AbstractChange(
1179-
s"Schema mutation type changed from ${oldType.fold("none")(t => "`" + t.name + "`")} to ${newType.fold("none")(t => "`" + t.name + "`")} type",
1180-
oldType.nonEmpty)
1183+
extends AbstractChange(s"Schema mutation type changed from ${oldType.fold("none")(t => "`" + t.name + "`")} to ${newType.fold("none")(t => "`" + t.name + "`")} type", oldType.nonEmpty)
11811184

11821185
case class SchemaSubscriptionTypeChanged(
11831186
oldType: Option[ObjectType[_, _]],
11841187
newType: Option[ObjectType[_, _]])
11851188
extends AbstractChange(
1186-
s"Schema subscription type changed from ${oldType.fold("none")(t => "`" + t.name + "`")} to ${newType.fold("none")(t => "`" + t.name + "`")} type",
1189+
s"Schema subscription type changed from ${oldType.fold("none")(t =>
1190+
"`" + t.name + "`")} to ${newType.fold("none")(t => "`" + t.name + "`")} type",
11871191
oldType.nonEmpty
11881192
)
11891193

Diff for: modules/core/src/main/scala/sangria/validation/rules/overlappingfields/SortedArraySet.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ object SortedArraySet {
8181
members.set(into, first_from)
8282
into += 1
8383
while ({
84-
from += 1
85-
from < members.size() && members.get(from) == first_from
86-
}) ()
84+
from += 1
85+
from < members.size() && members.get(from) == first_from
86+
}) ()
8787
}
8888
members.subList(into, members.size()).clear()
8989
}

Diff for: modules/core/src/test/scala/sangria/execution/ActionMapSpec.scala

+13-12
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,19 @@ class ActionMapSpec extends AnyWordSpec with Matchers with FutureResultSupport {
131131
""")
132132

133133
Executor.execute(schema, doc, deferredResolver = new ColorResolver).await should be(
134-
Map("data" -> Map(
135-
"value" -> "light-red",
136-
"doubleMap" -> "light-red-color",
137-
"future" -> "light-green",
138-
"futureDouble" -> Map("name" -> "light-green"),
139-
"futureTriple" -> "super-light-green",
140-
"deferred" -> "[168]345",
141-
"futureDeferred" -> "[79]56",
142-
"futureDeferredDouble" -> "Yay! [79]576 +++",
143-
"futureDeferredTriple" -> "Yay! [79]576 +++",
144-
"ctxUpdate" -> Map("name" -> "(![56]?576)")
145-
)))
134+
Map(
135+
"data" -> Map(
136+
"value" -> "light-red",
137+
"doubleMap" -> "light-red-color",
138+
"future" -> "light-green",
139+
"futureDouble" -> Map("name" -> "light-green"),
140+
"futureTriple" -> "super-light-green",
141+
"deferred" -> "[168]345",
142+
"futureDeferred" -> "[79]56",
143+
"futureDeferredDouble" -> "Yay! [79]576 +++",
144+
"futureDeferredTriple" -> "Yay! [79]576 +++",
145+
"ctxUpdate" -> Map("name" -> "(![56]?576)")
146+
)))
146147
}
147148

148149
"produce partial errors" in {

Diff for: modules/core/src/test/scala/sangria/execution/ExceptionHandlingSpec.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ class ExceptionHandlingSpec
273273
HandledException.multiple(
274274
Vector(
275275
("Error 1", Map("errorCode" -> m.scalarNode("OOPS", "String", Set.empty)), Nil),
276-
("Error 2", Map.empty[String, m.Node], doc.operations.head._2.location.toList)))
276+
("Error 2", Map.empty[String, m.Node], doc.operations.head._2.location.toList)
277+
))
277278
}
278279

279280
Executor.execute(schema, doc, exceptionHandler = exceptionHandler).await should be(

Diff for: modules/core/src/test/scala/sangria/execution/ExecutorSpec.scala

+41-37
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,9 @@ class ExecutorSpec extends AnyWordSpec with Matchers with FutureResultSupport {
522522
OptionInputType(IntType)) :: Argument[Option[String @@ CoercedScalaResult]](
523523
"stringArg",
524524
OptionInputType(StringType)) :: Nil,
525-
resolve = ctx => { resolvedArgs = ctx.args.raw; None }
525+
resolve = ctx => {
526+
resolvedArgs = ctx.args.raw; None
527+
}
526528
))
527529
))
528530

@@ -548,29 +550,30 @@ class ExecutorSpec extends AnyWordSpec with Matchers with FutureResultSupport {
548550
}
549551
}
550552

551-
val schema = Schema(
552-
ObjectType(
553-
"Type",
554-
fields[Unit, Data](
555-
Field("sync", OptionType(StringType), resolve = _.value.sync),
556-
Field("syncError", OptionType(StringType), resolve = _.value.syncError),
557-
Field("async", OptionType(StringType), resolve = _.value.async),
558-
Field("asyncReject", OptionType(StringType), resolve = ctx => ctx.value.asyncReject),
559-
Field("asyncError", OptionType(StringType), resolve = _.value.asyncError),
560-
Field(
561-
"syncDeferError",
562-
OptionType(StringType),
563-
resolve = ctx =>
564-
DeferredValue(throw new IllegalStateException("Error getting syncDeferError"))),
565-
Field(
566-
"asyncDeferError",
567-
OptionType(StringType),
568-
resolve = _ =>
569-
DeferredFutureValue(
570-
Future.failed(throw new IllegalStateException("Error getting asyncDeferError")))
553+
val schema =
554+
Schema(
555+
ObjectType(
556+
"Type",
557+
fields[Unit, Data](
558+
Field("sync", OptionType(StringType), resolve = _.value.sync),
559+
Field("syncError", OptionType(StringType), resolve = _.value.syncError),
560+
Field("async", OptionType(StringType), resolve = _.value.async),
561+
Field("asyncReject", OptionType(StringType), resolve = ctx => ctx.value.asyncReject),
562+
Field("asyncError", OptionType(StringType), resolve = _.value.asyncError),
563+
Field(
564+
"syncDeferError",
565+
OptionType(StringType),
566+
resolve = ctx =>
567+
DeferredValue(throw new IllegalStateException("Error getting syncDeferError"))),
568+
Field(
569+
"asyncDeferError",
570+
OptionType(StringType),
571+
resolve = _ =>
572+
DeferredFutureValue(
573+
Future.failed(throw new IllegalStateException("Error getting asyncDeferError")))
574+
)
571575
)
572-
)
573-
))
576+
))
574577

575578
val Success(doc) = QueryParser.parse("""
576579
{
@@ -1289,20 +1292,21 @@ class ExecutorSpec extends AnyWordSpec with Matchers with FutureResultSupport {
12891292
OptionType(ListType(OptionType(IntType))),
12901293
resolve = c =>
12911294
Action
1292-
.sequence(Seq(
1293-
LeafAction(Some(1)),
1294-
LeafAction(None),
1295-
LeafAction(Some(2)),
1296-
LeafAction(Success(Some(3))),
1297-
LeafAction(Future(Some(4))),
1298-
LeafAction(PartialValue(Some(5), Vector(error))),
1299-
PartialFutureValue[Unit, Option[Int]](
1300-
Future(PartialValue(Some(6), Vector(error)))),
1301-
LeafAction(fetcher.deferOpt(7)),
1302-
LeafAction(fetcher.deferOpt(8)),
1303-
LeafAction(Future(fetcher.deferOpt(9))),
1304-
LeafAction(Future(fetcher.deferOpt(10)))
1305-
).map(_.map(_.map(_ + 10))))
1295+
.sequence(
1296+
Seq(
1297+
LeafAction(Some(1)),
1298+
LeafAction(None),
1299+
LeafAction(Some(2)),
1300+
LeafAction(Success(Some(3))),
1301+
LeafAction(Future(Some(4))),
1302+
LeafAction(PartialValue(Some(5), Vector(error))),
1303+
PartialFutureValue[Unit, Option[Int]](
1304+
Future(PartialValue(Some(6), Vector(error)))),
1305+
LeafAction(fetcher.deferOpt(7)),
1306+
LeafAction(fetcher.deferOpt(8)),
1307+
LeafAction(Future(fetcher.deferOpt(9))),
1308+
LeafAction(Future(fetcher.deferOpt(10)))
1309+
).map(_.map(_.map(_ + 10))))
13061310
.map(vs => vs.map(_.map(_ + 1)))
13071311
)
13081312
)

0 commit comments

Comments
 (0)