diff --git a/crates/cairo-lang-plugins/src/plugins/consteval_int.rs b/crates/cairo-lang-plugins/src/plugins/consteval_int.rs index 5bf5705af71..742695df51e 100644 --- a/crates/cairo-lang-plugins/src/plugins/consteval_int.rs +++ b/crates/cairo-lang-plugins/src/plugins/consteval_int.rs @@ -31,9 +31,9 @@ impl MacroPlugin for ConstevalIntMacroPlugin { } } -// Rewrite a constant declaration that contains a consteval_int macro -// into a constant declaration with the computed value, -// e.g. `const a: felt252 = consteval_int!(2 * 2 * 2);` into `const a: felt252 = 8;`. +/// Rewrite a constant declaration that contains a consteval_int macro +/// into a constant declaration with the computed value, +/// e.g. `const a: felt252 = consteval_int!(2 * 2 * 2);` into `const a: felt252 = 8;`. fn handle_constant(db: &dyn SyntaxGroup, constant_ast: &ast::ItemConstant) -> PluginResult { let constant_value = constant_ast.value(db); if let ast::Expr::InlineMacro(inline_macro) = constant_value { @@ -68,7 +68,7 @@ fn handle_constant(db: &dyn SyntaxGroup, constant_ast: &ast::ItemConstant) -> Pl PluginResult::default() } -// Extract the actual expression from the consteval_int macro, or fail with diagnostics. +/// Extract the actual expression from the consteval_int macro, or fail with diagnostics. fn extract_consteval_macro_expression( db: &dyn SyntaxGroup, macro_ast: &ast::ExprInlineMacro, @@ -94,8 +94,8 @@ fn extract_consteval_macro_expression( } } -// Compute the actual value of an integer expression, or fail with diagnostics. -// This computation handles arbitrary integers, unlike regular Cairo math. +/// Compute the actual value of an integer expression, or fail with diagnostics. +/// This computation handles arbitrary integers, unlike regular Cairo math. fn compute_constant_expr( db: &dyn SyntaxGroup, value: &ast::Expr, diff --git a/tests/bug_samples/issue3130.cairo b/tests/bug_samples/issue3130.cairo index 12493e3d487..17f8ecec707 100644 --- a/tests/bug_samples/issue3130.cairo +++ b/tests/bug_samples/issue3130.cairo @@ -1,7 +1,7 @@ -const a: felt252 = (4 + 2 * 3) * 256; -const b: felt252 = 0xff & (24 + 5 * 2); -const c: felt252 = -0xff & (24 + 5 * 2); -const d: felt252 = 0xff | (24 + 5 * 2); +const a: felt252 = consteval_int!((4 + 2 * 3) * 256); +const b: felt252 = consteval_int!(0xff & (24 + 5 * 2)); +const c: felt252 = consteval_int!(-0xff & (24 + 5 * 2)); +const d: felt252 = consteval_int!(0xff | (24 + 5 * 2)); #[test] fn main() {} diff --git a/tests/bug_samples/lib.cairo b/tests/bug_samples/lib.cairo index 5e7ea79eb43..a65999025af 100644 --- a/tests/bug_samples/lib.cairo +++ b/tests/bug_samples/lib.cairo @@ -16,6 +16,7 @@ mod issue2939; mod issue2961; mod issue2964; mod issue2995; +mod issue3130; mod issue3153; mod issue3192; mod issue3211;