I'm trying to understand why it's legal to call a ...
# announcements
d
I'm trying to understand why it's legal to call a function whose generic type is reified from another function whose generic type is not reified. Something like
Copy code
inline fun <T : Any> foo(X<T>): List<T> {
  return objectMapper.readValue(xxx)
}
inline fun <reified T> ObjectMapper.readValue(content: String): T = ... # from jackson kotlin
How does the compiler create the reification of the T in the nested function if it's not reified in the outer function?
c
In that example, I think the actual reified type parameter is
List
, not
T
. It can determine that statically, since the
readValue()
is the return type of
foo
, which is
List
👍 1
d
oh does reification not work on nested generics too?
i definitely am seeing different runtime behavior if I drop the
inline
from my own function