Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
brandonsurh opened this issue Nov 15, 2023 · 2 comments
Closed
Assignees
Labels
bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged P: critical Should be looked at before anything else

Comments

@brandonsurh
Copy link
Contributor

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:
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
@IGI-111 IGI-111 added bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged labels Nov 15, 2023
@vaivaswatha
Copy link
Contributor

vaivaswatha commented Nov 25, 2023

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.

@tritao tritao self-assigned this Dec 4, 2023
@tritao tritao added the P: critical Should be looked at before anything else label Dec 4, 2023
@vaivaswatha vaivaswatha removed their assignment Jan 17, 2024
@tritao
Copy link
Contributor

tritao commented Jan 17, 2024

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 added a commit that referenced this issue Jul 1, 2024
## Description

This removes the deferred monomorphization feature as its not needed
anymore.

Have also tried removing the type check finalization feature, but that
is still needed for out-of-order declaration processing, we will remove
that soon once a more accurate AST resolving pass is added.

Fixes the following bugs:

#5279
#5854
#6099
#6171

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
@tritao tritao closed this as completed Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged P: critical Should be looked at before anything else
Projects
None yet
Development

No branches or pull requests

4 participants