Skip to content

Commit de389c0

Browse files
committed
Fix equals and hashCode methods in GoStructTypeId and GoInterfaceTypeId
1 parent 8b33be1 commit de389c0

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ class GoStructTypeId(
4444
return packagePath == other.packagePath && packageName == other.packageName && name == other.name
4545
}
4646

47-
override fun hashCode(): Int = 31 * name.hashCode() + packagePath.hashCode()
47+
override fun hashCode(): Int {
48+
var result = packagePath.hashCode()
49+
result = 31 * result + packageName.hashCode()
50+
result = 31 * result + name.hashCode()
51+
return result
52+
}
4853
}
4954

5055
class GoArrayTypeId(
@@ -87,10 +92,15 @@ class GoInterfaceTypeId(
8792

8893
override fun equals(other: Any?): Boolean {
8994
if (this === other) return true
90-
if (other !is GoStructTypeId) return false
95+
if (other !is GoInterfaceTypeId) return false
9196

9297
return packagePath == other.packagePath && packageName == other.packageName && name == other.name
9398
}
9499

95-
override fun hashCode(): Int = 31 * name.hashCode() + packagePath.hashCode()
100+
override fun hashCode(): Int {
101+
var result = packagePath.hashCode()
102+
result = 31 * result + packageName.hashCode()
103+
result = 31 * result + name.hashCode()
104+
return result
105+
}
96106
}

0 commit comments

Comments
 (0)