@@ -20,7 +20,7 @@ object ContextFunctionResults:
20
20
*/
21
21
def annotateContextResults (mdef : DefDef )(using Context ): Unit =
22
22
def contextResultCount (rhs : Tree , tp : Type ): Int = tp match
23
- case defn.ContextFunctionType (_, resTpe, erasedParams) if ! erasedParams.contains( true ) /* Only enable for non-erased functions */ =>
23
+ case defn.ContextFunctionType (_, resTpe, _) =>
24
24
rhs match
25
25
case closureDef(meth) => 1 + contextResultCount(meth.rhs, resTpe)
26
26
case _ => 0
@@ -116,8 +116,15 @@ object ContextFunctionResults:
116
116
atPhase(erasurePhase)(integrateSelect(tree, n))
117
117
else tree match
118
118
case Select (qual, name) =>
119
- if name == nme.apply && defn.isContextFunctionClass(tree.symbol.maybeOwner) then
120
- integrateSelect(qual, n + 1 )
119
+ if name == nme.apply then
120
+ qual.tpe match
121
+ case defn.ContextFunctionType (_, _, _) =>
122
+ integrateSelect(qual, n + 1 )
123
+ case _ if defn.isContextFunctionClass(tree.symbol.maybeOwner) => // for TermRefs
124
+ // assert(qual.tpe.isInstanceOf[TermRef])
125
+ integrateSelect(qual, n + 1 )
126
+ case _ =>
127
+ n > 0 && contextResultCount(tree.symbol) >= n
121
128
else
122
129
n > 0 && contextResultCount(tree.symbol) >= n
123
130
case Ident (name) =>
0 commit comments