effekt
effekt copied to clipboard
Resuming an object operation produces confusing error message
I was playing around with objects and managed to write resume( ... )
by accident.
This however produced a very confusing error message about not being able to infer the type of the continuation.
I think that we should be able to special-case this and produce a more relevant message to the user.
![Screenshot 2022-09-27 at 17 11 01](https://user-images.githubusercontent.com/11269173/192715558-e01e2f95-8441-43cc-b8cc-dd57a030cac8.png)
I believe this is the relevant line of code throwing the error message -- it might be helpful to check continuationDetails
https://github.com/effekt-lang/effekt/blob/471f9da2380dac9cd2d057d12cad60496cc20bb3/effekt/shared/src/main/scala/effekt/Typer.scala#L317
+1 This is a wellformedness check that should report something useful like "resuming is only supported in effect handlers, not when defining objects.".
Ideally, this should be done in Namer
, I believe. Maybe in
https://github.com/effekt-lang/effekt/blob/471f9da2380dac9cd2d057d12cad60496cc20bb3/effekt/shared/src/main/scala/effekt/Parser.scala#L564
we should only synthesize resume, if we are actually in a handler?