Skip to content

Commit

Permalink
Comment about let statement and types.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Oct 9, 2024
1 parent 5d1a2fa commit 204b70e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jit-compiler/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,10 @@ impl<'a, T: FieldElement> CodeGenerator<'a, T> {
.unwrap_or_default();

let (vars, code) = check_pattern(var_name, pattern)?;
// TODO if we want to explicitly specify the type, we need to exchange the non-captured
// parts by `()`.
// TODO At some point, Rustc could complain that it needs an explicit type
// for `{vars}`. We cannot use `ty` for that because the pattern translation
// results in `()` for parts that do not have any captured variables.
// The best way is probably to modify `check_pattern` to return the types
format!("let {vars} = (|{var_name}{ty}| {code})({value}).unwrap();",)
}
StatementInsideBlock::Expression(e) => format!("{};", self.format_expr(e)?),
Expand Down

0 comments on commit 204b70e

Please sign in to comment.