Shawn
11/22/2018, 7:49 PMreified
vs no type param, (thanks for clarifying @halley))? the compiler complains about a platform declaration clash, which I suppose makes sense since there’s no real overloading happening there, but since the second method has to be inline
anyhow, could the compiler not figure out what you mean at compile time and inline the appropriate method to avoid the signature clash?halley
11/22/2018, 7:56 PMjosephivie
11/22/2018, 8:38 PM@JvmName
work for your case? You can just give each function a different name for the JVM but leave the same name for KotlinShawn
11/22/2018, 8:38 PMShawn
11/22/2018, 8:39 PMreified
in play, the compiler could discern between foo()
and foo<Bar>()
, but I don’t know much about computers tbhhalley
11/22/2018, 8:44 PMfun <T> foo(T t)
and fun <reified T> foo(T t)
defined somewhere.
If you have a consumer making this call foo<Bar>(bar)
, which one would it call?Shawn
11/22/2018, 8:46 PMfun foo()
inline fun <reified T> foo()
only one is generic, no other args, etchalley
11/22/2018, 8:50 PMhalley
11/22/2018, 8:51 PMShawn
11/22/2018, 8:53 PMShawn
11/22/2018, 8:55 PMShawn
11/22/2018, 8:56 PMDico
11/22/2018, 10:25 PMfoo()
and there's no way the compiler can tell the two Kotlin functions apart. It does not consider return type when resolving this call. That would make any JVM related constraints (like @JvmName) meaningless. At least, that's what I would think.