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

[Bug][move-compiler-v2] Cannot infer type for `*(abort 0)` in vector

Open zzjas opened this issue 6 months ago • 0 comments

🐛 Bug

module 0xCAFE::Module0 {
    use 0x1::vector;
    struct S has copy, drop {}
    public fun f() {
        let x: vector<S> = vector[
            S {},
            *(abort 0),
        ];
    }
}

It can be compiled with V1 without extended checks (as in transactional tests).

It cannot be compiled by V2.

The error is:

 error: unable to infer instantiation of type `&S` (consider providing type arguments or annotating the type)
  ┌─ TEMPFILE:8:14
  │
8 │             *(abort 0),
  │              ^^^^^^^^^

zzjas avatar Aug 07 '24 15:08 zzjas