Skip to content

Handle Variant check in projection assertion #448

@avanhatt

Description

@avanhatt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [C] BugThis is a bug. Something isn't working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions