sway
sway copied to clipboard
Internal Compiler Error: Unable to resolve variable '__matched_value_1'.
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
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.
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.