Allow polymorphic cast on fields with _ #302

This commit is contained in:
gingerBill
2018-12-14 14:57:04 +00:00
parent f2dae7023f
commit 0b6fc19fb0
2 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -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));
}
}
}