mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-03 10:23:20 +00:00
chore: add error msg for debug_assert!
This commit is contained in:
parent
0e070b3572
commit
1767df5de2
7 changed files with 21 additions and 9 deletions
|
@ -793,7 +793,10 @@ impl ASTLowerer {
|
|||
VarInfo::ILLEGAL.clone()
|
||||
});
|
||||
if let (Some(guard), Some(return_t)) = (guard, vi.t.mut_return_t()) {
|
||||
debug_assert!(self.module.context.subtype_of(return_t, &Type::Bool));
|
||||
debug_assert!(
|
||||
self.module.context.subtype_of(return_t, &Type::Bool),
|
||||
"{return_t} is not a subtype of Bool"
|
||||
);
|
||||
*return_t = guard;
|
||||
}
|
||||
let mut args = args.into_iter();
|
||||
|
@ -946,10 +949,13 @@ impl ASTLowerer {
|
|||
errs.extend(es);
|
||||
}
|
||||
if let Some(guard) = guard {
|
||||
debug_assert!(self
|
||||
.module
|
||||
.context
|
||||
.subtype_of(vi.t.return_t().unwrap(), &Type::Bool));
|
||||
debug_assert!(
|
||||
self.module
|
||||
.context
|
||||
.subtype_of(vi.t.return_t().unwrap(), &Type::Bool),
|
||||
"{} is not a subtype of Bool",
|
||||
vi.t.return_t().unwrap()
|
||||
);
|
||||
if let Some(ret_t) = vi.t.mut_return_t() {
|
||||
*ret_t = guard;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue