uli
02/04/2022, 10:52 PMinline fun <reified T: Fragment> replaceFragment(
name: String = T::class.java.name
)
Why do I need inline refied
in the signature?
I do understand that T.class.java can not work on an erased type but, If I understand correctly, kotlin would insert the default parameters at call site where the type information is readily available.
If I am not mistaken in my assumptions, I propose to lift the restriction on generic types for when they are used in default parameter definitions.ephemient
02/04/2022, 10:55 PMilya.gorbunov
02/04/2022, 10:58 PMreified
the function could be called with non-reified T.uli
02/04/2022, 11:21 PMreplaceFragment$default
Interesting. Learned something new today 🙂
Somehow I was sure the compiler would insert the missing parameters at call site with all the consequences regarding changing default parameters in a library.
Good to see that kotlin is again a bit smarter then me 🙂ephemient
02/04/2022, 11:50 PMelizarov
02/09/2022, 8:35 AM