Skip to content

Conversation

@CaelmBleidd
Copy link
Member

@CaelmBleidd CaelmBleidd commented Jan 19, 2023

Description

The initial issue occurred since we used to have path-independent generics: if during the analysis we discover, that our class is a subclass of another one, and now we might have other generic info (including a number of type arguments), we would take into account generic information for a random path and apply it for each of them.

During implementation I discovered that there are more problems, e.g., if we have several consecutive generic info in one jimple instruction that should be applied for the same object, the latest one will override the earlier one even if it consists of less information.

Moreover, there was an error with retrieving generic type info with upper type bounds, because of which we created type storage with the wrong leastCommonType. It could cause an error during set or get operations for RangeModifiableArray since it uses only a leastCommonType to construct type storage for an object it works with. Because of that, in fact, we didn't use generic types in many situations.

Fixes #1668

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Regression and integration tests

They are the same as automatic tests. But it can be checked using the ContestEstimator: there are no errors for the example from issue #1668

Automated Testing

org.utbot.examples.types.PathDependentGenericsExampleTest#testPathDependentGenerics
org.utbot.examples.types.PathDependentGenericsExampleTest#testFunctionWithSeveralTypeConstraintsForTheSameObject

Manual Scenario

There are no specific manual scenarios.

Checklist:

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • The change contains enough commentaries, particularly in hard-to-understand areas
  • New documentation is provided or existed one is altered
  • No new warnings
  • New tests have been added
  • All tests pass locally with my changes

@CaelmBleidd CaelmBleidd requested a review from Damtev January 19, 2023 09:58
@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/path_dependent_generics branch from 4254701 to 29fbbfb Compare January 19, 2023 10:16
@CaelmBleidd CaelmBleidd added comp-symbolic-engine Issue is related to the symbolic execution engine ctg-bug-fix PR is fixing a bug labels Jan 19, 2023
@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/path_dependent_generics branch from 29fbbfb to 7a20747 Compare January 19, 2023 12:22
@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/path_dependent_generics branch from 7a20747 to c1d182e Compare January 19, 2023 13:27
@CaelmBleidd CaelmBleidd requested a review from Damtev January 19, 2023 13:28
@CaelmBleidd CaelmBleidd enabled auto-merge (squash) January 19, 2023 13:32
@CaelmBleidd CaelmBleidd merged commit c7c493e into main Jan 19, 2023
@CaelmBleidd CaelmBleidd deleted the caelmbleidd/path_dependent_generics branch January 19, 2023 14:29
@alisevych alisevych added this to the 2023.03 Release milestone Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-symbolic-engine Issue is related to the symbolic execution engine ctg-bug-fix PR is fixing a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong number of type storages is provided, expected 1 arguments at TypeRegistry.saveObjectParameterTypeStorages

4 participants