Skip to content

Commit 5b301e2

Browse files
Fix case where there are implicit and explicit arguments
1 parent e184923 commit 5b301e2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,8 +1348,9 @@ object Typer extends Phase[NameResolved, Typechecked] {
13481348
object Aligned {
13491349
extension[A,B](self: Aligned[A, B])
13501350
def fillImplicit(by: PartialFunction[(B, Int), A]): Aligned[A,B] = {
1351-
val (impl, remaining) = self.missing.zipWithIndex.partition(by.isDefinedAt)
1352-
Aligned(self.matched ++ impl.map{ (a, i) => (by(a, i), a) }, self.extra, remaining.map{ (a, _) => a })
1351+
val pre = self.matched.length
1352+
val (impl, remaining) = self.missing.zipWithIndex.partition{ (a,i) => by.isDefinedAt(a, i + pre) }
1353+
Aligned(self.matched ++ impl.map{ (a, i) => (by(a, i + pre), a) }, self.extra, remaining.map{ (a, _) => a })
13531354
}
13541355
def apply[A, B](got: List[A], expected: List[B]): Aligned[A, B] = {
13551356
@scala.annotation.tailrec

0 commit comments

Comments
 (0)