encore icon indicating copy to clipboard operation
encore copied to clipboard

Error messages for wrong number of arguments

Open knikamo opened this issue 7 years ago • 0 comments

#810 The error message for wrong number of arguments is not adjusted to the new feature default parameters.

When compiling this code:

active class Main
  def main() : unit
    this.foo()
  end

  def foo(a: int, b: int = 0) : unit
    println(a)
    println(b)
  end
end

...the following error message is given:

*** Error during typechecking *** 
Method 'foo' in class 'Main' expects 2 arguments. Got 0
In expression: 
  this.foo()
...

The problem is that the error message is misleading. Since foo has one default parameter it expects 1-2 arguments.

knikamo avatar Jun 01 '17 19:06 knikamo