parapluu / encore

The Encore compiler.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error messages for wrong number of arguments

knikamo opened this issue · 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.