From fda485cdf9d7d7e6442dbb1eaacb51c3a40bf016 Mon Sep 17 00:00:00 2001 From: Shunsuke Shibayama Date: Sun, 11 Dec 2022 20:03:43 +0900 Subject: [PATCH] Avoid panic in Params::loc --- compiler/erg_compiler/hir.rs | 2 +- compiler/erg_parser/ast.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/erg_compiler/hir.rs b/compiler/erg_compiler/hir.rs index eb6f22c5..c039aed8 100644 --- a/compiler/erg_compiler/hir.rs +++ b/compiler/erg_compiler/hir.rs @@ -1610,7 +1610,7 @@ impl Locational for Params { } else if !self.defaults.is_empty() { Location::concat(&self.defaults[0], self.defaults.last().unwrap()) } else { - panic!() + Location::Unknown } } } diff --git a/compiler/erg_parser/ast.rs b/compiler/erg_parser/ast.rs index 99fcf5e8..013a97bc 100644 --- a/compiler/erg_parser/ast.rs +++ b/compiler/erg_parser/ast.rs @@ -2959,7 +2959,7 @@ impl Locational for Params { } else if !self.defaults.is_empty() { Location::concat(&self.defaults[0], self.defaults.last().unwrap()) } else { - panic!() + Location::Unknown } } }