sway icon indicating copy to clipboard operation
sway copied to clipboard

parser recovery: failing on parsing `ItemTraitItem`

Open JoshuaBatty opened this issue 2 years ago • 0 comments

The below code is returning as ParseErrorKind::ExpectedAnItem error. This error is causing the parse function to bail out of creating a ParseProgram meaning the LSP doesn't have an AST to traverse.

The compiler should be able to handle an error like this and still be able to continue with creating a parsed and typed AST.

contract;

abi MyContract {
    fn test_function() -> bool;
    fssdf
}

impl MyContract for Contract {
    fn test_function() -> bool {
        true
    }
}
 --> /Users/josh/Documents/rust/fuel_test_projects/no_error_lines/src/main.sw:7:5

6 |     fn test_function() -> bool;
7 |     fssdf
  |     ^ Expected an item.

JoshuaBatty avatar Jul 03 '23 04:07 JoshuaBatty