diff options
| author | gingerBill <bill@gingerbill.org> | 2018-12-14 14:57:04 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-12-14 14:57:04 +0000 |
| commit | 0b6fc19fb0e48f30d0e506d6599ba61667d083f3 (patch) | |
| tree | 21509114a705055ccea30981cf0c6dca46abd54b /src/ir.cpp | |
| parent | f2dae7023f5b70d9286b7ff3d0d471bebad78292 (diff) | |
Allow polymorphic cast on fields with `_` #302
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index a2a361318..4ac59b647 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -4603,7 +4603,7 @@ irValue *ir_emit_conv(irProcedure *proc, irValue *value, Type *t) { String field_name = ir_lookup_subtype_polymorphic_field(proc->module->info, t, src_type); if (field_name.len > 0) { // NOTE(bill): It can be casted - Selection sel = lookup_field(st, field_name, false); + Selection sel = lookup_field(st, field_name, false, true); if (sel.entity != nullptr) { ir_emit_comment(proc, str_lit("cast - polymorphism")); if (st_is_ptr) { @@ -4628,7 +4628,7 @@ irValue *ir_emit_conv(irProcedure *proc, irValue *value, Type *t) { } } else { - GB_PANIC("invalid subtype cast"); + GB_PANIC("invalid subtype cast %s.%.*s", type_to_string(src_type), LIT(field_name)); } } } |