Skip to content

[IMP] Handle lambdas and other missing expressions#559

Open
mmahrouss wants to merge 1 commit intoalpha-references-fdafrom
alpha-process-lambdas-mdms
Open

[IMP] Handle lambdas and other missing expressions#559
mmahrouss wants to merge 1 commit intoalpha-references-fdafrom
alpha-process-lambdas-mdms

Conversation

@mmahrouss
Copy link
Collaborator

@mmahrouss mmahrouss commented Mar 3, 2026

No description provided.

@mmahrouss mmahrouss self-assigned this Mar 3, 2026
@mmahrouss mmahrouss force-pushed the alpha-process-lambdas-mdms branch 5 times, most recently from dee8e85 to 5be75f8 Compare March 5, 2026 13:58
@mmahrouss mmahrouss marked this pull request as ready for review March 5, 2026 14:07
@mmahrouss mmahrouss added the enhancement New feature or request label Mar 5, 2026
@mmahrouss mmahrouss added this to the 1.3.0 milestone Mar 5, 2026
@mmahrouss mmahrouss requested a review from fda-odoo March 5, 2026 14:10
if is_in_validation {
diagnostics.extend(diags);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we would gain a lot with that, but maybe we could bring back the break if not in validation?

if is_in_validation {
    //
} else if !all_values {
    break;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I could do that

}
}},
ExprOrIdent::Expr(Expr::Await(await_expr)) =>{
let (evaluations, diags) = Evaluation::eval_from_ast(session, &await_expr.value, parent.clone(), max_infer, false, required_dependencies);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't you check for is_in_validation here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I am actually using the evaluation in an await expression, it can be used somewhere.

// It needs adding a new function, ast_indexes, then add the variable inside
// I deem it currently unnecessary
Expr::Lambda(lambda_expr) => {
let sym = self.sym_stack.last().unwrap().borrow_mut().add_new_function(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unfortunately not perfectly right. As you create a 'lambda' function in the tree, it makes this symbol available later, so we could validate

a = lambda x: 5
print(lambda)

Even if syntax is ofc invalid, it means that this lambda function is available in the scope. And we have nothing that prevent using a reserved keyword in the scope. But I agree it will work in normal cases.

Copy link
Collaborator Author

@mmahrouss mmahrouss Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it is "<lambda>", so it would not be present in any python code, no ?

@mmahrouss mmahrouss force-pushed the alpha-process-lambdas-mdms branch from 5be75f8 to 3d888c9 Compare March 6, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants