@@ -3,6 +3,8 @@ package dotty.tools.pc
33
44import java .nio .file .Paths
55
6+ import scala .annotation .tailrec
7+
68import scala .meta .internal .metals .ReportContext
79import dotty .tools .pc .utils .InteractiveEnrichments .*
810import dotty .tools .pc .printer .ShortenedTypePrinter
@@ -194,10 +196,10 @@ object ImplicitConversion:
194196 def unapply (tree : Tree )(using params : InlayHintsParams , ctx : Context ) =
195197 if (params.implicitConversions()) {
196198 tree match
197- case Apply (fun : Ident , args) if isSynthetic(fun) =>
199+ case Apply (fun : Ident , args) if isSynthetic(fun) && args.exists( ! _.span.isZeroExtent) =>
198200 implicitConversion(fun, args)
199201 case Apply (Select (fun, name), args)
200- if name == nme.apply && isSynthetic(fun) =>
202+ if name == nme.apply && isSynthetic(fun) && args.exists( ! _.span.isZeroExtent) =>
201203 implicitConversion(fun, args)
202204 case _ => None
203205 } else None
@@ -218,7 +220,7 @@ object ImplicitParameters:
218220 if (params.implicitParameters()) {
219221 tree match
220222 case Apply (fun, args)
221- if args.exists(isSyntheticArg) && ! tree.sourcePos.span.isZeroExtent =>
223+ if args.exists(isSyntheticArg) && ! tree.sourcePos.span.isZeroExtent && ! args.exists(isQuotes(_)) =>
222224 val (implicitArgs, providedArgs) = args.partition(isSyntheticArg)
223225 val allImplicit = providedArgs.isEmpty || providedArgs.forall {
224226 case Ident (name) => name == nme.MISSING
@@ -229,10 +231,12 @@ object ImplicitParameters:
229231 case _ => None
230232 } else None
231233
232- private def isSyntheticArg (tree : Tree )(using Context ) = tree match
234+ @ tailrec
235+ def isSyntheticArg (tree : Tree )(using Context ): Boolean = tree match
233236 case tree : Ident =>
234- tree.span.isSynthetic && tree.symbol.isOneOf(Flags .GivenOrImplicit ) &&
235- ! isQuotes(tree)
237+ tree.span.isSynthetic && tree.symbol.isOneOf(Flags .GivenOrImplicit )
238+ case Apply (fun, _ ) if tree.span.isZeroExtent => isSyntheticArg(fun)
239+ case TypeApply (fun, _ ) if tree.span.isZeroExtent => isSyntheticArg(fun)
236240 case _ => false
237241
238242 // Decorations for Quotes are rarely useful
0 commit comments