bindToSource
Sets the canonical identifiers for an entity that was materialized from source (as opposed to being instantiated from compiled bytecode). Intended for use by PSI / source materializers such as the IDEA plugin.
referenceName is the Kotlin
valname the entity is bound to in source.declaringClassName is the fully-qualified name of the Kotlin file-facade class (e.g.
com.x.y.FailuresKtfor a top-levelvalinFailures.kt) or the enclosing class (for a class-memberval).
After calling this, MetamodelEntity.declaringClassName returns declaringClassName and MetamodelEntity.id computes the canonical Kotlin-path identifier — without needing the compiled Class<*> instance, which is unavailable for source-only entities.