@@ -77,6 +77,14 @@ object Typer {
77
77
* search was tried on a tree. This will in some cases be reported in error messages
78
78
*/
79
79
private [typer] val HiddenSearchFailure = new Property .Key [SearchFailure ]
80
+
81
+ /** Is tree a compiler-generated `.apply` node that refers to the
82
+ * apply of a function class?
83
+ */
84
+ private [typer] def isSyntheticApply (tree : tpd.Tree ): Boolean = tree match {
85
+ case tree : tpd.Select => tree.hasAttachment(InsertedApply )
86
+ case _ => false
87
+ }
80
88
}
81
89
82
90
@@ -2354,11 +2362,6 @@ class Typer extends Namer
2354
2362
case _ => false
2355
2363
}
2356
2364
2357
- def isSyntheticApply (tree : Tree ): Boolean = tree match {
2358
- case tree : Select => tree.hasAttachment(InsertedApply )
2359
- case _ => false
2360
- }
2361
-
2362
2365
def tryApply (implicit ctx : Context ) = {
2363
2366
val pt1 = pt.withContext(ctx)
2364
2367
val sel = typedSelect(untpd.Select (untpd.TypedSplice (tree), nme.apply), pt1)
@@ -2728,7 +2731,8 @@ class Typer extends Namer
2728
2731
! ctx.isAfterTyper &&
2729
2732
! ctx.isInlineContext) {
2730
2733
typr.println(i " insert apply on implicit $tree" )
2731
- typed(untpd.Select (untpd.TypedSplice (tree), nme.apply), pt, locked)
2734
+ val sel = untpd.Select (untpd.TypedSplice (tree), nme.apply).withAttachment(InsertedApply , ())
2735
+ try typed(sel, pt, locked) finally sel.removeAttachment(InsertedApply )
2732
2736
}
2733
2737
else if (ctx.mode is Mode .Pattern ) {
2734
2738
checkEqualityEvidence(tree, pt)
0 commit comments