8000 [Bug] Differing behaviors based on use statement regarding function values · Issue #16595 · aptos-labs/aptos-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[Bug] Differing behaviors based on use statement regarding function values #16595
Open
@vineethk

Description

@vineethk

🐛 Bug

Consider the following transactional test:

//# publish
module 0xc0ffee::m {
    public fun foo() {}
}

//# publish
module 0xc0ffee::n_ok {
    fun main() {
        use 0xc0ffee::m;
        let f = m::foo;
        f();
    }
}


//# publish
module 0xc0ffee::n_should_also_be_ok {
    fun main() {
        use 0xc0ffee::m::foo;
        let f = foo;
        f();
    }
}

The first two modules compile successfully, but the last one fails with:

Error: compilation errors:
 warning: unused alias
   ┌─ TEMPFILE2:19:26
   │
19 │         use 0xc0ffee::m::foo;
   │                          ^^^ Unused 'use' of alias 'foo'. Consider removing it

error: undeclared `foo`
   ┌─ TEMPFILE2:20:17
   │
20 │         let f = foo;
   │                 ^^^

As far as the user is concerned, there is no difference between the modules n_ok and n_should_also_be_ok.

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

🆕 New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0