effekt-lang / effekt-lang/effekt

Compiler panic: Cannot find captures for a block argument of a box

Open
#998 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Scala
Stars
469
Forks
41
Avg merge
1d 16h
Merged PRs (30d)
23

Description

[Playground link](https://effekt-lang.org/playground.html?playground=rVA9D4JADN35FW%2BTi0Ti10KCC5OJ%2F4BgcsBdZKBnoEbNhf%2FuHSZGBnWxXdq%2Bvr62SmtVMSpDrG6cZ0UoEmRBUCsNQyqkBHtiAVsmSHc4ND3nrlAgfnF8OiAFd3eUocC14dMEhPXUTvWX1g3EHLWZ4ALDqNdKunv5UcR%2BV%2FsMQjLsUCANgHwZYRVhHWETYVssWnl2y5Cnl%2BbmQsunpv912e75CTE2D3AexDH%2Ba0dnb1MzSWQYuqEalTzzxX0P2nSY%2BR1mDw%3D%3D&repl=CmhlbGxvV29ybGQoKQo%3D)
```scala
effect context[C](): C

def one(n: Int) {b: => List[Int] / context[Int]} = try b() with context[Int] { => resume(n + do context[Int]) }
def many(): List[{=> List[Int] / context[Int]} => List[Int] / context[Int] at {}] =
[1, 2, 3, 4, 5].map { n => box { {this: => List[Int] / context[Int]} => one(n){this} } }
// ^^^^
// [panic] Cannot find captures for 'this'!
```

It's 100% possible that the code is completely bogus / that the capture `at {}` is wrong.

Here's where the message originates from:
https://github.com/effekt-lang/effekt/blob/f74fad3906e32a88616dc4912f26963c411238db/effekt/shared/src/main/scala/effekt/context/Annotations.scala#L629-L631

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.