mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Allow dbg expression inside string interpolation
This commit is contained in:
parent
220bb55048
commit
9dae102603
3 changed files with 74 additions and 1 deletions
|
@ -2478,13 +2478,19 @@ pub fn is_valid_interpolation(expr: &ast::Expr<'_>) -> bool {
|
|||
// Newlines are disallowed inside interpolation, and these all require newlines
|
||||
ast::Expr::DbgStmt(_, _)
|
||||
| ast::Expr::LowLevelDbg(_, _, _)
|
||||
| ast::Expr::Defs(_, _)
|
||||
| ast::Expr::Expect(_, _)
|
||||
| ast::Expr::When(_, _)
|
||||
| ast::Expr::Backpassing(_, _, _)
|
||||
| ast::Expr::SpaceBefore(_, _)
|
||||
| ast::Expr::Str(StrLiteral::Block(_))
|
||||
| ast::Expr::SpaceAfter(_, _) => false,
|
||||
// Desugared dbg expression
|
||||
ast::Expr::Defs(_, loc_ret) => match loc_ret.value {
|
||||
ast::Expr::LowLevelDbg(_, _, continuation) => {
|
||||
is_valid_interpolation(&continuation.value)
|
||||
}
|
||||
_ => false,
|
||||
},
|
||||
// These can contain subexpressions, so we need to recursively check those
|
||||
ast::Expr::Dbg(expr) => is_valid_interpolation(&expr.value),
|
||||
ast::Expr::Str(StrLiteral::Line(segments)) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue