mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 15:03:46 +00:00
Canonicalize the pattern in annotations
This commit is contained in:
parent
2331aa1d77
commit
408379f8d3
8 changed files with 86 additions and 3 deletions
|
@ -151,6 +151,24 @@ fn round_trip_once(input: Input<'_>, options: Options) -> Option<String> {
|
|||
return Some("Formatting not stable".to_string());
|
||||
}
|
||||
|
||||
let text = input.as_str();
|
||||
let res = std::panic::catch_unwind(|| {
|
||||
let new_arena = Bump::new();
|
||||
actual.canonicalize(&new_arena, text);
|
||||
});
|
||||
|
||||
if let Err(e) = res {
|
||||
if options.minimize_full_error {
|
||||
if let Some(s) = e.downcast_ref::<&'static str>() {
|
||||
return Some(s.to_string());
|
||||
}
|
||||
if let Some(s) = e.downcast_ref::<String>() {
|
||||
return Some(s.clone());
|
||||
}
|
||||
}
|
||||
return Some("Panic during canonicalization".to_string());
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue