This commit is contained in:
SvyatoslavScherbina
2020-04-10 14:01:09 +03:00
committed by GitHub
parent dd161d614a
commit 1745a95f57
3 changed files with 28 additions and 3 deletions
@@ -635,7 +635,7 @@ internal class CAdapterGenerator(val context: Context) : DeclarationDescriptorVi
private val seenPackageFragments = mutableSetOf<PackageFragmentDescriptor>()
private var currentPackageFragments: List<PackageFragmentDescriptor> = emptyList()
private val packageScopes = mutableMapOf<String, ExportedElementScope>()
private val packageScopes = mutableMapOf<FqName, ExportedElementScope>()
override fun visitModuleDeclaration(descriptor: ModuleDescriptor, ignored: Void?): Boolean {
TODO("Shall not be called directly")
@@ -648,8 +648,8 @@ internal class CAdapterGenerator(val context: Context) : DeclarationDescriptorVi
override fun visitPackageFragmentDescriptor(descriptor: PackageFragmentDescriptor, ignored: Void?): Boolean {
val fqName = descriptor.fqName
val name = if (fqName.isRoot) "root" else translateName(fqName.shortName().asString())
val packageScope = packageScopes.getOrPut(name) {
val packageScope = packageScopes.getOrPut(fqName) {
val name = if (fqName.isRoot) "root" else translateName(fqName.shortName().asString())
val scope = ExportedElementScope(ScopeKind.PACKAGE, name)
scopes.last().scopes += scope
scope
@@ -3,6 +3,8 @@
* that can be found in the LICENSE file.
*/
// FILE: hello.kt
import kotlinx.cinterop.*
import kotlin.native.CName
@@ -141,3 +143,15 @@ fun getNullableString(param: Int) : String? {
}
fun getVector128() = vectorOf(1, 2, 3, 4)
// FILE: gh3952.sync.kt
package gh3952.sync
class PlainSync {}
// FILE: gh3952.nested.sync.kt
package gh3952.nested.sync
class NestedSync {}
@@ -14,6 +14,16 @@ void testVector128() {
printf("getVector128 = (%d, %d, %d, %d)\n", v4f[0], v4f[1], v4f[2], v4f[3]);
}
// See https://github.com/JetBrains/kotlin-native/issues/3952
void testGH3952() {
T_(gh3952_nested_sync_NestedSync) good = __ kotlin.root.gh3952.nested.sync.NestedSync.NestedSync();
T_(gh3952_sync_PlainSync) alsoGood = __ kotlin.root.gh3952.sync.PlainSync.PlainSync();
__ DisposeStablePointer(good.pinned);
__ DisposeStablePointer(alsoGood.pinned);
}
int main(void) {
T_(Singleton) singleton = __ kotlin.root.Singleton._instance();
T_(Base) base = __ kotlin.root.Base.Base();
@@ -74,6 +84,7 @@ int main(void) {
printf("IsInstance2 = %s\n", !(__ IsInstance(singleton.pinned, __ kotlin.root.Codeable._type())) ? "PASS" : "FAIL");
testVector128();
testGH3952();
__ DisposeStablePointer(singleton.pinned);
__ DisposeString(string1);