kani icon indicating copy to clipboard operation
kani copied to clipboard

Handle `Variant` check in projection assertion

Open avanhatt opened this issue 3 years ago • 2 comments

In checking a projections type, we have this comment:

    fn check_expr_typ_mismatch(
        expr: &Expr,
        typ: &TypeOrVariant<'tcx>,
        ctx: &mut GotocCtx<'tcx>,
    ) -> Option<(Type, Type)> {
        match typ {
            TypeOrVariant::Type(t) => {
                let expr_ty = expr.typ().clone();
                let type_from_mir = ctx.codegen_ty(t);
                if expr_ty != type_from_mir { Some((expr_ty, type_from_mir)) } else { None }
            }
            // TODO: handle Variant
            TypeOrVariant::Variant(_) => None,
        }
    }

Creating a tracking issue for the variant case.

avanhatt avatar Aug 23 '21 20:08 avanhatt

Note to self: refactor the logic here a bit and handle Variant separate from Type. In order to check the Variant, we need more information than provided here.

celinval avatar May 20 '22 19:05 celinval

As of #1378, there is now a generator variant: TypeOrVariant::GeneratorVariant that needs to be handled too.

fzaiser avatar Jul 20 '22 17:07 fzaiser