diff --git a/crates/cairo-lang-semantic/src/expr/compute.rs b/crates/cairo-lang-semantic/src/expr/compute.rs index aaca3660590..bce2e180f06 100644 --- a/crates/cairo-lang-semantic/src/expr/compute.rs +++ b/crates/cairo-lang-semantic/src/expr/compute.rs @@ -292,7 +292,7 @@ fn compute_expr_inline_macro_semantic( let result = macro_plugin.generate_code(syntax_db, syntax); for diagnostic in result.diagnostics { - ctx.diagnostics.report(syntax, PluginDiagnostic(diagnostic)); + ctx.diagnostics.report_by_ptr(diagnostic.stable_ptr, PluginDiagnostic(diagnostic)); } let Some(code) = result.code else { diff --git a/crates/cairo-lang-semantic/src/expr/test_data/inline_macros b/crates/cairo-lang-semantic/src/expr/test_data/inline_macros index 4977f36fa1c..36bb6c7e7a5 100644 --- a/crates/cairo-lang-semantic/src/expr/test_data/inline_macros +++ b/crates/cairo-lang-semantic/src/expr/test_data/inline_macros @@ -33,9 +33,9 @@ const e: felt252 = consteval_int![4 + 5]; ^ error: Plugin diagnostic: Unsupported expression in consteval_int macro - --> lib.cairo:1:20 + --> lib.cairo:1:35 const a: felt252 = consteval_int!(func_call(24)); - ^***************************^ + ^***********^ error: Inline macro `consteval_int` failed. --> lib.cairo:1:20 @@ -48,9 +48,9 @@ const a: felt252 = consteval_int!(func_call(24)); ^***************************^ error: Plugin diagnostic: Unsupported expression in consteval_int macro - --> lib.cairo:3:20 + --> lib.cairo:3:35 const b: felt252 = consteval_int!('some string'); - ^***************************^ + ^***********^ error: Inline macro `consteval_int` failed. --> lib.cairo:3:20 @@ -63,9 +63,9 @@ const b: felt252 = consteval_int!('some string'); ^***************************^ error: Plugin diagnostic: Unsupported unary operator in consteval_int macro - --> lib.cairo:5:20 + --> lib.cairo:5:35 const c: felt252 = consteval_int!(*24); - ^*****************^ + ^*^ error: Inline macro `consteval_int` failed. --> lib.cairo:5:20 @@ -78,9 +78,9 @@ const c: felt252 = consteval_int!(*24); ^*****************^ error: Plugin diagnostic: Unsupported unary operator in consteval_int macro - --> lib.cairo:7:20 + --> lib.cairo:7:35 const d: felt252 = consteval_int!(~24); - ^*****************^ + ^*^ error: Inline macro `consteval_int` failed. --> lib.cairo:7:20 @@ -93,9 +93,9 @@ const d: felt252 = consteval_int!(~24); ^*****************^ error: Plugin diagnostic: Unsupported binary operator in consteval_int macro - --> lib.cairo:9:20 + --> lib.cairo:9:35 const e: felt252 = consteval_int!(234 < 5); - ^*********************^ + ^*****^ error: Inline macro `consteval_int` failed. --> lib.cairo:9:20 @@ -108,9 +108,9 @@ const e: felt252 = consteval_int!(234 < 5); ^*********************^ error: Plugin diagnostic: Macro `consteval_int` does not support this bracket type. - --> lib.cairo:11:20 + --> lib.cairo:11:34 const e: felt252 = consteval_int![4 + 5]; - ^*******************^ + ^ error: Inline macro `consteval_int` failed. --> lib.cairo:11:20 @@ -123,9 +123,9 @@ const e: felt252 = consteval_int![4 + 5]; ^*******************^ error: Plugin diagnostic: Macro `consteval_int` does not support this bracket type. - --> lib.cairo:13:20 + --> lib.cairo:13:34 const f: felt252 = consteval_int!{4 + 5}; - ^*******************^ + ^ error: Inline macro `consteval_int` failed. --> lib.cairo:13:20 @@ -162,9 +162,9 @@ foo //! > expected_diagnostics error: Plugin diagnostic: Macro `array` does not support this bracket type. - --> lib.cairo:2:13 + --> lib.cairo:2:19 let x = array!(0); - ^*******^ + ^ error: Inline macro `array` failed. --> lib.cairo:2:13 @@ -207,9 +207,9 @@ foo //! > expected_diagnostics error: Plugin diagnostic: Macro `format` does not support this bracket type. - --> lib.cairo:5:4 + --> lib.cairo:5:11 format!["{}", ba]; - ^***************^ + ^ error: Inline macro `format` failed. --> lib.cairo:5:4 @@ -277,9 +277,9 @@ foo //! > expected_diagnostics error: Plugin diagnostic: Macro `print` does not support this bracket type. - --> lib.cairo:5:4 + --> lib.cairo:5:10 print!["{}", ba]; - ^**************^ + ^ error: Inline macro `print` failed. --> lib.cairo:5:4 @@ -347,9 +347,9 @@ foo //! > expected_diagnostics error: Plugin diagnostic: Macro `println` does not support this bracket type. - --> lib.cairo:5:4 + --> lib.cairo:5:12 println!["{}", ba]; - ^****************^ + ^ error: Inline macro `println` failed. --> lib.cairo:5:4 diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics index 4005d2c1218..f76909615ad 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics @@ -6374,9 +6374,9 @@ mod component3 { //! > expected_diagnostics error: Plugin diagnostic: The first argument of `get_dep_component_mut` macro must have only a `ref` modifier. - --> lib.cairo:53:13 + --> lib.cairo:53:36 get_dep_component_mut!(Comp1, self).foo1(); - ^*********************************^ + ^***^ error: Inline macro `get_dep_component_mut` failed. --> lib.cairo:53:13 @@ -6404,9 +6404,9 @@ error: Method `foo1` not found on type "test::component2::ComponentState:: lib.cairo:57:13 + --> lib.cairo:57:36 get_dep_component_mut!(self, Comp1).foo1(); - ^*********************************^ + ^**^ error: Inline macro `get_dep_component_mut` failed. --> lib.cairo:57:13 @@ -6414,9 +6414,9 @@ error: Inline macro `get_dep_component_mut` failed. ^*********************************^ error: Plugin diagnostic: The first argument of `get_dep_component_mut` macro must have only a `ref` modifier. - --> lib.cairo:58:13 + --> lib.cairo:58:40 get_dep_component_mut!(mut self, Comp1).foo1(); - ^*************************************^ + ^**^ error: Inline macro `get_dep_component_mut` failed. --> lib.cairo:58:13 @@ -6424,9 +6424,9 @@ error: Inline macro `get_dep_component_mut` failed. ^*************************************^ error: Plugin diagnostic: The first argument of `get_dep_component_mut` macro must have only a `ref` modifier. - --> lib.cairo:59:13 + --> lib.cairo:59:44 get_dep_component_mut!(ref ref self, Comp1).foo1(); - ^*****************************************^ + ^**^ error: Inline macro `get_dep_component_mut` failed. --> lib.cairo:59:13 @@ -6434,9 +6434,9 @@ error: Inline macro `get_dep_component_mut` failed. ^*****************************************^ error: Plugin diagnostic: The first argument of `get_dep_component_mut` macro must have only a `ref` modifier. - --> lib.cairo:60:13 + --> lib.cairo:60:44 get_dep_component_mut!(ref mut self, Comp1).foo1(); - ^*****************************************^ + ^**^ error: Inline macro `get_dep_component_mut` failed. --> lib.cairo:60:13