nac3artiq: skip attribute writeback for option

option types do not have any fields to be written back to the host so it is ok to skip. If we do not skip, there will be error when getting the value of it since it can be `none`, whose type is not concrete
This commit is contained in:
ychenfo 2022-04-09 03:50:39 +08:00
parent 089bba96a3
commit 6c485bc9dc
1 changed files with 3 additions and 1 deletions

View File

@ -513,7 +513,9 @@ pub fn attributes_writeback<'ctx, 'a>(
} }
let ty = ty.unwrap(); let ty = ty.unwrap();
match &*ctx.unifier.get_ty(ty) { match &*ctx.unifier.get_ty(ty) {
TypeEnum::TObj { fields, .. } => { TypeEnum::TObj { fields, obj_id, .. }
if *obj_id != ctx.primitives.option.get_obj_id(&ctx.unifier) =>
{
// we only care about primitive attributes // we only care about primitive attributes
// for non-primitive attributes, they should be in another global // for non-primitive attributes, they should be in another global
let mut attributes = Vec::new(); let mut attributes = Vec::new();