Hey all :wave: I’m coming here as I have a questio...
# compiler
g
Hey all 👋 I’m coming here as I have a question for the
KotlinType.getJetTypeFqName
function (here). We use this function quite a lot inside detekt when resolving types. This function is inside the JS package of the compiler:
org.jetbrains.kotlin.js.descriptorUtils
but it’s implementation is platform agnostic. Why is this the case? Could this be moved inside
org.jetbrains.kotlin.descriptors
?
👍 2
b
Hi! Please share more about your use case and environment where do you want to run it (IDE, compiler plugin, something else…).
👋 1
g
The use case is: a static analyser that uses the
compiler-embeddable
to check Kotlin code. We do already use such method as of today is a couple of rules: https://github.com/detekt/detekt/search?q=getJetTypeFqName It just feels odd that this method is inside the
.js
package.
b
it’s inside
js
package because was written specifically for JS BE needs, but a long time ago we’ve stopped using it in most cases. Not it feels outdated so I’d not recommend using it.
As can I see you need fqname of type, right?
if so, you can write something like
type.constructor.declarationDescriptor?.fqNameSafe.asString()
it also could help with this https://github.com/detekt/detekt/issues/3546 😉
g
As can I see you need fqname of type, right?
Yes basically yes 👍
if so, you can write something like 
type.constructor.declarationDescriptor?.fqNameSafe.asString()
Great thanks for the suggestions 🙏 Sorry for the late replay but I’m taking some days off 🌴 I’ll give it a try to see if it fully accomodates our use case and will come back to this thread.
we’ve stopped using it in most cases. Not it feels outdated so I’d not recommend using it.
Just out of curiosity, then why this function is not
@deprecated
? Given that it’s an extension function on
KotlinType
it appears in autocompletion and contributors end up using it. A deprecation warning will help discourage it.
👍 1
b
Just out of curiosity, then why this function is not 
@deprecated
? it appears in autocompletion and contributors end up using it. A deprecation warning will help discourage it.
Good point, we definitely should deprecate it. We just didn’t work much on this part of the project for a long time, so there wasn’t time or reason to cleaning things. Also (IMO), being used as a library is not the (main) goal of the project, so we don’t spend as much time as for libraries on designing and supporting “public” API.
👍 1