Skip to content

[Feature Request] Improved use statement for Move #19124

Description

@vineethk

🚀 Feature Request

Currently, the transactional test:

//# publish
module 0xc0ffee::m {
    public fun one(): u64 {
        1
    }
}

//# publish
module 0xc0ffee::n {
    public fun two(): u64 {
        2
    }
}

//# publish
module 0xc0ffee::o {
    use 0xc0ffee::{m, n};

    public fun three(): u64 {
        m::one() + n::two()
    }
}

//# run 0xc0ffee::o::three

fails with:

 error: unexpected token
   ┌─ TEMPFILE2:17:19
   │
17 │     use 0xc0ffee::{m, n};
   │                   ^
   │                   │
   │                   Unexpected '{'
   │                   Expected an identifier

However, replacing

    use 0xc0ffee::{m, n};

with

    use 0xc0ffee::m;
    use 0xc0ffee::n;

works as expected.

We want the original program to work.

Originally reported by @alinush

Metadata

Metadata

Assignees

No one assigned

    Labels

    compiler-v2enhancementNew feature or requeststale-exemptPrevents issues from being automatically marked and closed as stale
    No fields configured for Feature.

    Projects

    Status
    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions