E1053: wrong number of type arguments

View source

A generic type or verb takes exactly the type arguments that its declaration lists.

A generic type or verb takes exactly the type arguments that its declaration lists. Box[T] takes one, so Box[Int, Int] is rejected, and so is a type argument given to something that is not generic. Missing and extra arguments are both reported. The message names the declaration and says how many arguments were expected and how many were found. The error points at the type that has the wrong number of arguments, or at the type arguments of the call.

Example

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

verb main() {
    erg b: Box[Int, Int] = Box[Int] { item: 1 };
}
actus
verb identity(erg item: Int) -> Int {
    return item;
}

verb main() {
    erg v: Int = 1;
    erg x = identity[Int](item: v);
}

A generic verb called with more type arguments than it declares is rejected the same way: identity[Int, Int](item: v) on verb identity[T].

Fix

Give exactly the arguments that the declaration lists. Remove the brackets at a call of a verb that is not generic.

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

verb main() {
    erg b: Box[Int] = Box[Int] { item: 1 };
}
actus
verb identity(erg item: Int) -> Int {
    return item;
}

verb main() {
    erg v: Int = 1;
    erg x = identity(item: v);
}

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