the sum operation now supports dicts too
This commit is contained in:
@@ -61,6 +61,14 @@ func evalPlus(ctx ExprContext, self *term) (v any, err error) {
|
||||
} else {
|
||||
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
|
||||
}
|
||||
v = c
|
||||
} else {
|
||||
err = self.errIncompatibleTypes(leftValue, rightValue)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user