forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fix to type inference with placeholder types for nested types (Fu…
…elLabs#3764) This PR fixes a bug relating to type substitution for placeholder types. The fix was to update the code path for placeholder type substitution from "no substitution" to "substitute if a match is found". This PR also changes the internal data structure of the `TypeMapping` type from a `Vec<(TypeId, TypeId)>` to a `BTreeMap<TypeId, TypeId>` because during debugging I noticed that there were duplicates and this could lead to wasted compute. Closes FuelLabs#3741 Co-authored-by: emilyaherbert <[email protected]>
- Loading branch information
1 parent
8f6b21d
commit a2ccf3c
Showing
3 changed files
with
55 additions
and
9 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
9 changes: 9 additions & 0 deletions
9
test/src/e2e_vm_tests/test_programs/should_pass/language/generic_type_inference/src/utils.sw
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,9 @@ | ||
library utils; | ||
|
||
pub fn vec_from(vals: [u32; 3]) -> Vec<u32> { | ||
let mut vec = Vec::new(); | ||
vec.push(vals[0]); | ||
vec.push(vals[1]); | ||
vec.push(vals[2]); | ||
vec | ||
} |