@@ -16,6 +16,8 @@ import viper.gobra.frontend.info.implementation.TypeInfoImpl
1616import viper .gobra .util .TypeBounds .{BoundedIntegerKind , UnboundedInteger }
1717import viper .gobra .util .{Constants , TypeBounds , Violation }
1818
19+ import scala .annotation .nowarn
20+
1921trait ExprTyping extends BaseTyping { this : TypeInfoImpl =>
2022
2123 import viper .gobra .util .Violation ._
@@ -479,19 +481,20 @@ trait ExprTyping extends BaseTyping { this: TypeInfoImpl =>
479481 (n, exprOrTypeType(n.left), exprOrTypeType(n.right)) match {
480482 case (_ : PEquals | _ : PUnequals | _ : PLess | _ : PAtMost | _ : PGreater | _ : PAtLeast | _ : PAnd | _ : POr , l, r) =>
481483 // from the spec: "first operand must be assignable to the type of the second operand, or vice versa"
482- val fstAssignable = assignableTo.errors(exprOrTypeType(n.left), exprOrTypeType(n.right) , mayInit)(n)
483- val sndAssignable = assignableTo.errors(exprOrTypeType(n.right), exprOrTypeType(n.left) , mayInit)(n)
484+ val fstAssignable = assignableTo.errors(l, r , mayInit)(n)
485+ val sndAssignable = assignableTo.errors(r, l , mayInit)(n)
484486 val assignable = if (fstAssignable.isEmpty || sndAssignable.isEmpty) noMessages
485487 else error(n, s " neither operand is assignable to the type of the other operand " )
488+ @ nowarn(" msg=not.*?exhaustive" )
486489 val applicable = if (assignable.isEmpty) {
487- (n, exprOrTypeType(n.left), exprOrTypeType(n.right)) match {
488- case ( _ : PEquals | _ : PUnequals , l, r) =>
490+ n match {
491+ case _ : PEquals | _ : PUnequals =>
489492 // from the spec: "The equality operators == and != apply to operands of comparable types"
490493 comparableTypes.errors(l, r)(n)
491- case ( _ : PLess | _ : PAtMost | _ : PGreater | _ : PAtLeast , l, r) =>
494+ case _ : PLess | _ : PAtMost | _ : PGreater | _ : PAtLeast =>
492495 // from the spec: "The ordering operators <, <=, >, and >= apply to operands of ordered types"
493- orderedType.errors(l)(n) ++ orderedType.errors(r)(n)
494- case ( _ : PAnd | _ : POr , l, r) =>
496+ orderedType.errors(l)(n.left ) ++ orderedType.errors(r)(n.right )
497+ case _ : PAnd | _ : POr =>
495498 // from the spec: "Logical operators apply to boolean values", which we extend from boolean to assertion values:
496499 assignableTo.errors(l, AssertionT , mayInit)(n.left) ++
497500 assignableTo.errors(r, AssertionT , mayInit)(n.right)
0 commit comments