[Interop][Metadata] Mark UniqId as public

Public declaration's UniqId should have MSB == 1.
Despite we using our own mangling scheme we still need to respect this convention.
Otherwise IrLinker will go crazy searching for missing local declaration.
This commit is contained in:
Sergey Bogolepov
2019-12-02 15:29:18 +07:00
committed by Sergey Bogolepov
parent f10965cbec
commit b6b447c0d5
@@ -51,5 +51,11 @@ internal class StubIrUniqIdProvider {
?: error("Unexpected origin ${typeAlias.origin} for typealias ${typeAlias.alias.fqName}.")
}.toUniqId()
private fun String.toUniqId() = UniqId(cityHash64())
/**
* MSB should be set to 1 for public declarations.
* @see org.jetbrains.kotlin.ir.util.UniqId
*/
private fun Long.markAsPublic() = this or (1L shl 63)
private fun String.toUniqId() = UniqId(cityHash64().markAsPublic())
}