Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/ast/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ pub enum ExpressionKind {
Unquote(Box<Expression>),
Comptime(BlockExpression, Location),
Unsafe(UnsafeExpression),
AsTraitPath(AsTraitPath),
TypePath(TypePath),
AsTraitPath(Box<AsTraitPath>),
TypePath(Box<TypePath>),

// This variant is only emitted when inlining the result of comptime
// code. It is used to translate function values back into the AST while
Expand Down
4 changes: 1 addition & 3 deletions compiler/noirc_frontend/src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,7 @@ impl UnresolvedTypeExpression {
};
Ok(UnresolvedTypeExpression::BinaryOperation(lhs, op, rhs, expr.location))
}
ExpressionKind::AsTraitPath(path) => {
Ok(UnresolvedTypeExpression::AsTraitPath(Box::new(path)))
}
ExpressionKind::AsTraitPath(path) => Ok(UnresolvedTypeExpression::AsTraitPath(path)),
ExpressionKind::Parenthesized(expr) => Self::from_expr_helper(*expr),
_ => Err(expr),
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/elaborator/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ impl Elaborator<'_> {
(HirExpression::Error, Type::Error)
}
ExpressionKind::AsTraitPath(path) => {
return self.elaborate_as_trait_path(path);
return self.elaborate_as_trait_path(*path);
}
ExpressionKind::TypePath(path) => return self.elaborate_type_path(path),
ExpressionKind::TypePath(path) => return self.elaborate_type_path(*path),
};
let id = self.interner.push_expr(hir_expr);
self.interner.push_expr_location(id, expr.location);
Expand Down
8 changes: 4 additions & 4 deletions compiler/noirc_frontend/src/parser/parser/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,11 @@
let typ = self.parse_type_or_error();
if self.eat_keyword(Keyword::As) {
let as_trait_path = self.parse_as_trait_path_for_type_after_as_keyword(typ);
Some(ExpressionKind::AsTraitPath(as_trait_path))
Some(ExpressionKind::AsTraitPath(Box::new(as_trait_path)))
} else {
self.eat_or_error(Token::Greater);
let type_path = self.parse_type_path_expr_for_type(typ);
Some(ExpressionKind::TypePath(type_path))
Some(ExpressionKind::TypePath(Box::new(type_path)))
}
}

Expand Down Expand Up @@ -677,7 +677,7 @@
let typ = UnresolvedType { typ, location };

if self.at(Token::DoubleColon) {
Some(ExpressionKind::TypePath(self.parse_type_path_expr_for_type(typ)))
Some(ExpressionKind::TypePath(Box::new(self.parse_type_path_expr_for_type(typ))))
} else {
// This is the case when we find `Field` or `i32` but `::` doesn't follow it.
self.push_error(ParserErrorReason::ExpectedValueFoundBuiltInType { typ }, location);
Expand Down Expand Up @@ -710,7 +710,7 @@
/// = bool
/// | int
/// | str
/// | rawstr

Check warning on line 713 in compiler/noirc_frontend/src/parser/parser/expression.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (rawstr)
/// | fmtstr
/// | QuoteExpression
/// | ArrayExpression
Expand Down Expand Up @@ -882,7 +882,7 @@

self.push_error(ParserErrorReason::MissingAngleBrackets, location);

return Some(ExpressionKind::TypePath(type_path));
return Some(ExpressionKind::TypePath(Box::new(type_path)));
}

return Some(ExpressionKind::Literal(Literal::Unit));
Expand Down
4 changes: 2 additions & 2 deletions tooling/lsp/src/with_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,10 +676,10 @@ fn expression_kind_with_file(kind: ExpressionKind, file: FileId) -> ExpressionKi
})
}
ExpressionKind::AsTraitPath(as_trait_path) => {
ExpressionKind::AsTraitPath(as_trait_path_with_file(as_trait_path, file))
ExpressionKind::AsTraitPath(Box::new(as_trait_path_with_file(*as_trait_path, file)))
}
ExpressionKind::TypePath(type_path) => {
ExpressionKind::TypePath(type_path_with_file(type_path, file))
ExpressionKind::TypePath(Box::new(type_path_with_file(*type_path, file)))
}
ExpressionKind::Resolved(..)
| ExpressionKind::Interned(..)
Expand Down
4 changes: 2 additions & 2 deletions tooling/nargo_fmt/src/formatter/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,17 @@
false, // force multiple lines
));
}
ExpressionKind::Unsafe(unsafe_xpression) => {

Check warning on line 101 in tooling/nargo_fmt/src/formatter/expression.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (xpression)
group.group(self.format_unsafe_expression(
unsafe_xpression.block,

Check warning on line 103 in tooling/nargo_fmt/src/formatter/expression.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (xpression)
false, // force multiple lines
));
}
ExpressionKind::AsTraitPath(as_trait_path) => {
group.text(self.chunk(|formatter| formatter.format_as_trait_path(as_trait_path)));
group.text(self.chunk(|formatter| formatter.format_as_trait_path(*as_trait_path)));
}
ExpressionKind::TypePath(type_path) => {
group.group(self.format_type_path(type_path));
group.group(self.format_type_path(*type_path));
}
ExpressionKind::Resolved(..)
| ExpressionKind::Interned(..)
Expand Down Expand Up @@ -1915,9 +1915,9 @@

#[test]
fn format_method_call_chain_3() {
let src = "fn foo() { assert(p4_affine.eq(Gaffine::new(6890855772600357754907169075114257697580319025794532037257385534741338397365, 4338620300185947561074059802482547481416142213883829469920100239455078257889))); }";

Check warning on line 1918 in tooling/nargo_fmt/src/formatter/expression.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Gaffine)
let expected = "fn foo() {
assert(p4_affine.eq(Gaffine::new(

Check warning on line 1920 in tooling/nargo_fmt/src/formatter/expression.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Gaffine)
6890855772600357754907169075114257697580319025794532037257385534741338397365,
4338620300185947561074059802482547481416142213883829469920100239455078257889,
)));
Expand Down Expand Up @@ -1953,7 +1953,7 @@
fn format_nested_method_call_with_maximum_width_2() {
let src = "fn foo() {
assert(
p4_affine.eq(Gaffine::new(

Check warning on line 1956 in tooling/nargo_fmt/src/formatter/expression.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Gaffine)
6890855772600357754907169075114257697580319025794532037257385534741338397365,
4338620300185947561074059802482547481416142213883829469920100239455078257889,
)),
Expand All @@ -1961,7 +1961,7 @@
}
";
let expected = "fn foo() {
assert(p4_affine.eq(Gaffine::new(

Check warning on line 1964 in tooling/nargo_fmt/src/formatter/expression.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Gaffine)
6890855772600357754907169075114257697580319025794532037257385534741338397365,
4338620300185947561074059802482547481416142213883829469920100239455078257889,
)));
Expand Down
Loading