mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
fix comment
This commit is contained in:
parent
e80f8a5114
commit
6890193917
1 changed files with 8 additions and 11 deletions
|
@ -1423,14 +1423,8 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
|
||||||
Reuse { .. } => todo!(),
|
Reuse { .. } => todo!(),
|
||||||
|
|
||||||
StructAtIndex {
|
StructAtIndex {
|
||||||
index,
|
index, structure, ..
|
||||||
structure,
|
|
||||||
field_layouts,
|
|
||||||
} => {
|
} => {
|
||||||
// if you hit this: we unwrap 1-element records, so instead of `x = StructAtIndex 0 y`
|
|
||||||
// you should substitute `x` with `y` in the remainder of the statement
|
|
||||||
debug_assert!(field_layouts.len() > 1, "one-element records are unwrapped");
|
|
||||||
|
|
||||||
// extract field from a record
|
// extract field from a record
|
||||||
match load_symbol_and_layout(scope, structure) {
|
match load_symbol_and_layout(scope, structure) {
|
||||||
(StructValue(argument), Layout::Struct(fields)) => {
|
(StructValue(argument), Layout::Struct(fields)) => {
|
||||||
|
@ -1479,10 +1473,13 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
|
||||||
|
|
||||||
env.builder.build_load(ptr, "load_rosetree_like")
|
env.builder.build_load(ptr, "load_rosetree_like")
|
||||||
}
|
}
|
||||||
(other, layout) => unreachable!(
|
(other, layout) => {
|
||||||
"can only index into struct layout\nValue: {:?}\nLayout: {:?}\nIndex: {:?}",
|
// potential cause: indexing into an unwrapped 1-element record/tag?
|
||||||
other, layout, index
|
unreachable!(
|
||||||
),
|
"can only index into struct layout\nValue: {:?}\nLayout: {:?}\nIndex: {:?}",
|
||||||
|
other, layout, index
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue