Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More precise mismatch error messages for polymorphic method invocations #6

Open
lrytz opened this issue May 10, 2013 · 0 comments
Open

Comments

@lrytz
Copy link
Owner

lrytz commented May 10, 2013

When invoking an effect-polymorphic method, the resulting effect consists of the latent, absolute effect, plus the effect of the argument.

The error message currently does not distinguish where the effect mismatch originates, so it is hard to find the cause of an effect mismatch sometimes:

  def h(f: Int => Int): Int @rel(f) = f(10)
    def test: Int @pure = {
    val x = 1
    h(x => {
      println()
      x + 1
    })
  }

The error is reported at the invocation of h, not at the println() statement:

T.scala:45: error: effect type mismatch;
 found   : @mod(any) @assign(any) @loc(any)
 required: @mod(x,f$1) @assign(x,any) @assign(f$1,any) @loc(any)
@mod(any) does not conform to @mod(x,f$1)
@assign(any) does not conform to @assign(x,any) @assign(f$1,any)
    h(x => {
     ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant