Skip to content

Commit

Permalink
update .scalafmt.conf. enforce new wildcard syntax (#1122)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k authored Jan 19, 2025
1 parent 5135118 commit aa0e225
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
10 changes: 9 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,12 @@ fileOverride {

project.excludePaths = [
"glob:**/docs/**/code*/*.scala"
]
]

rewrite.scala3.convertToNewSyntax = true
runner.dialectOverride {
allowSignificantIndentation = false
allowAsForImportRename = false
allowStarWildcardImport = false
allowPostfixStarVarargSplices = false
}
2 changes: 1 addition & 1 deletion play-json/js/src/main/scala/StaticBinding.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ object StaticBinding {
case l: Long => JsNumber(l)
case true => JsTrue
case false => JsFalse
case a: js.Array[_] => JsArray(a.map(anyToJsValue).toArray[JsValue])
case a: js.Array[?] => JsArray(a.map(anyToJsValue).toArray[JsValue])

case o: js.Object => {
JsObject((for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private[jackson] case class ReadingMap(content: ListBuffer[(String, JsValue)]) e
throw new Exception("Cannot add a value on an object without a key, malformed JSON object!")
}

private[jackson] class JsValueDeserializer(factory: TypeFactory, klass: Class[_], jsonConfig: JsonConfig)
private[jackson] class JsValueDeserializer(factory: TypeFactory, klass: Class[?], jsonConfig: JsonConfig)
extends JsonDeserializer[Object] {
override def isCachable: Boolean = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import scala.collection.IterableOps
import scala.collection.MapOps

object MapWrites {
type Map[K, V] = MapOps[K, V, CC, _]
type Map[K, V] = MapOps[K, V, CC, ?]

// see scala.collection.AnyConstr
private[json] type AnyConstr[X] = Any

// see scala.collections.MapOps
private[json] type CC[X, +Y] = IterableOps[_, AnyConstr, _]
private[json] type CC[X, +Y] = IterableOps[?, AnyConstr, ?]

/**
* Serializer for Map[String,V] types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class JsMacroImpl(val c: blackbox.Context) {
selfRef: Boolean
)

val optTpeCtor = typeOf[Option[_]].typeConstructor
val optTpeCtor = typeOf[Option[?]].typeConstructor
val forwardName = TermName(c.freshName("forward"))
val configName = TermName(c.freshName("config"))

Expand Down Expand Up @@ -581,8 +581,8 @@ class JsMacroImpl(val c: blackbox.Context) {

// --- Sub implementations

val readsType = c.typeOf[Reads[_]]
val writesType = c.typeOf[Writes[_]]
val readsType = c.typeOf[Reads[?]]
val writesType = c.typeOf[Writes[?]]

def macroSealedFamilyImpl(subTypes: List[Type]): c.Expr[M[A]] = {
if (subTypes.isEmpty) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ trait ConstraintReads {
def filter[A](otherwise: JsonValidationError)(p: A => Boolean)(implicit reads: Reads[A]) =
Reads[A](js => reads.reads(js).filter(JsError(otherwise))(p))

def minLength[M](m: Int)(implicit reads: Reads[M], p: M => scala.collection.Iterable[_]) =
def minLength[M](m: Int)(implicit reads: Reads[M], p: M => scala.collection.Iterable[?]) =
filterNot[M](JsonValidationError("error.minLength", m))(p(_).size < m)

def maxLength[M](m: Int)(implicit reads: Reads[M], p: M => scala.collection.Iterable[_]) =
def maxLength[M](m: Int)(implicit reads: Reads[M], p: M => scala.collection.Iterable[?]) =
filterNot[M](JsonValidationError("error.maxLength", m))(p(_).size > m)

/**
Expand All @@ -163,7 +163,7 @@ trait ConstraintReads {
def verifying[A](cond: A => Boolean)(implicit rds: Reads[A]) =
filter[A](JsonValidationError("error.invalid"))(cond)(rds)

def verifyingIf[A](cond: A => Boolean)(subreads: Reads[_])(implicit rds: Reads[A]) =
def verifyingIf[A](cond: A => Boolean)(subreads: Reads[?])(implicit rds: Reads[A]) =
Reads[A] { js =>
rds.reads(js).flatMap { t =>
scala.util.control.Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ trait LowPriorityDefaultReads extends EnvReads {
}: JsResult[Builder[A, F[A]]]) { case (acc, (elem, idx)) =>
(acc, ra.reads(elem)) match {
case (JsSuccess(vs, _), JsSuccess(v, _)) => JsSuccess(vs += v)
case (_: JsSuccess[_], jsError: JsError) => jsError.repath(JsPath(idx))
case (_: JsSuccess[?], jsError: JsError) => jsError.repath(JsPath(idx))
case (JsError(errors0), JsError(errors)) => JsError(errors0 ++ JsResult.repath(errors, JsPath(idx)))
case (jsError: JsError, _: JsSuccess[_]) => jsError
case (jsError: JsError, _: JsSuccess[?]) => jsError
}
}
.map(_.result())
Expand Down Expand Up @@ -557,7 +557,7 @@ trait DefaultReads extends LowPriorityDefaultReads {
(acc, result) match {
case (Right(vs), JsSuccess(v, _)) => Right(vs + v)
case (Right(_), JsError(e)) => Left(locate(e, key))
case (Left(e), _: JsSuccess[_]) => Left(e)
case (Left(e), _: JsSuccess[?]) => Left(e)
case (Left(e1), JsError(e2)) => Left(e1 ++ locate(e2, key))
}
}.fold(JsError.apply, res => JsSuccess(res))
Expand Down

0 comments on commit aa0e225

Please sign in to comment.