@@ -3,6 +3,8 @@ package dotty.tools.pc
3
3
4
4
import java .nio .file .Paths
5
5
6
+ import scala .annotation .tailrec
7
+
6
8
import scala .meta .internal .metals .ReportContext
7
9
import dotty .tools .pc .utils .InteractiveEnrichments .*
8
10
import dotty .tools .pc .printer .ShortenedTypePrinter
@@ -194,10 +196,10 @@ object ImplicitConversion:
194
196
def unapply (tree : Tree )(using params : InlayHintsParams , ctx : Context ) =
195
197
if (params.implicitConversions()) {
196
198
tree match
197
- case Apply (fun : Ident , args) if isSynthetic(fun) =>
199
+ case Apply (fun : Ident , args) if isSynthetic(fun) && args.exists( ! _.span.isZeroExtent) =>
198
200
implicitConversion(fun, args)
199
201
case Apply (Select (fun, name), args)
200
- if name == nme.apply && isSynthetic(fun) =>
202
+ if name == nme.apply && isSynthetic(fun) && args.exists( ! _.span.isZeroExtent) =>
201
203
implicitConversion(fun, args)
202
204
case _ => None
203
205
} else None
@@ -218,7 +220,7 @@ object ImplicitParameters:
218
220
if (params.implicitParameters()) {
219
221
tree match
220
222
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(_)) =>
222
224
val (implicitArgs, providedArgs) = args.partition(isSyntheticArg)
223
225
val allImplicit = providedArgs.isEmpty || providedArgs.forall {
224
226
case Ident (name) => name == nme.MISSING
@@ -229,10 +231,12 @@ object ImplicitParameters:
229
231
case _ => None
230
232
} else None
231
233
232
- private def isSyntheticArg (tree : Tree )(using Context ) = tree match
234
+ @ tailrec
235
+ def isSyntheticArg (tree : Tree )(using Context ): Boolean = tree match
233
236
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)
236
240
case _ => false
237
241
238
242
// Decorations for Quotes are rarely useful
0 commit comments