epfl-lara / rust-stainless

An experimental Rust frontend for Stainless
Apache License 2.0
6 stars 2 forks source link

Find type classes with type params but without evidence args #80

Closed yannbolliger closed 3 years ago

yannbolliger commented 3 years ago

Until now, type class instances with type parameters but without evidence arguments would not be created. This PR refactors the evidence argument search and fixes that problem.

As an example, take this impl:

impl<T> Default for Option<T> {
  fn default() -> Option<T> {
    Option::None
  }
}

This will be extracted as a type class case class OptionTasDefault[T]() extends Default[Option[T]] and it should always be possible to just create an instance of it.

Additionally: