Fix case trying to initialize a char[*]* from a String.

This commit is contained in:
Christoffer Lerno
2024-12-15 20:42:42 +01:00
parent 7d153a162a
commit 4ae3d0150f
3 changed files with 21 additions and 2 deletions

View File

@@ -239,13 +239,15 @@ Type *type_infer_len_from_actual_type(Type *to_infer, Type *actual_type)
// And from the actual type.
actual_type = type_no_optional(actual_type);
Type *actual = type_get_indexed_type(actual_type);
if (!actual) return actual_type;
// Grab the underlying indexed type,
// because we can only have [*] [] [<*>] [<>] * here
Type *indexed = type_get_indexed_type(to_infer);
Type *actual = type_get_indexed_type(actual_type);
// We should always have indexed types.
ASSERT0(indexed && actual);
ASSERT0(indexed);
// The underlying type may also be inferred.
// In this case, infer it.