Skip to content

Commit d0ce04d

Browse files
committed
Review fixes
1 parent 13e099d commit d0ce04d

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ class TsExprResolver(
878878
val fakeType = instanceRef.getFakeType(scope)
879879

880880
// If we want to get length from a fake object, we assume that it is an array.
881-
scope.assert(fakeType.refTypeExpr)
881+
scope.doWithState { pathConstraints += fakeType.refTypeExpr }
882882

883883
val refLValue = getIntermediateRefLValue(instanceRef.address)
884884
val obj = scope.calcOnState { memory.read(refLValue) }
@@ -973,6 +973,12 @@ class TsExprResolver(
973973
}
974974

975975
override fun visit(expr: EtsNewArrayExpr): UExpr<out USort>? = with(ctx) {
976+
val arrayType = expr.type
977+
978+
require(arrayType is EtsArrayType) {
979+
"Expected EtsArrayType in newArrayExpr, but got ${arrayType::class.simpleName}"
980+
}
981+
976982
scope.calcOnState {
977983
val size = resolve(expr.size) ?: return@calcOnState null
978984

@@ -1003,8 +1009,6 @@ class TsExprResolver(
10031009
blockOnFalseState = allocateException(EtsStringType) // TODO incorrect exception type
10041010
)
10051011

1006-
val arrayType = expr.type as EtsArrayType
1007-
10081012
if (arrayType.elementType is EtsArrayType) {
10091013
TODO("Multidimensional arrays are not supported yet, https://github.com/UnitTestBot/usvm/issues/287")
10101014
}

usvm-ts/src/test/kotlin/org/usvm/util/TsTestResolver.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ class TsTestResolver {
109109
resolvedLValuesToFakeObjects += arrayIndexLValue to fakeObject
110110
}
111111

112-
else -> error("Unexpected lValue type: ${lValue::class.java.name}")
112+
else -> {
113+
error("Unexpected lValue type: ${lValue::class.java.name}")
114+
}
113115
}
114116
}
115117
}
@@ -265,7 +267,9 @@ open class TsTestStateResolver(
265267
resolveExpr(fakeObject.extractRef(finalStateMemory))
266268
}
267269

268-
else -> error("Unsupported fake object type: $fakeType")
270+
else -> {
271+
error("Unsupported fake object type: $fakeType")
272+
}
269273
}
270274
}
271275

usvm-util/src/main/kotlin/org/usvm/test/util/checkers/Matchers.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ val ignoreNumberOfAnalysisResults = AnalysisResultsNumberMatcher(
2222

2323
val noResultsExpected = AnalysisResultsNumberMatcher(
2424
description = "No executions expected",
25-
matcherFailedMessage = { it -> "Expected no analysis results, but $it executions were found" }
25+
matcherFailedMessage = { "Expected no analysis results, but $it executions were found" }
2626
) { it == 0 }
2727

2828
class AnalysisResultsNumberMatcher(

0 commit comments

Comments
 (0)