Very interesting idea.
Not sure if it’s a bug in the SIP example but you have:
given TypeTest[Int, Num] = (n: Int) => if ((n: Num).ordinal == -1) None else Some(n)
where as you’re proposing to synthesise:
extension (n: Num):
def ordinal: Int = (n: Int) match {
case 0 => 0
case n if n > 0 => 1
case _ => 2
}
which will never return -1. Is this because the sugared declaration has a catch-all in it, and that a catch-all of -1 would be synthesised otherwise, or something?