E1028: verb does not return a value on every path

View source

A verb that declares a return type must end every path in a return with a value.

A verb that declares a return type must end every path in a return with a value. ADR-0118 makes return the only way a value leaves a verb. A bare return; in such a verb is the same error, and it points at that statement. When a path simply falls off the end, the error points at the start of the verb body.

Example

actus
verb size(abs flag: Bool) -> Int {
    if flag {
        return 1;
    }
}

verb main() {
}

Fix

Add a return for the remaining path.

actus
verb size(abs flag: Bool) -> Int {
    if flag {
        return 1;
    }
    return 0;
}

verb main() {
}

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