parapluu / encore

The Encore compiler.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type inconsistency of default values in headers are not pre-checked

Thizizmyname opened this issue · comments

Functions or methods with a default value will not type-check the default value in pre-checker, instead an error will only be thrown at the first function call actually utilizing the default value, and the position of the error will be the function call instead of the the declaration.

Is it possible to typecheck pdefault in instance Precheckable ParamDecl where?

Example below

active class Main

    def foo(i1 : int, i2 : int, i3 : int = 5.3) : unit
        ()
    end

    def main() : unit
        this.foo(10, 8)
    end
end

Actually, closing this since pr #874 solves this issue without any changes.

As a note though, since an error on a declaration (class-/ function-/ method-header) have the entire declaration (header and body) as range, this could lead to very large errors.