Is there a way to find out if an FqName is a packa...
# compiler
a
Is there a way to find out if an FqName is a package or a class in the K2 IR? I used to do this:
Copy code
!IrPluginContext.moduleDescriptor.getPackage(fqName).isEmpty()
Now in K2 when I try that I get:
Copy code
Please use IR declaration properties and not its descriptor properties
Is there a different way to do this in K2?
j
foo.bar.baz
foo.bar/baz.kt
(
class baz
) I guess it can be both and it would depend what you are asking
a
I guess I figured it out. You need to take the parents list up to the IrFile and get the package path from the IrFile:
Copy code
myExpr.type.classOrNull?.owner?.parents?.toList()?.find { it is IrFile }?.kotlinFqName