E1844: documentation contradicts the ownership contract

View source

The docstring of a public declaration says the opposite of what the ownership role of a parameter means (ADR-0041).

The docstring of a public declaration says the opposite of what the ownership role of a parameter means (ADR-0041). The check looks for a few phrases: for an abs parameter, which is borrowed read-only, takes ownership, transfer ownership and owns the buffer; for a dat parameter, which is consumed, does not consume, never transfers ownership and borrowed only; for an ins parameter, which is an exclusive loan, retains the pointer, borrow escapes and takes permanent ownership. The message is documentation contradicts the declaration ownership contract, naming the declaration, and the error points at the declaration.

Example

The parameter value is abs, so the verb only borrows it, but the docstring says that the verb takes ownership of it.

actus
"""Return the constant 42; the verb takes ownership of the borrowed value."""
open verb answer(abs value: Int) -> Int {
    return 42;
}

verb main() {
}

Fix

Describe the role that the declaration has, or change the role if the documentation is the intent.

actus
"""Return the constant 42 and borrow the input value read-only."""
open verb answer(abs value: Int) -> Int {
    return 42;
}

"""Entry point of the example; it does nothing and returns no value."""
verb main() {
}

Run actus explain E1844 in your terminal to read this entry offline. Browse Strict & toolchain or all error codes.