sway icon indicating copy to clipboard operation
sway copied to clipboard

Improve error messages for unknown types

Open Braqzen opened this issue 3 years ago • 1 comments

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

1 2 3

cc @mohammadfawaz @emilyaherbert @sezna @otrho

Braqzen avatar Jun 01 '22 19:06 Braqzen

Related to #1740

emilyaherbert avatar Jun 01 '22 19:06 emilyaherbert

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.

mohammadfawaz avatar Oct 31 '22 00:10 mohammadfawaz