Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helpful message about missing trait imports is not produced in every case #5790

Open
IGI-111 opened this issue Mar 27, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler: ui Mostly compiler messages

Comments

@IGI-111
Copy link
Contributor

IGI-111 commented Mar 27, 2024

We introduced a helpful TraitNotImportedAtFunctionApplication error in #5293 but it isn't being produced in every instance of a missing Hash implementation.

For instance this contract:

contract;

storage {
    total_supply: StorageMap<AssetId, u64> = StorageMap {},
}

produces this error:

    Finished dev [unoptimized + debuginfo] target(s) in 0.33s
     Running `target/debug/forc build --path /home/igi-111/test_forc`
error
 --> /home/igi-111/test_forc/src/main.sw:4:46
  |
2 |
3 | storage {
4 |     total_supply: StorageMap<AssetId, u64> = StorageMap {},
  |                                              ^^^^^^^^^^^^^ Trait "Hash" is not implemented for type "AssetId".
5 | }
  |
____

  Aborting due to 1 error.
Error: Failed to compile test_forc
@IGI-111 IGI-111 added bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler: ui Mostly compiler messages labels Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler: ui Mostly compiler messages
Projects
None yet
Development

No branches or pull requests

2 participants