aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Bug][Compiler-v2] Cannot check equality between mutable and immutable reference

Open rahxephon89 opened this issue 1 year ago • 0 comments

🐛 Bug

After landing the PR #11371, the compiler V2 will generate an error when trying to check equality between mutable and immutable reference. For instance, for the following function:

 fun t0(s: S, s_ref: &S) {
    (&mut s == s_ref: bool);
}

The compiler will generate the error:

Diagnostics:
error: invalid call of `==`: mutability mismatch (&mut != &) for argument 2
   ┌─ tests/checking/typing/eq.move:18:20
   │
18 │         (&mut s == s_ref: bool);
   │                    ^^^^^

rahxephon89 avatar Dec 20 '23 05:12 rahxephon89