pakoito
04/08/2022, 9:15 AMAny
in fun <T> assertEquals(expected: T, result: T): Unit
when expected and result don’t have a shared ancestor?Strum355
04/08/2022, 9:20 AMsimon.vergauwen
04/08/2022, 9:22 AMAny
for T
when calling assertEquals("one", 1)
, right?dmitriy.novozhilov
04/08/2022, 9:27 AMOnlyInputTypes
annotation
It is internal, but quite stable, and we are considering making it public
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
fun <@kotlin.internal.OnlyInputTypes T> assertEquals(expected: T, result: T): Unit {...}
Rob Elliot
04/08/2022, 9:39 AMassertEquals<Map<String, String>>(LinkedHashMap<String, String>(), TreeMap<String, String>())
Also nice that the compiler error tells you to do this:
"Type inference failed. The value of the type parameter T should be mentioned in input types (argument types, receiver type or expected type). Try to specify it explicitly." (my emphasis)
Perhaps a little late in the error message though.pakoito
04/08/2022, 9:40 AMpakoito
04/08/2022, 9:41 AMsam
04/08/2022, 12:44 PMPaul Woitaschek
04/08/2022, 5:02 PMPaul Woitaschek
04/08/2022, 5:03 PMsam
04/08/2022, 5:16 PMfun <@OnlyInputTypes A> A.shouldEqual(other: A)
or whatever the syntax needs to bepakoito
04/09/2022, 11:17 AMPaul Woitaschek
04/09/2022, 11:17 AM