lrytz/efftp

Effect mismatch error on method invocation: show the latent effect of the function

Opened this issue · 0 comments

When a (non-polymorphic, for this case see #6) method invocation triggers an effect mismatch error, it would be helpful to simply display the latent effect of the invoked method.

This example fails because println() does not have effect annotations:

  def foo: Unit @mod() = {
    println()
  }

The error message requires some time to understand:

T.scala:42: error: effect type mismatch;
 found   : @mod(any) @assign(any) @loc(any) @throws[Throwable] @io
 required: @mod() @loc(any) @throws[Throwable] @io
@mod(any) does not conform to @mod()
@assign(any) does not conform to @assign()
    println()
           ^
four errors found