diff --git a/dict_test.go b/dict_test.go index ebede3a..410a97b 100644 --- a/dict_test.go +++ b/dict_test.go @@ -26,6 +26,7 @@ func TestDictParser(t *testing.T) { /* 3 */ {`{1:"one",2:"two",3:"three"}`, map[int64]any{int64(1): "one", int64(2): "two", int64(3): "three"}, nil}, /* 4 */ {`{1:"one",2:"two",3:"three"}.2`, "three", nil}, /* 5 */ {`#{1:"one",2:"two",3:"three"}`, int64(3), nil}, + /* 6 */ {`{1:"one"} + {2:"two"}`, map[any]any{1: "one", 2: "two"}, nil}, } succeeded := 0 diff --git a/operator-sum.go b/operator-sum.go index 1c816e9..643fe38 100644 --- a/operator-sum.go +++ b/operator-sum.go @@ -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) }