effekt-lang / effekt

A language with lexical effect handlers and lightweight effect polymorphism
https://effekt-lang.org
MIT License
316 stars 20 forks source link

Check return type annotation of object operations #157

Open jiribenes opened 1 year ago

jiribenes commented 1 year ago

Following up on #148, we should type check the return type annotation of object operations.

As of right now, we reject all return type annotations given by the user on an object operation. Instead, we should properly check both the return type and the given set of effects. There is some subtlety required to do this properly -- capability passing should be informed by the declared effects, not by the user-annotated effects. See the discussion in #148 for more details.

Relevant code to be changed: https://github.com/effekt-lang/effekt/blob/a6201f56e7c33d7674708d192e9ee39b41a2fc09/effekt/shared/src/main/scala/effekt/Typer.scala#L357-L368

b-studios commented 8 months ago

I just want to mention that one intermediate step might be to implement block parameters on interfaces and objects (but not handlers, yet). This would make it much easier to implement tests that involve capture sets.