@@ -421,28 +421,28 @@ sealed interface TsBinaryOperator {
421421 if (lhs.sort == boolSort && rhs.sort == boolSort) {
422422 val lhs = lhs.asExpr(boolSort)
423423 val rhs = rhs.asExpr(boolSort)
424- return mkEq (lhs, rhs)
424+ return onBool (lhs, rhs, scope )
425425 }
426426
427427 // fp == fp
428428 if (lhs.sort == fp64Sort && rhs.sort == fp64Sort) {
429429 val lhs = lhs.asExpr(fp64Sort)
430430 val rhs = rhs.asExpr(fp64Sort)
431- return mkFpEqualExpr (lhs, rhs)
431+ return onFp (lhs, rhs, scope )
432432 }
433433
434434 // bool == fp
435435 if (lhs.sort == boolSort && rhs.sort == fp64Sort) {
436436 val lhs = lhs.asExpr(boolSort)
437437 val rhs = rhs.asExpr(fp64Sort)
438- return mkFpEqualExpr (boolToFp(lhs), rhs)
438+ return onFp (boolToFp(lhs), rhs, scope )
439439 }
440440
441441 // fp == bool
442442 if (lhs.sort == fp64Sort && rhs.sort == boolSort) {
443443 val lhs = lhs.asExpr(fp64Sort)
444444 val rhs = rhs.asExpr(boolSort)
445- return mkFpEqualExpr (lhs, boolToFp(rhs))
445+ return onFp (lhs, boolToFp(rhs), scope )
446446 }
447447
448448 // ref == ref
@@ -578,7 +578,7 @@ sealed interface TsBinaryOperator {
578578 lhsType.boolTypeExpr eq rhsType.boolTypeExpr,
579579 lhsType.fpTypeExpr eq rhsType.fpTypeExpr,
580580 // TODO support type equality
581- lhsType.refTypeExpr eq rhsType.refTypeExpr
581+ lhsType.refTypeExpr eq rhsType.refTypeExpr,
582582 )
583583 }
584584
@@ -633,11 +633,23 @@ sealed interface TsBinaryOperator {
633633 }
634634 }
635635
636- val loosyEqualityConstraint = with (Eq ) {
636+ check(! lhsValue.isFakeObject())
637+ check(! rhsValue.isFakeObject())
638+
639+ if (lhsValue.sort == addressSort && rhsValue.sort == addressSort) {
640+ val left = lhsValue.asExpr(addressSort)
641+ val right = rhsValue.asExpr(addressSort)
642+ return mkAnd(
643+ typeConstraint,
644+ mkHeapRefEq(left, right)
645+ )
646+ }
647+
648+ val looseEqualityConstraint = with (Eq ) {
637649 resolve(lhsValue, rhsValue, scope)?.asExpr(boolSort) ? : error(" Should not be encountered" )
638650 }
639651
640- return mkAnd(typeConstraint, loosyEqualityConstraint )
652+ return mkAnd(typeConstraint, looseEqualityConstraint )
641653 }
642654
643655 override fun TsContext.internalResolve (
0 commit comments