From ec2cb60a271c0c160ee60da515ecc40d8a67a464 Mon Sep 17 00:00:00 2001 From: adamw Date: Fri, 13 Sep 2024 16:24:58 +0200 Subject: [PATCH] Also skip type parameters when applying --- .../macwire/internals/autowire/creator.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/macros/src/main/scala-3/com/softwaremill/macwire/internals/autowire/creator.scala b/macros/src/main/scala-3/com/softwaremill/macwire/internals/autowire/creator.scala index fbe0ea9b..f2ce1b4c 100644 --- a/macros/src/main/scala-3/com/softwaremill/macwire/internals/autowire/creator.scala +++ b/macros/src/main/scala-3/com/softwaremill/macwire/internals/autowire/creator.scala @@ -17,7 +17,7 @@ class Creator[Q <: Quotes](using val q: Q)( private def isImplicit(f: Flags): Boolean = f.is(Flags.Implicit) || f.is(Flags.Given) - // all non-implicit parmaters + // all non-type, non-implicit parmaters val paramFlatTypes: List[TypeRepr] = paramSymbolsLists.flatMap( _.flatMap(param => if isImplicit(param.flags) || param.isType then None else Some(paramType(param))) ) @@ -28,10 +28,10 @@ class Creator[Q <: Quotes](using val q: Q)( def applied(paramFlatValues: List[Term]): Term = val paramsFlatValuesIterator = paramFlatValues.iterator val paramValuesLists = paramSymbolsLists.map { paramSymbolList => - paramSymbolList.map { paramSymbol => - if isImplicit(paramSymbol.flags) - then resolveImplicitOrFail(paramSymbol) - else paramsFlatValuesIterator.next() + paramSymbolList.flatMap { paramSymbol => + if paramSymbol.isType then None + else if isImplicit(paramSymbol.flags) then Some(resolveImplicitOrFail(paramSymbol)) + else Some(paramsFlatValuesIterator.next()) } } val newTree: Term = Select(selectQualifier, creatorSymbol)