E1012: unknown parameter name in a call

View source

A call with named arguments must use the parameter names that the verb declares.

A call with named arguments must use the parameter names that the verb declares. The compiler does not guess which parameter a misspelled name was meant to be. The message names the callee and the unknown name, and the error points at that argument.

Example

actus
verb scale(abs value: Int, abs factor: Int) -> Int {
    return value * factor;
}

verb main() {
    erg a: Int = 2;
    erg b: Int = 3;
    println(int: scale(value: abs a, scale: abs b));
}

Fix

Use the declared parameter name.

actus check --format json offers this as a fix: rename the argument to the one declared parameter whose name is close and that the call has not named yet (a safe fix); nothing is offered when two parameters are equally close.

actus
verb scale(abs value: Int, abs factor: Int) -> Int {
    return value * factor;
}

verb main() {
    erg a: Int = 2;
    erg b: Int = 3;
    println(int: scale(value: abs a, factor: abs b));
}

Run actus explain E1012 in your terminal to read this entry offline. Browse Ownership & types or all error codes.