[ty] Do not re-export ide_support attributes from types (#20769)

## Summary

The `types` module currently re-exports a lot of functions and data
types from `types::ide_support`. One of these is called `Member`, a name
that is overloaded several times already. And I'd like to add one more
`Member` struct soon. Making the whole `ide_support` module public seems
cleaner to me, anyway.

## Test Plan

Pure refactoring.
This commit is contained in:
David Peter 2025-10-08 17:45:28 +02:00 committed by GitHub
parent 3771f1567c
commit 697998f836
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 15 additions and 17 deletions

View file

@ -12,6 +12,7 @@ use crate::semantic_index::definition::Definition;
use crate::semantic_index::scope::FileScopeId;
use crate::semantic_index::semantic_index;
use crate::types::ide_support::all_declarations_and_bindings;
use crate::types::ide_support::{Member, all_members};
use crate::types::{Type, binding_type, infer_scope_types};
pub struct SemanticModel<'db> {
@ -193,7 +194,7 @@ impl<'db> SemanticModel<'db> {
let builtin = module.is_known(self.db, KnownModule::Builtins);
let mut completions = vec![];
for crate::types::Member { name, ty } in crate::types::all_members(self.db, ty) {
for Member { name, ty } in all_members(self.db, ty) {
completions.push(Completion {
name,
ty: Some(ty),
@ -226,7 +227,7 @@ impl<'db> SemanticModel<'db> {
/// Returns completions for symbols available in a `object.<CURSOR>` context.
pub fn attribute_completions(&self, node: &ast::ExprAttribute) -> Vec<Completion<'db>> {
let ty = node.value.inferred_type(self);
crate::types::all_members(self.db, ty)
all_members(self.db, ty)
.into_iter()
.map(|member| Completion {
name: member.name,

View file

@ -55,12 +55,6 @@ use crate::types::generics::{
GenericContext, PartialSpecialization, Specialization, bind_typevar, typing_self,
walk_generic_context,
};
pub use crate::types::ide_support::{
CallSignatureDetails, Member, MemberWithDefinition, all_members, call_signature_details,
definition_kind_for_name, definitions_for_attribute, definitions_for_imported_symbol,
definitions_for_keyword_argument, definitions_for_name, find_active_signature_from_details,
inlay_hint_function_argument_details,
};
use crate::types::infer::infer_unpack_types;
use crate::types::mro::{Mro, MroError, MroIterator};
pub(crate) use crate::types::narrow::infer_narrowing_constraint;
@ -89,7 +83,7 @@ mod display;
mod enums;
mod function;
mod generics;
pub(crate) mod ide_support;
pub mod ide_support;
mod infer;
mod instance;
mod mro;

View file

@ -74,6 +74,7 @@ use crate::types::diagnostic::{
};
use crate::types::display::DisplaySettings;
use crate::types::generics::GenericContext;
use crate::types::ide_support::all_members;
use crate::types::narrow::ClassInfoConstraintFunction;
use crate::types::signatures::{CallableSignature, Signature};
use crate::types::visitor::any_over_type;
@ -82,7 +83,7 @@ use crate::types::{
ClassLiteral, ClassType, DeprecatedInstance, DynamicType, FindLegacyTypeVarsVisitor,
HasRelationToVisitor, IsEquivalentVisitor, KnownClass, KnownInstanceType, NormalizedVisitor,
SpecialFormType, TrackedConstraintSet, Truthiness, Type, TypeMapping, TypeRelation,
UnionBuilder, all_members, binding_type, todo_type, walk_signature,
UnionBuilder, binding_type, todo_type, walk_signature,
};
use crate::{Db, FxOrderSet, ModuleName, resolve_module};