E4063#

Type does not implement trait, although an impl is defined.

This error can be further divided into 5 cases:

  • Method is missing

  • Implementation is private

  • Method type mismatch

  • Constraints are not satisfied

  • Method contains unresolved type parameters

Erroneous example#

Method is missing#

///|
trait Number {
  to_int(Self) -> Int
  to_float(Self) -> Float
}

///|
struct A(Int)

///|
impl Number for A with to_int(self : A) -> Int {
  //^~~~~~~~~~~~~~~
  // Error: Type A does not implement trait Number, although an `impl` is defined.
  // hint:
  //   method to_float is missing.
  self.0
}

Suggestion#

Modify the code according to the hint provided along with the error message. For the example above, you can add the missing method to_float to type A.

///|
priv trait  {
  () -> 
  () -> 
}

///|
priv struct ()

///|
impl  for  with ( : ) ->  {
  .0
}

///|
impl  for  with ( : ) ->  {
  ::(.0)
}

///|
test {
  let  :  = (42)
  (.(), ="42")
  (.())
}