mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-03 17:58:17 +00:00
fix: don't check context of field accesses' target (#1039)
This commit is contained in:
parent
6d36195964
commit
1c157adadf
1 changed files with 8 additions and 3 deletions
|
@ -182,15 +182,20 @@ impl<'a> PostTypeChecker<'a> {
|
|||
None
|
||||
};
|
||||
|
||||
let contextual_self_ty =
|
||||
self.check_cursor(classify_context(node.clone(), None), context_ty);
|
||||
let can_penetrate_context = !(matches!(context.kind(), SyntaxKind::FieldAccess) && {
|
||||
let field_access = context.cast::<ast::FieldAccess>()?;
|
||||
field_access.field().span() == node.span()
|
||||
});
|
||||
|
||||
let contextual_self_ty = can_penetrate_context
|
||||
.then(|| self.check_cursor(classify_context(node.clone(), None), context_ty));
|
||||
crate::log_debug_ct!(
|
||||
"post check(res): {:?}::{:?} -> {self_ty:?}, {contextual_self_ty:?}",
|
||||
context.kind(),
|
||||
node.kind(),
|
||||
);
|
||||
|
||||
Ty::union(self_ty, contextual_self_ty)
|
||||
Ty::union(self_ty, contextual_self_ty.flatten())
|
||||
}
|
||||
|
||||
fn check_or(&mut self, node: &LinkedNode, ty: Option<Ty>) -> Option<Ty> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue