E1055: duplicate role declaration

View source

A role is a named contract (ADR-0014), and perform and role bounds refer to it by name.

A role is a named contract (ADR-0014), and perform and role bounds refer to it by name. Two role declarations with the same name would leave those references with two meanings, so the compiler rejects the second one. The error points at the second declaration.

Example

actus
struct Cursor {
    position: Int,
}

role Reader {
    verb read(abs self: Cursor) -> Int;
}

role Reader {
    verb peek(abs self: Cursor) -> Int;
}

verb main() {
}

Fix

Give each role its own name, or merge the methods into one role.

actus
struct Cursor {
    position: Int,
}

role Reader {
    verb read(abs self: Cursor) -> Int;
    verb peek(abs self: Cursor) -> Int;
}

verb main() {
}

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