Skip to content

Interpreter handles overloaded function-type keyword argument differently between default and explicit passing #2622

@rodinaarssen

Description

@rodinaarssen

Consider the following module.

bool b(int _x) = false;
bool b(int _x, int _y) = false;

void foo(bool(int) f = b) { println(f(1)); }

void main() {
    hoi();      //executes (the matching overload of `b` is executed)
    hoi(f=b);   //throws UnexpectedType: "Expected bool (int), but got value"
}

The interpreter exhibits different behavior when a (dynamically value-typed) overloaded function is used as a keyword argument in a default setting and as an explicit argument.

Expected behavior
The function as a default parameter should not execute successfully when it does not as an explicitly provided argument.

Desktop (please complete the following information):

  • Context: VS Code extension 0.13.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions