chore: improve subr type mismatch hint

This commit is contained in:
Shunsuke Shibayama 2023-09-13 16:35:54 +09:00
parent f0fdcaca9f
commit cfd0d259a0
3 changed files with 79 additions and 31 deletions

View file

@ -2338,6 +2338,10 @@ impl ASTLowerer {
.replace(impl_trait, class);
unverified_names.remove(name);
if !self.module.context.supertype_of(&replaced_decl_t, def_t) {
let hint = self
.module
.context
.get_simple_type_mismatch_hint(&replaced_decl_t, def_t);
errors.push(LowerError::trait_member_type_error(
self.cfg.input.clone(),
line!() as usize,
@ -2347,7 +2351,7 @@ impl ASTLowerer {
impl_trait,
&decl_vi.t,
&vi.t,
None,
hint,
));
}
} else {