-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
NoMatchingImplFound
in comptime code only (#5617)
# Description ## Problem\* Resolves #5615 ## Summary\* Fixes a difference in how the interpreter and monomorphizer handle generics - further explained in the linked issue. ## Additional Context To fix this I saved the generics on each link in the call stack and restored them after the function finishes. This wasn't good enough however - doing this too early mean losing intermediate bindings in `instantiation_bindings`. So I needed to add some `follow_bindings` there as well. The `impl_bindings` all bind the trait impl to the trait itself so follow_bindings there is unneeded. ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
Showing
3 changed files
with
80 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "regression_5615" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = ">=0.32.0" | ||
|
||
[dependencies] |
12 changes: 12 additions & 0 deletions
12
test_programs/execution_success/regression_5615/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use std::collections::umap::UHashMap; | ||
use std::hash::BuildHasherDefault; | ||
use std::hash::poseidon2::Poseidon2Hasher; | ||
|
||
unconstrained fn main() { | ||
comptime | ||
{ | ||
let mut map: UHashMap<u32, Field, BuildHasherDefault<Poseidon2Hasher>> = UHashMap::default(); | ||
|
||
map.insert(1, 2); | ||
} | ||
} |