Misleading error message when using parametric effects
jiribenes opened this issue · comments
The following code:
effect Emit[A](x: A): Unit
def emit[A](x: A): Unit / Emit[A] = do Emit[A](x)
returns the error message:
Effect Emit is not allowed in this context.
pointing to the RHS of the second declaration:
The correctly to write the program is to not let the Emit
in the return type take a type parameter:
effect Emit[A](x: A): Unit
def emit[A](x: A): Unit / Emit = do Emit[A](x)
It would therefore be nice to provide a better error message (and to report it in the return type where it stems from).
Strangely this is not caught by our kind checker, but should. Typer performs kind-checking / wellformedness in a very "shot-gunny" way by calling wellformed
on types, like here:
Most likely there is a call to wellformed
missing for the annotated effect. Somewhere around here: