Skip to content

Instantly share code, notes, and snippets.

@retronym
retronym / lub2.scala
Created March 23, 2010 18:05
Calculate the Least Upper Bound of two types.
object test {
case class L[A, B]() {
def ToLub[AA >: A <: L, BB >: B <: L, L] = new { type LUB = L }
}
val intBoolLub = L[Int, Boolean].ToLub
(1: AnyVal) : intBoolLub.LUB
1: intBoolLub.LUB