effekt icon indicating copy to clipboard operation
effekt copied to clipboard

Resuming an object operation produces confusing error message

Open jiribenes opened this issue 1 year ago • 1 comments

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

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

jiribenes avatar Sep 28 '22 07:09 jiribenes

+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?

b-studios avatar Sep 28 '22 10:09 b-studios