-
Notifications
You must be signed in to change notification settings - Fork 24
More fixes for real applications #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
val resolvedArgs = expr.args.map { resolve(it) ?: return null } | ||
|
||
val staticInstances = scope.calcOnState { | ||
resolutionResult.properties.take(1).map { getStaticInstance(it.enclosingClass!!) } |
Check warning
Code scanning / detekt
Unsafe calls on nullable types detected. These calls will throw a NullPointerException in case the nullable value is null. Warning
|
||
require(resolutionResult is EtsPropertyResolution.Unique) | ||
|
||
val instance = scope.calcOnState { getStaticInstance(resolutionResult.property.enclosingClass!!) } |
Check warning
Code scanning / detekt
Unsafe calls on nullable types detected. These calls will throw a NullPointerException in case the nullable value is null. Warning
} | ||
|
||
// Если мы записали что-то в объект в виде bool, а потом считали это из поля bool | null, то здесь будет unresolvedSort, |
Check warning
Code scanning / detekt
Line detected, which is longer than the defined maximum line length in the code style. Warning
@@ -72,11 +75,27 @@ | |||
.filterNot { it.isStatic } | |||
.filterNot { it.name.startsWith("%AM") } | |||
.filterNot { it.name == "build" } | |||
.filterNot { it.name == INSTANCE_INIT_METHOD_NAME } | |||
.filterNot { it.name == STATIC_INIT_METHOD_NAME } |
Check warning
Code scanning / detekt
Disallow shadowing variable declarations. Warning test
@@ -72,11 +75,27 @@ | |||
.filterNot { it.isStatic } | |||
.filterNot { it.name.startsWith("%AM") } | |||
.filterNot { it.name == "build" } | |||
.filterNot { it.name == INSTANCE_INIT_METHOD_NAME } | |||
.filterNot { it.name == STATIC_INIT_METHOD_NAME } | |||
.filterNot { it.name == CONSTRUCTOR_NAME } |
Check warning
Code scanning / detekt
Disallow shadowing variable declarations. Warning test
options, | ||
targets, | ||
timeStatisticsFactory = | ||
{ timeStatistics }, |
Check warning
Code scanning / detekt
Reports mis-indented code Warning
timeStatisticsFactory = | ||
{ timeStatistics }, | ||
stepsStatisticsFactory = | ||
{ stepsStatistics }, |
Check warning
Code scanning / detekt
Reports mis-indented code Warning
stepsStatisticsFactory = | ||
{ stepsStatistics }, | ||
coverageStatisticsFactory = | ||
{ coverageStatistics }, |
Check warning
Code scanning / detekt
Reports mis-indented code Warning
coverageStatisticsFactory = | ||
{ coverageStatistics }, | ||
getCollectedStatesCount = | ||
{ statesCollector.collectedStates.size } |
Check warning
Code scanning / detekt
Reports mis-indented code Warning
5ed9332
to
eb8e80e
Compare
87b841b
to
4994227
Compare
d98fbfb
to
558a624
Compare
558a624
to
0f18a8c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detekt found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR delivers a set of targeted fixes and enhancements to support real-world applications by updating matcher logic, improving test runners, refining property resolution, enhancing interpreter/expression handling, and bumping dependencies.
- Adjusted matcher to include zero results and updated descriptions.
- Enhanced test runners with finite timeouts, exception aggregation, and filtering.
- Refactored field/method resolution APIs and added support for new expression and type patterns.
- Improved interpreter performance and error handling; updated stop strategy logging.
- Bumped jacodb dependency and minor formatting tweaks.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
usvm-util/src/main/kotlin/org/usvm/test/util/checkers/Matchers.kt | Fix analysis‐results matcher to include zero |
usvm-util/src/main/kotlin/org/usvm/UMachineOptions.kt | Added TODO for fork limit |
usvm-ts/src/test/kotlin/org/usvm/util/TsMethodTestRunner.kt | Adjusted test runner imports and default timeouts |
usvm-ts/src/test/kotlin/org/usvm/project/Photos.kt | Refactored Photos project test with exception collection |
usvm-ts/src/test/kotlin/org/usvm/project/DemoCalc.kt | Mirrored test runner refactor for DemoCalc project |
usvm-ts/src/main/kotlin/org/usvm/util/EtsHierarchy.kt | Commented out an error log for missing class resolution |
usvm-ts/src/main/kotlin/org/usvm/util/EtsFieldResolver.kt | Generalized EtsFieldResolutionResult to EtsPropertyResolution |
usvm-ts/src/main/kotlin/org/usvm/machine/types/TsTypeSystem.kt | Cached ancestor lookups in subtype check |
usvm-ts/src/main/kotlin/org/usvm/machine/operator/TsBinaryOperator.kt | Removed stray blank line |
usvm-ts/src/main/kotlin/org/usvm/machine/interpreter/TsInterpreter.kt | Improved unknown‐stmt handling and limited forks |
usvm-ts/src/main/kotlin/org/usvm/machine/expr/TsExprResolver.kt | Added support for new expr types and TODO stubs |
usvm-ts/src/main/kotlin/org/usvm/machine/TsMachine.kt | Wrapped stop strategy to log when finished |
usvm-ts/src/main/kotlin/org/usvm/machine/TsContext.kt | Added support for enum and generic types |
usvm-core/src/main/kotlin/org/usvm/StepScope.kt | Reformatted check invocation |
buildSrc/src/main/kotlin/Dependencies.kt | Bumped jacodb version |
Comments suppressed due to low confidence (2)
usvm-util/src/main/kotlin/org/usvm/test/util/checkers/Matchers.kt:21
- The description says "Allow any number of results except zero" but the matcher now allows zero. Please update the description to reflect the new behavior.
) { it >= 0 }
usvm-ts/src/test/kotlin/org/usvm/project/Photos.kt:74
- This test collects exceptions but never asserts on them, so failures will be silently logged. Consider adding an assertion (e.g.,
assertTrue(exceptions.isEmpty())
) to fail the test when exceptions occur.
}
} | ||
} | ||
|
||
val exc = exceptions.groupBy { it } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grouping by exception instance (it
) will rarely group multiple exceptions together since each throwable is a distinct object. Consider grouping by exception class or message (it::class
or it.message
) to aggregate similar errors.
val exc = exceptions.groupBy { it } | |
val exc = exceptions.groupBy { it::class } |
Copilot uses AI. Check for mistakes.
val exc = exceptions.groupBy { it } | ||
println( | ||
exc.values.sortedBy | ||
{ it.size }.asReversed().map | ||
{ it.first() }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same grouping issue as in Photos.kt: grouping by the exception instance won't cluster similar errors. Use a meaningful key like exception class or message for grouping.
val exc = exceptions.groupBy { it } | |
println( | |
exc.values.sortedBy | |
{ it.size }.asReversed().map | |
{ it.first() }) | |
val exc = exceptions.groupBy { it::class } | |
println( | |
exc.entries.sortedBy | |
{ it.value.size }.asReversed().map | |
{ "${it.key}: ${it.value.size} occurrences" }) |
Copilot uses AI. Check for mistakes.
@@ -259,4 +259,5 @@ data class UMachineOptions( | |||
* Limit loop iterations. | |||
* */ | |||
val loopIterationLimit: Int? = null, | |||
// TODO fork limit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The TODO comment indicates an unimplemented feature. It may help to add context or link to an issue, or implement the fork limit feature now to avoid leaving untracked work.
// TODO fork limit | |
/** | |
* Limit the number of forks that can be created. If null, no limit is applied. | |
*/ | |
val forkLimit: Int? = null, |
Copilot uses AI. Check for mistakes.
No description provided.