mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Remove inaccurate debug assertion in IR gen
There might be more symbols than field layouts when restructuring a record if the record is a newtype. Closes #4759
This commit is contained in:
parent
6de36f29f9
commit
2a9e0583bc
3 changed files with 27 additions and 3 deletions
|
@ -4963,9 +4963,6 @@ pub fn with_hole<'a>(
|
||||||
_ => arena.alloc([record_layout]),
|
_ => arena.alloc([record_layout]),
|
||||||
};
|
};
|
||||||
|
|
||||||
debug_assert_eq!(field_layouts.len(), symbols.len());
|
|
||||||
debug_assert_eq!(fields.len(), symbols.len());
|
|
||||||
|
|
||||||
if symbols.len() == 1 {
|
if symbols.len() == 1 {
|
||||||
// TODO we can probably special-case this more, skippiing the generation of
|
// TODO we can probably special-case this more, skippiing the generation of
|
||||||
// UpdateExisting
|
// UpdateExisting
|
||||||
|
|
13
crates/compiler/test_mono/generated/issue_4759.txt
Normal file
13
crates/compiler/test_mono/generated/issue_4759.txt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
procedure Test.1 (Test.2):
|
||||||
|
dec Test.2;
|
||||||
|
let Test.7 : Str = "ux";
|
||||||
|
let Test.8 : Str = "uy";
|
||||||
|
let Test.6 : {Str, Str} = Struct {Test.7, Test.8};
|
||||||
|
ret Test.6;
|
||||||
|
|
||||||
|
procedure Test.0 ():
|
||||||
|
let Test.10 : Str = "x";
|
||||||
|
let Test.11 : Str = "y";
|
||||||
|
let Test.9 : {Str, Str} = Struct {Test.10, Test.11};
|
||||||
|
let Test.3 : {Str, Str} = CallByName Test.1 Test.9;
|
||||||
|
ret Test.3;
|
|
@ -2845,3 +2845,17 @@ fn compose_recursive_lambda_set_productive_nullable_wrapped() {
|
||||||
"#
|
"#
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[mono_test]
|
||||||
|
fn issue_4759() {
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
app "test" provides [main] to "./platform"
|
||||||
|
|
||||||
|
main =
|
||||||
|
update { a : { x : "x", y: "y" } }
|
||||||
|
|
||||||
|
update = \state -> { state & a : { x : "ux", y: "uy" } }
|
||||||
|
"#
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue