Skip to content

Commit b026658

Browse files
committed
Small refactoring
1 parent de389c0 commit b026658

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

utbot-go/src/main/kotlin/org/utbot/go/api/GoUtFunctionApi.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ data class GoUtFunction(
1919
val modifiedName: String,
2020
val parameters: List<GoUtFunctionParameter>,
2121
val resultTypes: List<GoTypeId>,
22-
val concreteValues: Collection<FuzzedConcreteValue>,
2322
val modifiedFunctionForCollectingTraces: String,
2423
val numberOfAllStatements: Int,
2524
val sourceFile: GoUtFile

utbot-go/src/main/kotlin/org/utbot/go/gocodeanalyzer/GoSourceCodeAnalyzer.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ object GoSourceCodeAnalyzer {
7575
analyzedFunction.modifiedName,
7676
parameters,
7777
resultTypes,
78-
emptyList(), // TODO: extract concrete values from function's body
7978
analyzedFunction.modifiedFunctionForCollectingTraces,
8079
analyzedFunction.numberOfAllStatements,
8180
sourceFile

utbot-go/src/main/kotlin/org/utbot/go/worker/RawExecutionResults.kt

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ data class PrimitiveValue(
1717
if (!type.isPrimitiveGoType && type !is GoInterfaceTypeId && !type.implementsError) {
1818
return false
1919
}
20+
// byte is an alias for uint8 and rune is an alias for int32
2021
if (this.type == "uint8" && type == goByteTypeId || this.type == "int32" && type == goRuneTypeId) {
2122
return true
2223
}
24+
// for error support
2325
if (this.type == "string" && type is GoInterfaceTypeId && type.implementsError) {
2426
return true
2527
}
@@ -75,12 +77,7 @@ data class ArrayValue(
7577
if (length != type.length || elementType != type.elementTypeId!!.canonicalName) {
7678
return false
7779
}
78-
value.forEach { arrayElementValue ->
79-
if (!arrayElementValue.checkIsEqualTypes(type.elementTypeId)) {
80-
return false
81-
}
82-
}
83-
return true
80+
return value.all { it.checkIsEqualTypes(type.elementTypeId) }
8481
}
8582
}
8683

@@ -243,13 +240,7 @@ private fun createGoUtStructModelFromRawValue(
243240
resultValue: StructValue, resultTypeId: GoStructTypeId, packageName: String
244241
): GoUtStructModel {
245242
val value = resultValue.value.zip(resultTypeId.fields).map { (value, fieldId) ->
246-
GoUtFieldModel(
247-
createGoUtModelFromRawValue(
248-
value.value,
249-
fieldId.declaringType,
250-
packageName
251-
), fieldId
252-
)
243+
GoUtFieldModel(createGoUtModelFromRawValue(value.value, fieldId.declaringType, packageName), fieldId)
253244
}
254245
return GoUtStructModel(value, resultTypeId, packageName)
255246
}

0 commit comments

Comments
 (0)