E1025: argument of the wrong type

View source

The type of an argument must be the type of the parameter.

The type of an argument must be the type of the parameter. Actus has no implicit conversion between types, not even between integer widths. Int and u32 are different types. The message names the callee, the parameter and both types, and the error points at the argument.

The branches of an if or a case whose value is used must all have a value of one type. A branch whose block ends in a statement has no value, and the message names it as Void. A branch that ends in return, break or continue leaves and needs no value, and a case used as a statement discards its values. An if or case whose value is used is also rejected when none of its branches has a value; without a declared type the message expects value.

Example

actus
verb scale(abs value: u32) {
}

verb main() {
    erg n: Int = 2;
    scale(value: abs n);
}

A case arm whose block has no value is the same error:

actus
enum Mode {
    Fast,
    Slow,
}

verb pick(abs mode: Mode) -> Int {
    return case mode {
        Mode.Fast => 1,
        Mode.Slow => {
            erg n: Int = 5;
        },
    };
}

verb main() {
}

Fix

Pass a value of the declared type. Here the binding is declared with that type.

actus
verb scale(abs value: u32) {
}

verb main() {
    erg n: u32 = 2u32;
    scale(value: abs n);
}

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