-
-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace panic! with internal-error! in ast crate #4297
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1931,6 +1931,7 @@ pub mod test_constrain { | |
use bumpalo::Bump; | ||
use roc_can::expected::Expected; | ||
use roc_collections::all::MutMap; | ||
use roc_error_macros::internal_error; | ||
use roc_module::{ | ||
ident::Lowercase, | ||
symbol::{IdentIds, Interns, ModuleIds, Symbol}, | ||
|
@@ -2064,7 +2065,7 @@ pub mod test_constrain { | |
|
||
assert_eq!(actual_str, expected_str); | ||
} | ||
Err(e) => panic!("syntax error {:?}", e), | ||
Err(e) => internal_error!("syntax error {:?}", e), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not very fimilare with this code, but I wonder if this is a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think using |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,13 +115,13 @@ impl Pools { | |
pub fn get_mut(&mut self, rank: Rank) -> &mut Vec<Variable> { | ||
self.0 | ||
.get_mut(rank.into_usize()) | ||
.unwrap_or_else(|| panic!("Compiler bug: could not find pool at rank {}", rank)) | ||
.unwrap_or_else(|| internal_error!("could not find pool at rank {}", rank)) | ||
} | ||
|
||
pub fn get(&self, rank: Rank) -> &Vec<Variable> { | ||
self.0 | ||
.get(rank.into_usize()) | ||
.unwrap_or_else(|| panic!("Compiler bug: could not find pool at rank {}", rank)) | ||
self.0.get(rank.into_usize()).unwrap_or_else(|| { | ||
internal_error!("Compiler bug: could not find pool at rank {}", rank) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: remove |
||
}) | ||
} | ||
|
||
pub fn iter(&self) -> std::slice::Iter<'_, Vec<Variable>> { | ||
|
@@ -131,7 +131,7 @@ impl Pools { | |
pub fn split_last(&self) -> (&Vec<Variable>, &[Vec<Variable>]) { | ||
self.0 | ||
.split_last() | ||
.unwrap_or_else(|| panic!("Attempted to split_last() on non-empty Pools")) | ||
.unwrap_or_else(|| internal_error!("Attempted to split_last() on non-empty Pools")) | ||
} | ||
|
||
pub fn extend_to(&mut self, n: usize) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this was a slight misunderstanding. I meant
todo!("canonicalize malformed record field")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes of course.