Skip to content

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

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft

More fixes for real applications #283

wants to merge 16 commits into from

Conversation

CaelmBleidd
Copy link
Member

No description provided.

@CaelmBleidd CaelmBleidd changed the title Caelmbleidd/fixes More fixes for real applications May 30, 2025
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

Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.

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

Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
}

// Если мы записали что-то в объект в виде 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

Line detected, which is longer than the defined maximum line length in the code style.
@@ -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

Name shadowed: implicit lambda parameter 'it'
@@ -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

Name shadowed: implicit lambda parameter 'it'
options,
targets,
timeStatisticsFactory =
{ timeStatistics },

Check warning

Code scanning / detekt

Reports mis-indented code Warning

Unexpected indentation (20) (should be 16)
timeStatisticsFactory =
{ timeStatistics },
stepsStatisticsFactory =
{ stepsStatistics },

Check warning

Code scanning / detekt

Reports mis-indented code Warning

Unexpected indentation (20) (should be 16)
stepsStatisticsFactory =
{ stepsStatistics },
coverageStatisticsFactory =
{ coverageStatistics },

Check warning

Code scanning / detekt

Reports mis-indented code Warning

Unexpected indentation (20) (should be 16)
coverageStatisticsFactory =
{ coverageStatistics },
getCollectedStatesCount =
{ statesCollector.collectedStates.size }

Check warning

Code scanning / detekt

Reports mis-indented code Warning

Unexpected indentation (20) (should be 16)
@CaelmBleidd CaelmBleidd changed the base branch from main to caelmbleidd/input_arrays June 11, 2025 08:58
@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/input_arrays branch from 87b841b to 4994227 Compare June 18, 2025 10:28
Base automatically changed from caelmbleidd/input_arrays to main June 18, 2025 10:48
Copy link

@github-advanced-security github-advanced-security bot left a 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.

@CaelmBleidd CaelmBleidd requested a review from Copilot June 20, 2025 10:13
Copy link

@Copilot Copilot AI left a 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 }
Copy link
Preview

Copilot AI Jun 20, 2025

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.

Suggested change
val exc = exceptions.groupBy { it }
val exc = exceptions.groupBy { it::class }

Copilot uses AI. Check for mistakes.

Comment on lines +68 to +72
val exc = exceptions.groupBy { it }
println(
exc.values.sortedBy
{ it.size }.asReversed().map
{ it.first() })
Copy link
Preview

Copilot AI Jun 20, 2025

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.

Suggested change
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
Copy link
Preview

Copilot AI Jun 20, 2025

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.

Suggested change
// 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants