Skip to content

Commit 8128803

Browse files
committed
Fixed type resolving
1 parent 4888ffe commit 8128803

File tree

1 file changed

+7
-1
lines changed
  • utbot-framework/src/main/kotlin/org/utbot/engine

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,9 @@ class Resolver(
716716
* There are three options here:
717717
* * it successfully constructs a type suitable with defaultType and returns it;
718718
* * it constructs a type that cannot be assigned in a variable with the [defaultType] and we `touched`
719-
* the [addr] during the analysis. In such case the method returns [defaultType] as a result;
719+
* the [addr] during the analysis. In such case the method returns [defaultType] as a result
720+
* if the constructed type is not an array, and in case of array it returns the [defaultType] if it has the same
721+
* dimensions as the constructed type and its ancestors includes the constructed type, or null otherwise;
720722
* * it constructs a type that cannot be assigned in a variable with the [defaultType] and we did **not** `touched`
721723
* the [addr] during the analysis. It means we can create [UtNullModel] to represent such element. In such case
722724
* the method returns null as the result.
@@ -811,6 +813,10 @@ class Resolver(
811813
// as const or store model.
812814
if (defaultBaseType is PrimType) return null
813815

816+
if (actualType.numDimensions == 0) {
817+
return defaultType
818+
}
819+
814820
val actualBaseType = actualType.baseType
815821

816822
require(actualBaseType is RefType) { "Expected RefType, but $actualBaseType found" }

0 commit comments

Comments
 (0)