mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-03 03:32:37 +00:00
Allow string literals for [N]byte
This commit is contained in:
@@ -2955,6 +2955,12 @@ void convert_to_typed(CheckerContext *c, Operand *operand, Type *target_type) {
|
||||
if (check_is_assignable_to(c, operand, elem)) {
|
||||
operand->mode = Addressing_Value;
|
||||
} else {
|
||||
if (operand->value.kind == ExactValue_String && is_type_u8_array(t)) {
|
||||
String s = operand->value.value_string;
|
||||
if (s.len == t->Array.count) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
operand->mode = Addressing_Invalid;
|
||||
convert_untyped_error(c, operand, target_type);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user