raulraja
01/24/2018, 4:42 PMlist using both handlers and ErrorHandler type information and computing the intersection based on the hierarchy of those two applied types. In the first case handlers uses an interface that declares type arguments in contravariant position in. The compiler seems to be fine finding the intersection but it's bailing at runtime so the generated bytecode is probably incorrect where it has to do the appropriate cast but this last part is a wild guess.igor.wojda
01/24/2018, 4:47 PMlistOf(Pair(1,2), Pair("A", "B")) -> insertion type Pair<Any, Any>raulraja
01/24/2018, 4:51 PMAny is the upper bound of String and Int because that is where they both meet in a common super type.raulraja
01/24/2018, 4:52 PMval hl: HList<Pair<Int, Int>, Pair<String, String>> = hListOf(Pair(1,2), Pair("A", "B"))raulraja
01/24/2018, 4:52 PMigor.wojda
01/24/2018, 5:03 PMraulraja
01/24/2018, 5:16 PMigor.wojda
01/25/2018, 1:18 PMfun <T> copyWhenGreater(list: List<T>, threshold: T): List<String>
where T : CharSequence,
T : Comparable<T> {
return list.filter { it > threshold }.map { it.toString() }
}
This meet your criteria that âyou can preserve their information without having to compute an intersection type or upperboundâraulraja
01/25/2018, 2:59 PMlistOf(1, "a", 'c') ?raulraja
01/25/2018, 3:01 PMHList3<Int, String, Char>raulraja
01/25/2018, 3:09 PMraulraja
01/25/2018, 3:11 PMdata class Person(val name: String, val age: Int) <=> HList2<String, Int>raulraja
01/25/2018, 3:12 PMraulraja
01/25/2018, 3:13 PMraulraja
01/25/2018, 3:13 PMigor.wojda
01/26/2018, 10:21 AM