E4004

E4004#

Trait methods cannot have type parameters (be polymorphic). MoonBit currently does not support generic/polymorphic methods within trait definitions.

Erroneous Example#

trait Stringer {
  stringify[T : Show](Self, T) -> String
}

Suggestion#

Consider using dynamic dispatch instead of generics:

///|
pub(open) trait Stringer {
  stringify(Self, &Show) -> String
}