Fix portability issues and move JVM-only test

This commit is contained in:
sergeych committed 2026-02-15 11:09:55 +03:00
1 parent b233d4c15f
commit db9dc73da8
6 files changed
+65 -37

No files matched your search

@@ -1192,7 +1192,9 @@ class Compiler(
val found = LinkedHashMap<String, Pair<ModuleScope, ObjRecord>>()
collectModuleRecordMatches(module.scope, name, mutableSetOf(), found)
for ((pkg, pair) in found) {
moduleMatches.putIfAbsent(pkg, ImportedModule(pair.first, module.pos) to pair.second)
if (!moduleMatches.containsKey(pkg)) {
moduleMatches[pkg] = ImportedModule(pair.first, module.pos) to pair.second
}
}
}
if (seedRecord != null) {
@@ -1241,7 +1243,9 @@ class Compiler(
if (!visited.add(scope.packageName)) return
val record = scope.objects[name]
if (record != null && record.visibility.isPublic) {
out.putIfAbsent(scope.packageName, scope to record)
if (!out.containsKey(scope.packageName)) {
out[scope.packageName] = scope to record
}
}
for (child in scope.importedModules) {
collectModuleRecordMatches(child, name, visited, out)
@@ -80,23 +80,17 @@ open class Scope(
extras.isEmpty() -> emptyList()
else -> {
try {
if (extras is MutableList<*>) {
synchronized(extras) { extras.toList() }
} else {
extras.toList()
}
extras.toList()
} catch (_: Exception) {
emptyList()
}
}
}
synchronized(thisVariants) {
thisVariants.clear()
thisVariants.add(primary)
for (obj in extrasSnapshot) {
if (obj !== primary && !thisVariants.contains(obj)) {
thisVariants.add(obj)
}
thisVariants.clear()
thisVariants.add(primary)
for (obj in extrasSnapshot) {
if (obj !== primary && !thisVariants.contains(obj)) {
thisVariants.add(obj)
}
}
}