support optional suffied last def

This commit is contained in:
Luke Boswell 2024-04-12 14:39:12 +10:00
parent 4625926486
commit c32fa5b600
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
17 changed files with 603 additions and 269 deletions

View file

@ -623,6 +623,9 @@ pub fn canonicalize_expr<'a>(
use Expr::*;
let (expr, output) = match expr {
&ast::Expr::EmptyDefsFinal() => {
internal_error!("EmptyDefsFinal should have been desugared")
}
&ast::Expr::Num(str) => {
let answer = num_expr_from_result(var_store, finish_parsing_num(str), region, env);
@ -2427,7 +2430,8 @@ pub fn is_valid_interpolation(expr: &ast::Expr<'_>) -> bool {
| ast::Expr::IngestedFile(_, _)
| ast::Expr::SpaceBefore(_, _)
| ast::Expr::Str(StrLiteral::Block(_))
| ast::Expr::SpaceAfter(_, _) => false,
| ast::Expr::SpaceAfter(_, _)
| ast::Expr::EmptyDefsFinal() => false,
// These can contain subexpressions, so we need to recursively check those
ast::Expr::Str(StrLiteral::Line(segments)) => {
segments.iter().all(|segment| match segment {