effekt-lang / effekt

A research language with effect handlers and lightweight effect polymorphism

Home Page:https://effekt-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Soundness Bug with Capture

b-studios opened this issue · comments

interface Exc { def op(): Unit }
def read {t: Exc}: Unit = t.op()

def foo() {arr: Exc} = box {} { () => read {arr} }
def crashMe() = {
  val cap = try {
    foo {arr}
  } with arr: Exc { def op() = resume(println("hey")) }
  (unbox cap)()
}

It should be rejected (and will by the paper), but is accepted in the current implementation. Maybe something is broken in how the captures flow through an application.