Sitelet https://github.com/starkware-libs/cairo/commit/cbb5748be1e2ad1cd7b44f887107af526221f417
Skip to content

Commit cbb5748

Browse files
committed
bugfix(plugins): Made compile_error! diag not include "s.
1 parent 422de73 commit cbb5748

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎crates/cairo-lang-plugins/src/plugins/compile_error.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ impl MacroPlugin for CompileErrorPlugin {
3838
item_ast_ptr
3939
);
4040
PluginResult::diagnostic_only(
41-
if let ast::Expr::String(err_message) = compilation_error_arg {
42-
PluginDiagnostic::error(item_ast_ptr, err_message.text(db).to_string(db))
41+
if let ast::Expr::String(err_message_arg) = &compilation_error_arg
42+
&& let Some(err_message) = err_message_arg.string_value(db)
43+
{
44+
PluginDiagnostic::error(item_ast_ptr, err_message)
4345
} else {
4446
PluginDiagnostic::error_with_inner_span(
4547
db,

‎crates/cairo-lang-plugins/src/test_data/compile_error‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ compile_error!("message", "extra");
3333
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3434

3535

36-
error: "error message"
36+
error: error message
3737
--> test_src/lib.cairo:7:1
3838
compile_error!("error message");
3939
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -58,7 +58,7 @@ compile_error!("ignore");
5858
//! > expanded_cairo_code
5959

6060
//! > expected_diagnostics
61-
error: "show"
61+
error: show
6262
--> test_src/lib.cairo:1:1-2:23
6363
#[cfg(noignore)]
6464
_^

0 commit comments

Comments
 (0)