Skip to content

Commit a4c4319

Browse files
committed
Kill the state on method resolution failure
1 parent 448cfd5 commit a4c4319

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

usvm-ts/src/main/kotlin/org/usvm/machine/expr/TsExprResolver.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,13 +1160,24 @@ class TsSimpleValueResolver(
11601160
}
11611161

11621162
if (local.name.startsWith(ANONYMOUS_METHOD_PREFIX)) {
1163+
val currentMethod = scope.calcOnState { lastEnteredMethod }
11631164
val sig = EtsMethodSignature(
1164-
enclosingClass = EtsClassSignature.UNKNOWN,
1165+
enclosingClass = currentMethod.signature.enclosingClass,
11651166
name = local.name,
11661167
parameters = emptyList(),
11671168
returnType = EtsUnknownType,
11681169
)
11691170
val methods = ctx.resolveEtsMethods(sig)
1171+
if (methods.isEmpty()) {
1172+
logger.error { "Cannot resolve anonymous method for local: $local" }
1173+
scope.assert(ctx.mkFalse())
1174+
return null
1175+
}
1176+
if (methods.size > 1) {
1177+
logger.error { "Multiple methods found for anonymous method local: $local" }
1178+
scope.assert(ctx.mkFalse())
1179+
return null
1180+
}
11701181
val method = methods.single()
11711182
val ref = scope.calcOnState { getMethodRef(method) }
11721183
return ref

0 commit comments

Comments
 (0)