E1052: type parameter is not declared or not known

View source

A generic declaration lists its type parameters in square brackets after its name, as in verb identityT or struct Box[T].

A generic declaration lists its type parameters in square brackets after its name, as in verb identity[T](...) or struct Box[T]. A name that is neither a declared type nor one of these parameters is reported with this code once any generic parameter is in scope, where a plain declaration reports an unknown type. The same code is reported at a call of a generic verb when the compiler cannot find a type for one of its parameters, because no argument fixes it and the call does not name it. The message then says that the parameter of the verb cannot be inferred and shows the call to write, such as make[Int](). A name that is not declared is reported as undeclared generic type parameter. The error points at the name or at the call.

Example

actus
struct Box[T] {
    erg item: U,
}

verb main() {
}
actus
verb make[T]() -> Int {
    return 1;
}

verb main() {
    erg x = make();
}

Fix

Declare every parameter that the declaration uses. At a call, write the type argument in square brackets when no argument can fix it.

actus
struct Box[T, U] {
    erg item: U,
}

verb main() {
}
actus
verb make[T]() -> Int {
    return 1;
}

verb main() {
    erg x = make[Int]();
}

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