fixed some more inference bugs

This commit is contained in:
Sergey Chernov 2026-04-20 12:23:17 +03:00
parent a8f73dc8bd
commit 6ba128f7ba
2 changed files with 15 additions and 6 deletions

View File

@ -2096,12 +2096,19 @@ class Compiler(
plan.captureOwners[name] = slotLoc
plan.captures += capture
if (!plan.slotPlan.slots.containsKey(name)) {
val newSlot = plan.slotPlan.nextIndex
plan.slotPlan.slots[name] = SlotEntry(
plan.slotPlan.nextIndex,
newSlot,
isMutable = slotLoc.isMutable,
isDelegated = slotLoc.isDelegated
)
plan.slotPlan.nextIndex += 1
slotTypeByScopeId[slotLoc.scopeId]?.get(slotLoc.slot)?.let { cls ->
slotTypeByScopeId.getOrPut(plan.slotPlan.id) { mutableMapOf() }[newSlot] = cls
}
slotTypeDeclByScopeId[slotLoc.scopeId]?.get(slotLoc.slot)?.let { decl ->
slotTypeDeclByScopeId.getOrPut(plan.slotPlan.id) { mutableMapOf() }[newSlot] = decl
}
}
}
@ -10346,6 +10353,9 @@ class Compiler(
if (initClass != null) {
classFieldTypesByName.getOrPut(declaringClassNameCaptured) { mutableMapOf() }[name] = initClass
}
if (!isDelegate && varTypeDecl is TypeDecl.Generic) {
classMemberTypeDeclByName.getOrPut(declaringClassNameCaptured) { mutableMapOf() }[name] = varTypeDecl
}
}
// Emit MiniValDecl for this declaration (before execution wiring), attach doc if any

View File

@ -545,8 +545,7 @@ class StackTraceEntry(
}
// Private helper: starts one LaunchPool worker coroutine for the given queue.
// Defined outside LaunchPool so the global `launch` is not shadowed by the method.
private fun _launchPoolWorker(q) {
val ch = q as Channel
private fun _launchPoolWorker(ch: Channel): Deferred {
launch {
var task = ch.receive()
while (task != null) {
@ -618,7 +617,7 @@ class LaunchPool(maxWorkers, maxQueueSize = Channel.UNLIMITED) {
*/
fun cancel() {
closeQueue()
workers.forEach { (it as Deferred).cancel() }
workers.forEach { it.cancel() }
}
/*
@ -628,7 +627,7 @@ class LaunchPool(maxWorkers, maxQueueSize = Channel.UNLIMITED) {
*/
fun cancelAndJoin() {
closeQueue()
workers.forEach { (it as Deferred).cancel() }
workers.forEach { it.cancel() }
}
/*
@ -639,7 +638,7 @@ class LaunchPool(maxWorkers, maxQueueSize = Channel.UNLIMITED) {
fun closeAndJoin() {
closeQueue()
for (w in workers) {
(w as Deferred).await()
w.await()
}
}
}