Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Scala Steward: Reformat with scalafmt 3.8.4
f02d45a6f6abeed0724ab0224e05437fc58cbd56

# Scala Steward: Reformat with scalafmt 3.9.10
ecce4a763e35e2a3bdbf91dc9fbe6f47d7ea39d8
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.9.4
version = 3.9.10
maxColumn = 120
runner.dialect = scala213
fileOverride {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ object MacwireMacros {
.flatMap { m =>
extractTypeFromNullaryType(m.typeSignature) match {
case Some(tpe) => Some((m, tpe))
case None =>
case None =>
log(s"Cannot extract type from ${m.typeSignature} for member $m!")
None
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DependencyResolver[C <: blackbox.Context, TypeC <: C#Type, TreeC <: C#Tree
*/
def resolve(param: Symbol, t: Type): Tree = {
eligibleValues.findInFirstScope(t).toList match {
case Nil => resolutionFallback(t.asInstanceOf[TypeC]).asInstanceOf[Tree]
case Nil => resolutionFallback(t.asInstanceOf[TypeC]).asInstanceOf[Tree]
case value :: Nil =>
val forwardValues = eligibleValues.findInScope(t, LocalForward)
if (forwardValues.nonEmpty) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private[macwire] class EligibleValuesFinder[C <: blackbox.Context](val c: C, log

@tailrec
def doFind(trees: List[(Scope, Tree)], values: EligibleValues): EligibleValues = trees match {
case Nil => values
case Nil => values
case (scope, tree) :: tail =>
tree match {

Expand Down Expand Up @@ -150,7 +150,7 @@ private[macwire] class EligibleValuesFinder[C <: blackbox.Context](val c: C, log
pp ++ selfTypes

case ModuleDef(_, _, Template(pp, _, _)) => pp
case e =>
case e =>
c.error(c.enclosingPosition, s"Unknown type of enclosing class: ${e.getClass}")
Nil
}
Expand Down Expand Up @@ -314,7 +314,7 @@ private[macwire] class EligibleValuesFinder[C <: blackbox.Context](val c: C, log
findInScope(tpe, scope) match {
case coll if coll.isEmpty && !scope.isMax => forScope(scope.widen)
case coll if coll.isEmpty => log(s"Could not find $tpe in any scope"); Nil
case exprs =>
case exprs =>
log(s"Found [${exprs.mkString(", ")}] of type [$tpe] in scope $scope")
exprs
}
Expand Down Expand Up @@ -348,7 +348,7 @@ private[macwire] class EligibleValuesFinder[C <: blackbox.Context](val c: C, log
private def enclosingClassBody: List[Tree] = c.enclosingClass match {
case ClassDef(_, _, _, Template(_, _, body)) => body
case ModuleDef(_, _, Template(_, _, body)) => body
case e =>
case e =>
c.error(c.enclosingPosition, s"Unknown type of enclosing class: ${e.getClass}")
Nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ package object internals {

val (sym: Symbol, tpeArgs: List[Type]) = targetTypeD match {
case TypeRef(_, sym, tpeArgs) => (sym, tpeArgs)
case t =>
case t =>
c.abort(
c.enclosingPosition,
s"Target type not supported for wiring: $t. Please file a bug report with your use-case."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private[macwire] class EligibleValuesFinder[Q <: Quotes](log: Logger)(using val
findInScope(tpe, scope) match {
case coll if coll.isEmpty && !scope.isMax => forScope(scope.widen)
case coll if coll.isEmpty => log(s"Could not find $tpe in any scope"); Nil
case exprs =>
case exprs =>
log(s"Found [${exprs.mkString(", ")}] of type [$tpe] in scope $scope")
exprs
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AutowireProviders[Q <: Quotes](using val q: Q)(
@tailrec
def createProviders(deps: List[Expr[Any]], acc: Vector[Provider], seenTpes: Set[TypeRepr]): Vector[Provider] =
deps match
case Nil => acc
case Nil => acc
case dep :: otherDeps =>
val term = dep.asTerm
val tpe = term.tpe.dealias.widen // dealias, and widen from singleton types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def autowireImpl[T: Type](dependencies: Expr[Seq[Any]])(using q: Quotes): Expr[T
// extracting the provided varargs - we need an explicitly provided list of dependencies
val rawDependencies: Seq[Expr[Any]] = dependencies match
case Varargs(exprs) => exprs
case _ =>
case _ =>
report.errorAndAbort(
s"depedencies need to be provided directly as parameters to the autowire call; got: $dependencies"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CatsProvidersGraphContext[C <: blackbox.Context](val c: C, val log: Logger
ctx.withProvider(sym, provider) { currentCtx =>
provider match {
case _: NotResolvedProvider => currentCtx.missingPath()
case _ =>
case _ =>
provider.dependencies.foldLeft(currentCtx) { case (paramsCtx, deps) =>
deps.foldLeft(paramsCtx) { case (paramCtx, (sym, param)) => go(paramCtx)(sym, param) }
}
Expand Down Expand Up @@ -230,7 +230,7 @@ class CatsProvidersGraphContext[C <: blackbox.Context](val c: C, val log: Logger
case ((currentCtx, resolvedParams), Param(paramSym, paramTpe)) =>
currentCtx.resolve(paramTpe) match {
case Some(Left(provider)) => (currentCtx, resolvedParams.:+((paramSym, provider)))
case Some(Right(fmt)) => {
case Some(Right(fmt)) => {
val (updatedCtx, fm) = resolveFactoryMethod(currentCtx)(fmt)

(updatedCtx, resolvedParams.:+((paramSym, fm)))
Expand Down Expand Up @@ -287,7 +287,7 @@ class CatsProvidersGraphContext[C <: blackbox.Context](val c: C, val log: Logger
/** DFS based algorithm that resolves all `FactoryMethodTree`
*/
private def resolveFactoryMethods(ctx: BuilderContext): BuilderContext = ctx.next() match {
case None => ctx
case None => ctx
case Some(fmt) => {
val (updatedCtx, _) = resolveFactoryMethod(ctx)(fmt)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ trait GraphBuilderUtils[C <: blackbox.Context] { this: CatsProviders[C] =>
.map(_.asRight[Provider])

val result = (resolvedProviders ++ resolvedFMT) match {
case Nil => None
case List(result) => Some(result)
case Nil => None
case List(result) => Some(result)
case ambiguousProviders => {
val duplicates = ambiguousProviders.map {
case Left(value) => value.resultType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object ProxyCreator {
// not possible, we invoke any constructor with default values for arguments.
val instance = UnsafeInstance match {
case Some(unsafe) => unsafe.allocateInstance(proxiedClass)
case None =>
case None =>
val constructor = findBestConstructor(proxiedClass)
constructor.newInstance(constructor.getParameterTypes.map(getDefaultValueForClass): _*)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait ThreadLocalScopeStorage extends Scope {

storage.get(key) match {
case Some(obj) => obj.asInstanceOf[T]
case None => {
case None => {
val obj = createT
storage.set(key, obj)
obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ trait CompileTestsSupport extends BaseCompileTestsSupport {
val warnings = tb.frontEnd.infos.filter(_.severity == tb.frontEnd.WARNING).map(_.msg).toList
lazy val warningsString = "\n - " + warnings.mkString("\n - ")
(warnings, expectedWarningsFragments) match {
case (Nil, Nil) => () // ok
case (_, Nil) => fail(s"Expected compilation to have no warning, but got:" + warningsString)
case (Nil, _) => fail(s"Expected the following compile warnings fragments: $expectedWarningsFragments")
case (Nil, Nil) => () // ok
case (_, Nil) => fail(s"Expected compilation to have no warning, but got:" + warningsString)
case (Nil, _) => fail(s"Expected the following compile warnings fragments: $expectedWarningsFragments")
case (one :: Nil, _) =>
expectedWarningsFragments.foreach(expectedWarning => one should include(expectedWarning))
case (_, _) => fail(s"More than one warning found:" + warningsString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private[macwire] trait BaseCompileTestsSupport extends AnyFlatSpec with Matchers
val (successNames, nonSuccess) = names.partition(_.endsWith(".success"))
val (warningNames, failureNames) = nonSuccess.partition(_.endsWith(".warning"))
failureNames.filterNot(_.endsWith(".failure")) match {
case Nil => ()
case Nil => ()
case neitherSuccessNorFailure =>
sys.error(
"Test case files must either end with .success, .failure or .warning:\n- " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private[macwire] trait DynamicInstantiate {
s"dependency of type ${paramCls.getName} cannot be found"
)
case inst :: Nil => inst.asInstanceOf[AnyRef]
case insts =>
case insts =>
throw new InstantiationException(
s"Cannot instantiate ${cls.getName}, " +
s"multiple dependencies of type ${paramCls.getName} found: ${insts.map(_.getClass.getName)}"
Expand Down