-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Labels
bugSomething isn't workingSomething isn't workingcompiler: collectionEverything to do with graph collection, type collection, and the collection context.Everything to do with graph collection, type collection, and the collection context.compiler: frontendEverything to do with type checking, control flow analysis, and everything between parsing and IRgenEverything to do with type checking, control flow analysis, and everything between parsing and IRgenenhancementNew feature or requestNew feature or request
Description
Some type implementations still require star imports to populate the trait map, ideally these should all be collected by the compiler without the need for user imports now that we have coherence checks.
Here's a minimal example:
main.sw
contract;
mod foobar;
use foobar::StorageFoobar;
storage {
foo: StorageFoobar = StorageFoobar {},
}
impl Contract {
fn foobar() {
storage.foo.foobar();
}
}
foobar.sw
library;
pub struct StorageFoobar {}
impl StorageKey<StorageFoobar> {
pub fn foobar(self) {
log("foobar");
}
}
Produces the following error:
error
--> /home/igi-111/Code/test_sway/src/main.sw:13:21
|
11 | impl Contract {
12 | fn foobar() {
13 | storage.foo.foobar();
| ^^^^^^ No method "foobar(StorageKey<StorageFoobar>)" found for type "StorageKey<StorageFoobar>".
14 | }
15 | }
|
____
Aborting due to 1 error.
error: Failed to compile test_sway
Adding the following line to main.sw silences it:
use foobar::*; // this also imports implementations
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcompiler: collectionEverything to do with graph collection, type collection, and the collection context.Everything to do with graph collection, type collection, and the collection context.compiler: frontendEverything to do with type checking, control flow analysis, and everything between parsing and IRgenEverything to do with type checking, control flow analysis, and everything between parsing and IRgenenhancementNew feature or requestNew feature or request