fix: make::expr_paren() -> ParenExpr

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
This commit is contained in:
Prajwal S N 2025-04-11 02:40:03 +05:30
parent bee999863b
commit 92a7890814
No known key found for this signature in database
GPG key ID: 60701A603988FAC2
7 changed files with 13 additions and 12 deletions

View file

@ -659,7 +659,7 @@ pub fn expr_closure(pats: impl IntoIterator<Item = ast::Param>, expr: ast::Expr)
pub fn expr_field(receiver: ast::Expr, field: &str) -> ast::Expr {
expr_from_text(&format!("{receiver}.{field}"))
}
pub fn expr_paren(expr: ast::Expr) -> ast::Expr {
pub fn expr_paren(expr: ast::Expr) -> ast::ParenExpr {
expr_from_text(&format!("({expr})"))
}
pub fn expr_tuple(elements: impl IntoIterator<Item = ast::Expr>) -> ast::TupleExpr {

View file

@ -328,10 +328,7 @@ impl SyntaxFactory {
}
pub fn expr_paren(&self, expr: ast::Expr) -> ast::ParenExpr {
// FIXME: `make::expr_paren` should return a `ParenExpr`, not just an `Expr`
let ast::Expr::ParenExpr(ast) = make::expr_paren(expr.clone()).clone_for_update() else {
unreachable!()
};
let ast = make::expr_paren(expr.clone()).clone_for_update();
if let Some(mut mapping) = self.mappings() {
let mut builder = SyntaxMappingBuilder::new(ast.syntax().clone());