Skip to content

Commit 8c5f74b

Browse files
committed
Patch: explicitly pass type parameter lists; might not work with clause interleaving
1 parent 44c1062 commit 8c5f74b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

quicklens/src/main/scala-3/com/softwaremill/quicklens/QuicklensMacros.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ object QuicklensMacros {
178178
extension (term: Term)
179179
def appliedToIfNeeded(args: List[Term]): Term =
180180
if args.isEmpty then term else term.appliedToArgs(args)
181+
def appliedToTypesIfNeeded(args: List[TypeRepr]): Term =
182+
if term.symbol.paramSymss.headOption.toList.flatten.filter(_.isType).nonEmpty then
183+
term.appliedToTypes(args)
184+
else term
181185

182186
def symbolAccessorByNameOrError(obj: Term, name: String): Term = {
183187
val objTpe = obj.tpe.widenAll
@@ -253,7 +257,7 @@ object QuicklensMacros {
253257
val methodSymbol = methodSymbolByNameOrError(objSymbol, copy.name + "$default$" + i.toString)
254258
// default values in extension methods take the extension receiver as the first parameter
255259
val defaultMethodArgs = argsMap.dropRight(1).flatMap(_.values)
256-
obj.select(methodSymbol).appliedToIfNeeded(defaultMethodArgs)
260+
obj.select(methodSymbol).appliedToTypesIfNeeded(typeParams).appliedToIfNeeded(defaultMethodArgs)
257261
n -> v.getOrElse(defaultMethod)
258262
}.toMap
259263

0 commit comments

Comments
 (0)