Skip to content

Commit 8f818da

Browse files
committed
Changed behavior according to review
1 parent 8d3ee13 commit 8f818da

File tree

1 file changed

+6
-8
lines changed
  • utbot-framework/src/main/kotlin/org/utbot/engine

1 file changed

+6
-8
lines changed

utbot-framework/src/main/kotlin/org/utbot/engine/Traverser.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,14 +2345,12 @@ class Traverser(
23452345
// better than engine.
23462346
val types = instanceOfConstraint?.typeStorage?.possibleConcreteTypes ?: instance.possibleConcreteTypes
23472347

2348-
val allConcreteInvocationTargets = findMethodInvocationTargets(types, methodSubSignature)
2349-
val libraryTargets = findLibraryTargets(instance.type, methodSubSignature)
2350-
2351-
// to choose only "good" targets take only library targets in case they present in all targets,
2352-
// otherwise take all targets
2353-
val methodInvocationTargets = libraryTargets?.takeIf {
2354-
allConcreteInvocationTargets.containsAll(it)
2355-
} ?: allConcreteInvocationTargets
2348+
val allPossibleConcreteTypes = typeRegistry.findInheritorsIncludingTypes(instance.type) { setOf(instance.type) }
2349+
2350+
val methodInvocationTargets = findLibraryTargets(instance.type, methodSubSignature)?.takeIf {
2351+
// we have no specified types, so we can take only library targets (if present) for optimization purposes
2352+
types.size == allPossibleConcreteTypes.size
2353+
} ?: findMethodInvocationTargets(types, methodSubSignature)
23562354

23572355
return methodInvocationTargets
23582356
.map { (method, implementationClass, possibleTypes) ->

0 commit comments

Comments
 (0)