Skip to content

Commit

Permalink
Made unreachable code diagnostics from errors into warnings.
Browse files Browse the repository at this point in the history
commit-id:59b91bc5
  • Loading branch information
orizi committed Aug 22, 2024
1 parent ce2718e commit 5384a8c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions crates/cairo-lang-lowering/src/diagnostic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use cairo_lang_defs::diagnostic_utils::StableLocation;
use cairo_lang_diagnostics::{
DiagnosticAdded, DiagnosticEntry, DiagnosticLocation, DiagnosticNote, DiagnosticsBuilder,
Severity,
};
use cairo_lang_semantic as semantic;
use cairo_lang_semantic::corelib::LiteralError;
Expand Down Expand Up @@ -84,6 +85,13 @@ impl DiagnosticEntry for LoweringDiagnostic {
}
}

fn severity(&self) -> Severity {
match self.kind {
LoweringDiagnosticKind::Unreachable { .. } => Severity::Warning,
_ => Severity::Error,
}
}

fn notes(&self, _db: &Self::DbType) -> &[DiagnosticNote] {
&self.location.notes
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cairo-lang-lowering/src/test_data/tests
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ foo
//! > semantic_diagnostics

//! > lowering_diagnostics
error: Unreachable code
warning: Unreachable code
--> lib.cairo:3:5
5;
^^
Expand Down

0 comments on commit 5384a8c

Please sign in to comment.