merge from main

This commit is contained in:
Shunsuke Shibayama 2023-05-28 10:39:54 +09:00
parent 6b8e7314f2
commit 8c983c3714
4 changed files with 34 additions and 124 deletions

View file

@ -809,12 +809,20 @@ impl ASTLowerer {
self.errs.extend(errs);
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),
"{return_t} is not a subtype of Bool"
);
*return_t = guard;
if let Some(guard) = guard {
if let Some(return_t) = vi.t.mut_return_t() {
debug_assert!(
self.module.context.subtype_of(return_t, &Type::Bool),
"{return_t} is not a subtype of Bool"
);
*return_t = guard;
} else if let Some(mut return_t) = vi.t.tyvar_mut_return_t() {
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();
let lhs = args.next().unwrap().expr;
@ -975,6 +983,8 @@ impl ASTLowerer {
);
if let Some(ret_t) = vi.t.mut_return_t() {
*ret_t = guard;
} else if let Some(mut ref_t) = vi.t.tyvar_mut_return_t() {
*ref_t = guard;
}
}
let attr_name = if let Some(attr_name) = call.attr_name {