sway icon indicating copy to clipboard operation
sway copied to clipboard

Internal Compiler Error: Unable to resolve variable '__matched_value_1'.

Open brandonsurh opened this issue 2 years ago • 2 comments

I encountered an internal compiler error while working to add a try_insert method to the StorageMap type (#5147). The error message is as follows:

Compiling contract storage_map (/home/brandon/sway/test/src/sdk-harness/test_projects/storage_map)
error: Internal compiler error: Unable to resolve variable '__matched_value_1'.
Please file an issue on the repository and include the code that triggered this error.

This occurs when trying to run the following to build the test harness:

 cargo run --bin=forc build --path test/src/sdk-harness

The error seems to be with the match statement in the try_insert function. If the match statement is replaced with a bool return value, there is no error.

Here is the diff of the branch with the Internal Compiler Error and master: https://github.com/FuelLabs/sway/compare/master...brandonsurh:sway:ICE_try_insert

This was encountered using the following versions:

cargo 1.72.1 (103a7ff2e 2023-08-15)
forc 0.47.0

brandonsurh avatar Nov 15 '23 00:11 brandonsurh

The error printed here is a bit misleading because we don't print all errors in a block.

The actual error here is related to deferred monomorphization of this function application.

I'll update back after I have more info.

vaivaswatha avatar Nov 25 '23 06:11 vaivaswatha

Just a little update, this bug is related to deferred monomorphization, which we are currently refactoring the compiler to be able to avoid, which should also fix this.

tritao avatar Jan 17 '24 17:01 tritao