commit b58565e3ad52c194a90816b7c13685456577466b
parent 071fc649b9ed6f39e7e4747dbd395f880abc1ec2
Author: Eyal Sawady <ecs@d2evs.net>
Date: Thu, 14 Jan 2021 16:16:34 -0500
Disallow assignment from non-arrays to arrays
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/type_store.c b/src/type_store.c
@@ -126,7 +126,8 @@ type_is_assignable(struct type_store *store,
|| from->storage == TYPE_STORAGE_SLICE)
&& to_secondary == from_secondary;
case TYPE_STORAGE_ARRAY:
- return to->array.length == SIZE_UNDEFINED
+ return from->storage == TYPE_STORAGE_ARRAY
+ && to->array.length == SIZE_UNDEFINED
&& from->array.length != SIZE_UNDEFINED;
// The following types are only assignable from themselves, and are
// handled above: