@@ -442,9 +442,24 @@ fn bv_exp_to_expr(ctx: &Ctx, state: &mut State, exp: &Exp) -> Result<BvExpr, Vir
442442 let bv_typ = if is_bool { BvTyp :: Bool } else { bv_typ } ;
443443 Ok ( BvExpr { expr : Arc :: new ( ExprX :: Unary ( op, expr) ) , bv_typ } )
444444 }
445- UnaryOp :: IntToReal => panic ! ( "internal error: unexpected int to real coercion" ) ,
446- UnaryOp :: RealToInt => panic ! ( "internal error: unexpected real to int coercion" ) ,
447- UnaryOp :: FloatToBits => panic ! ( "internal error: unexpected float to bits coercion" ) ,
445+ UnaryOp :: IntToReal => {
446+ return Err ( error (
447+ & exp. span ,
448+ "int-to-real coercion not supported in bit_vector assert" ,
449+ ) ) ;
450+ }
451+ UnaryOp :: RealToInt => {
452+ return Err ( error (
453+ & exp. span ,
454+ "real-to-int coercion not supported in bit_vector assert" ,
455+ ) ) ;
456+ }
457+ UnaryOp :: FloatToBits => {
458+ return Err ( error (
459+ & exp. span ,
460+ "float-to-bits coercion not supported in bit_vector assert" ,
461+ ) ) ;
462+ }
448463 UnaryOp :: HeightTrigger => panic ! ( "internal error: unexpected HeightTrigger" ) ,
449464 UnaryOp :: Trigger ( _) => bv_exp_to_expr ( ctx, state, arg) ,
450465 UnaryOp :: CoerceMode { .. } => {
@@ -453,11 +468,17 @@ fn bv_exp_to_expr(ctx: &Ctx, state: &mut State, exp: &Exp) -> Result<BvExpr, Vir
453468 UnaryOp :: MustBeFinalized | UnaryOp :: MustBeElaborated => {
454469 panic ! ( "internal error: Exp not finalized: {:?}" , arg)
455470 }
456- UnaryOp :: StrLen => panic ! (
457- "internal error: matching for bit vector ops on this match should be impossible"
458- ) ,
471+ UnaryOp :: StrLen => {
472+ return Err ( error (
473+ & exp. span ,
474+ "string slice length not supported in bit_vector assert" ,
475+ ) ) ;
476+ }
459477 UnaryOp :: InferSpecForLoopIter { .. } => {
460- panic ! ( "internal error: unexpected Option type (from InferSpecForLoopIter)" )
478+ return Err ( error (
479+ & exp. span ,
480+ "loop-iterator inference hint not supported in bit_vector assert" ,
481+ ) ) ;
461482 }
462483 UnaryOp :: CastToInteger => {
463484 panic ! ( "internal error: unexpected CastToInteger" )
0 commit comments