feat: IDE features for primitive tuple fields

This commit is contained in:
Lukas Wirth 2024-01-06 15:04:58 +01:00
parent 59457091bb
commit 963568b46f
25 changed files with 242 additions and 96 deletions

View file

@ -40,7 +40,7 @@ use crate::{
Access, Adjust, Adjustment, AutoBorrow, BindingMode, BuiltinAttr, Callable, ConstParam, Crate,
DeriveHelper, Field, Function, HasSource, HirFileId, Impl, InFile, Label, LifetimeParam, Local,
Macro, Module, ModuleDef, Name, OverloadedDeref, Path, ScopeDef, Struct, ToolModule, Trait,
Type, TypeAlias, TypeParam, VariantDef,
TupleField, Type, TypeAlias, TypeParam, VariantDef,
};
pub enum DescendPreference {
@ -1085,14 +1085,14 @@ impl<'db> SemanticsImpl<'db> {
self.analyze(call.syntax())?.resolve_method_call_as_callable(self.db, call)
}
pub fn resolve_field(&self, field: &ast::FieldExpr) -> Option<Field> {
pub fn resolve_field(&self, field: &ast::FieldExpr) -> Option<Either<Field, TupleField>> {
self.analyze(field.syntax())?.resolve_field(self.db, field)
}
pub fn resolve_field_fallback(
&self,
field: &ast::FieldExpr,
) -> Option<Either<Field, Function>> {
) -> Option<Either<Either<Field, TupleField>, Function>> {
self.analyze(field.syntax())?.resolve_field_fallback(self.db, field)
}