adapted and enhanced the dict operations to make them compatible with the new DictType

This commit is contained in:
2024-05-19 01:38:07 +02:00
parent d6a1607041
commit 24a25bbf94
6 changed files with 111 additions and 20 deletions
+4 -6
View File
@@ -62,12 +62,10 @@ func evalPlus(ctx ExprContext, self *term) (v any, err error) {
v, err = sumAnyFract(leftValue, rightValue)
}
} else if IsDict(leftValue) && IsDict(rightValue) {
leftDict, _ := leftValue.(map[any]any)
rightDict, _ := rightValue.(map[any]any)
c := CloneMap(leftDict)
for key, value := range rightDict {
c[key] = value
}
leftDict, _ := leftValue.(*DictType)
rightDict, _ := rightValue.(*DictType)
c := leftDict.clone()
c.merge(rightDict)
v = c
} else {
err = self.errIncompatibleTypes(leftValue, rightValue)