because if the RHS is a dynamic expansion which returns no values,
that's what it means there
if (map_list_afrom_cs(map, &map->child, cs, &t_rules, NULL, NULL, 256) < 0) {
goto fail;
}
+
+ if ((map->op != T_OP_SET) && !map_list_num_elements(&map->child)) {
+ cf_log_err(cs, "Cannot use operator '%s' for assigning empty list to '%s' data type.",
+ fr_tokens[map->op], fr_type_to_str(parent_da->type));
+ goto fail;
+ }
}
/*
* Do basic sanity checks and resolving.
* Fast path: child is empty, we don't need to do anything.
*/
if (fr_dlist_empty(&map->child.head)) {
- if (fr_type_is_leaf(tmpl_attr_tail_da(current->lhs.vpt)->type)) {
- REDEBUG("%s[%d] Cannot assign empty list to a normal data type", MAP_INFO);
+ if (fr_type_is_leaf(tmpl_attr_tail_da(current->lhs.vpt)->type) && (map->op != T_OP_SET)) {
+ REDEBUG("%s[%d] Cannot assign a list to the '%s' data type", MAP_INFO, fr_type_to_str(tmpl_attr_tail_da(current->lhs.vpt)->type));
return -1;
}
--- /dev/null
+uint32 foo
+
+&foo := 42
+
+if !(&foo == 42) {
+ test_fail
+}
+
+#
+# This is "delete"
+#
+&foo := {}
+
+if &foo {
+ test_fail
+}
+success
--- /dev/null
+uint32 foo
+
+&foo := 42
+
+if !(&foo == 42) {
+ test_fail
+}
+
+&foo += {} # ERROR not allowed!