E0005#
Warning name: unused_type_variable
Unused generic type variable.
In some cases, using types with unused generic type variables will make it impossible for the type checker to infer the type of the unused variable, leading to E0013. This might lead to cryptic error messages, even unexpected runtime behavior.
Erroneous example#
///|
priv struct Foo[T] {
bar : Int
}
///|
test {
let bar : Foo[Int] = { bar: 42 }
inspect(bar.bar, content="42")
}
Suggestion#
If the type variable is indeed useless, remove the unused type variable.
///| priv struct Foo { bar : Int }
If you wish to keep the type variable, you can use
_to indicate that the type variable is intentionally unused.///| priv struct Foo2[_] { bar2 : Int }