chore: add hir::Methods

This commit is contained in:
Shunsuke Shibayama 2023-11-05 01:18:32 +09:00
parent 234fa3ffeb
commit 21c937e633
14 changed files with 109 additions and 64 deletions

View file

@ -1295,7 +1295,7 @@ impl Context {
}
}
hir::Expr::ClassDef(class_def) => {
for def in class_def.methods.iter_mut() {
for def in class_def.all_methods_mut() {
self.resolve_expr_t(def, qnames)?;
}
Ok(())

View file

@ -3405,7 +3405,7 @@ impl Context {
candidates.collect()
}
pub(crate) fn is_class(&self, typ: &Type) -> bool {
pub fn is_class(&self, typ: &Type) -> bool {
match typ {
Type::And(_l, _r) => false,
Type::Never => true,
@ -3429,7 +3429,7 @@ impl Context {
}
}
pub(crate) fn is_trait(&self, typ: &Type) -> bool {
pub fn is_trait(&self, typ: &Type) -> bool {
match typ {
Type::Never => false,
Type::FreeVar(fv) if fv.is_linked() => self.is_class(&fv.crack()),