aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-11-20 16:01:59 +0000
committergingerBill <bill@gingerbill.org>2020-11-20 16:01:59 +0000
commit6416a6f39cce4c65c80e29bb4ff4b93a3e463947 (patch)
tree2bf6668068ab0516998fb6bde144a3d4a69bac9e /src/ir.cpp
parent87956676f52a56db98e263d1074b490b71141f0b (diff)
Allow string literals for `[N]byte`
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 819442030..e8378bb97 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -7801,7 +7801,9 @@ irValue *ir_build_expr_internal(irProcedure *proc, Ast *expr) {
if (tv.value.kind != ExactValue_Invalid) {
// NOTE(bill): Edge case
- if (tv.value.kind != ExactValue_Compound &&
+ if (is_type_u8_array(tv.type) && tv.value.kind == ExactValue_String) {
+ return ir_add_module_constant(proc->module, tv.type, tv.value);
+ } else if (tv.value.kind != ExactValue_Compound &&
is_type_array(tv.type)) {
Type *elem = core_array_type(tv.type);
ExactValue value = convert_exact_value_for_type(tv.value, elem);