sway
sway copied to clipboard
Improve error messages for unknown types
Repro
contract;
// Correct path
// use std::vm::evm::evm_address::EvmAddress;
use std::vm::evm::EvmAddress;
abi MyContract {
fn test_function() -> EvmAddress;
}
impl MyContract for Contract {
fn test_function() -> EvmAddress {
~EvmAddress::from(0x0000000000000000000000000000000000000000000000000000000000000000)
}
}
Screenshots

cc @mohammadfawaz @emilyaherbert @sezna @otrho
Related to #1740
A lot of this was addressed in https://github.com/FuelLabs/sway/issues/1740. The only thing remaining is:
--> /Users/mohammad/Desktop/fuel/sway/test/src/e2e_vm_tests/test_programs/should_pass/language/const_decl_and_use_in_library/src/main.sw:14:22
|
12 |
13 | fn test_function() -> EvmAddress {
14 | ~EvmAddress::from(0x0000000000000000000000000000000000000000000000000000000000000000)
| ^^^^ No method named "from" found for type "unknown due to error".
15 | }
16 | }
|
____
which is a bit weird. We can do a bit better than that. We should check what Rust does and follow.