Thread 'main' panicked at method_application.rs: called `Option::unwrap()` on a `None` value

Quick heads-up on a bug I found in the compiler:

this error:


thread 'main' panicked at sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs:127:26:

called `Option::unwrap()` on a `None` value

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

can be removed by changing all .values to .into()s. Isn’t applicable to the newer versions of the compiler since it forces you to write into()s, but worth pointing out.

The above code was compilable under v0.49.3 and below (basically, you could access the .value field in the structs which is private now and not allowed under the newer versions.

Thanks for reporting it. I have shared this with the team and are waiting for their input. Will lyk if there are any further updates on this. :slight_smile:

Hey @theAusicistkl, can you share the repo for it?

I can confirm that the issue is when you try to access the .value field on a storage variable like so.

let res: b256 = storage.some_asset.read().value; 
// instead of
let res: b256 = storage.some_asset.read().into();

Forgot to update it here, we have created an issue for this. You can track it down here Bug: Thread 'main' panicked at method_application.rs: called `Option::unwrap()` on a `None` value · Issue #6060 · FuelLabs/sway · GitHub

2 Likes