Skip to content

Commit e184923

Browse files
Fix recursive usage of implicits
1 parent 6132a0f commit e184923

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

effekt/shared/src/main/scala/effekt/Typer.scala

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1513,8 +1513,19 @@ object Typer extends Phase[NameResolved, Typechecked] {
15131513
Context.annotate(Annotations.Symbol, r, x)
15141514
r
15151515
}
1516+
val ffn = fn match {
1517+
case source.IdTarget(id) =>
1518+
val r = source.IdTarget(source.IdRef(Nil, id.name, source.Span.missing))
1519+
Context.annotate(Annotations.Symbol, r.id,
1520+
id.symbol match {
1521+
case symbols.CallTarget(syms, impls) =>
1522+
symbols.CallTarget(syms, impls) // needs to be refreshed for recursive uses
1523+
})
1524+
r
1525+
case _ => Context.panic("Implicit block argument should be an (eta-expanded) name, not an expression")
1526+
}
15161527
source.BlockLiteral(ftparams, fvparams, fbparams,
1517-
source.Return(source.Call(fn, ftargs, fvargs, fbargs,
1528+
source.Return(source.Call(ffn, ftargs, fvargs, fbargs,
15181529
source.Span.missing), source.Span.missing), source.Span.missing)
15191530
case _ => Context.panic("Unexpected implicit value for implicit block parameter")
15201531
}

0 commit comments

Comments
 (0)