Merge pull request #7178 from JRI98/fix_6240

Fix #6240
This commit is contained in:
Luke Boswell 2024-10-24 13:29:47 +11:00 committed by GitHub
commit 06996d88f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 88 additions and 3 deletions

View file

@ -4978,12 +4978,17 @@ pub fn with_hole<'a>(
}
}
let struct_index = match index {
Some(index) => index,
None => return runtime_error(env, "No such field in record"),
};
compile_struct_like_access(
env,
procs,
layout_cache,
field_layouts,
index.expect("field not in its own type") as _,
struct_index,
*loc_expr,
record_var,
hole,
@ -5076,12 +5081,17 @@ pub fn with_hole<'a>(
}
}
let tuple_index = match final_index {
Some(index) => index as u64,
None => return runtime_error(env, "No such index in tuple"),
};
compile_struct_like_access(
env,
procs,
layout_cache,
field_layouts,
final_index.expect("elem not in its own type") as u64,
tuple_index,
*loc_expr,
tuple_var,
hole,
@ -8055,7 +8065,10 @@ fn can_reuse_symbol<'a>(
.enumerate()
.find_map(|(current, (label, _, _))| (label == *field).then_some(current));
let struct_index = index.expect("field not in its own type");
let struct_index = match index {
Some(index) => index as u64,
None => return NotASymbol,
};
let struct_symbol = possible_reuse_symbol_or_specialize(
env,