E1152: call written with a dot

View source

A call names every participant of an action with its role: the verb, then each argument as name: ROLE value (ADR-0020).

A call names every participant of an action with its role: the verb, then each argument as name: ROLE value (ADR-0020). The spelling receiver.verb(...) has no place for the receiver's role, so it does not call a verb (REQ-OWN-0079, ADR-0134). The same holds for a role method, for the method of a generic or dynamic receiver, and for the intrinsics place and raw_slice. The receiver is the participant of the self parameter and is written like any other argument, with the role the signature declares. The message names the verb and the form to write. The error points at the whole call.

A dot still reads a field (counter.value) and writes an enum constructor (Mode.Idle, Option[Int].Some(1)); a module path keeps ::. These are not calls and are not reported.

Example

actus
struct Counter {
    value: Int,
}

verb bump(ins self: Counter) {
    self.value += 1;
}

verb main() -> Int {
    erg counter = Counter { value: 0, };
    counter.bump();
    return counter.value;
}
actus
verb main() -> Int {
    erg arena: Arena[64] = Arena[64]();
    erg node = arena.place(value: 7);
    return 0;
}

Fix

Write the receiver as the self argument, with the role its parameter declares, and keep the other arguments. The intrinsics are written place(arena: ins a, value: v) and raw_slice(buffer: abs b, start: s, length: n). An argument that was written without a name gets the name of its parameter, because a call does not mix named and positional arguments.

actus check --format json offers this as a fix, and actus fix applies the safe ones. The fix is safe when the call names exactly one verb or method and the role it writes is the role the compiler ran for the receiver. It is review when more than one verb or method takes the type of the receiver, or when the receiver of an abs parameter is an owner or a fresh value: the method spelling did not compile there. A receiver that is a fresh value, such as a call result, is written without a role.

actus
struct Counter {
    value: Int,
}

verb bump(ins self: Counter) {
    self.value += 1;
}

verb main() -> Int {
    erg counter = Counter { value: 0, };
    bump(self: ins counter);
    return counter.value;
}
actus
verb main() -> Int {
    erg arena: Arena[64] = Arena[64]();
    erg node = place(arena: ins arena, value: 7);
    return 0;
}

Run actus explain E1152 in your terminal to read this entry offline. Browse Modules & rules or all error codes.