mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
add comment
This commit is contained in:
parent
ff2b5cf6f0
commit
830dd03b30
2 changed files with 22 additions and 2 deletions
|
@ -2394,7 +2394,27 @@ fn get_lookup_symbols(expr: &Expr, var_store: &mut VarStore) -> Vec<(Symbol, Var
|
|||
symbols
|
||||
}
|
||||
|
||||
pub fn convert_toplevel_expect(mut loc_expr: Loc<Expr>) -> Loc<Expr> {
|
||||
/// Here we transform
|
||||
///
|
||||
/// > expect
|
||||
/// > a = 1
|
||||
/// > b = 2
|
||||
/// >
|
||||
/// > a == b
|
||||
///
|
||||
/// into
|
||||
///
|
||||
/// > a = 1
|
||||
/// > b = 2
|
||||
/// >
|
||||
/// > expect a == b
|
||||
/// >
|
||||
/// > emptyrecord
|
||||
///
|
||||
/// This is supposed to happen just before monomorphization:
|
||||
/// all type errors and such are generated from the user source,
|
||||
/// but this transformation means that we don't need special codegen for toplevel expects
|
||||
pub fn toplevel_expect_to_inline_expect(mut loc_expr: Loc<Expr>) -> Loc<Expr> {
|
||||
enum StoredDef {
|
||||
NonRecursive(Region, Box<Def>),
|
||||
Recursive(Region, Vec<Def>, IllegalCycleMark),
|
||||
|
|
|
@ -4817,7 +4817,7 @@ fn build_pending_specializations<'a>(
|
|||
);
|
||||
}
|
||||
|
||||
let body = roc_can::expr::convert_toplevel_expect(body);
|
||||
let body = roc_can::expr::toplevel_expect_to_inline_expect(body);
|
||||
|
||||
let proc = PartialProc {
|
||||
annotation: expr_var,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue