Skip to content

Commit 96d9e09

Browse files
authored
[ty] Move the deferred submodule inside infer/builder (#24368)
1 parent 130da28 commit 96d9e09

10 files changed

Lines changed: 13 additions & 11 deletions

File tree

crates/ty_python_semantic/src/types/infer.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ pub(super) use comparisons::UnsupportedComparisonError;
6363

6464
mod builder;
6565
mod comparisons;
66-
mod deferred;
6766
#[cfg(test)]
6867
mod tests;
6968

crates/ty_python_semantic/src/types/infer/builder.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use smallvec::SmallVec;
2121
use strum::IntoEnumIterator;
2222
use ty_module_resolver::{KnownModule, ModuleName, resolve_module};
2323

24-
use super::deferred;
2524
use super::{
2625
DefinitionInference, DefinitionInferenceExtra, ExpressionInference, ExpressionInferenceExtra,
2726
FunctionDecoratorInference, InferenceRegion, ScopeInference, ScopeInferenceExtra,
@@ -130,6 +129,7 @@ mod function;
130129
mod imports;
131130
mod named_tuple;
132131
mod paramspec_validation;
132+
mod post_inference;
133133
mod subscript;
134134
mod type_expression;
135135
mod typed_dict;
@@ -263,7 +263,7 @@ pub(super) struct TypeInferenceBuilder<'db, 'ast> {
263263
/// A set of functions that have been defined **and** called in this region.
264264
///
265265
/// This is a set because the same function could be called multiple times in the same region.
266-
/// This is mainly used in [`deferred::overloaded_function::check_overloaded_function`] to
266+
/// This is mainly used in [`post_inference::overloaded_function::check_overloaded_function`] to
267267
/// check an overloaded function that is shadowed by a function with the same name in this
268268
/// scope but has been called before. For example:
269269
///
@@ -680,12 +680,12 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
680680
let ty = ty_and_quals.inner_type();
681681
match definition.kind(self.db()) {
682682
DefinitionKind::Function(function) => {
683-
deferred::function::check_function_definition(
683+
post_inference::function::check_function_definition(
684684
&self.context,
685685
*definition,
686686
&|expr| self.file_expression_type(expr),
687687
);
688-
deferred::overloaded_function::check_overloaded_function(
688+
post_inference::overloaded_function::check_overloaded_function(
689689
&self.context,
690690
ty,
691691
*definition,
@@ -694,15 +694,15 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
694694
&mut seen_overloaded_places,
695695
&mut seen_public_functions,
696696
);
697-
deferred::typeguard::check_type_guard_definition(
697+
post_inference::typeguard::check_type_guard_definition(
698698
&self.context,
699699
ty,
700700
function.node(self.module()),
701701
self.index,
702702
);
703703
}
704704
DefinitionKind::Class(class_node) => {
705-
deferred::static_class::check_static_class_definitions(
705+
post_inference::static_class::check_static_class_definitions(
706706
&self.context,
707707
ty,
708708
class_node.node(self.module()),
@@ -715,11 +715,14 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
715715
}
716716

717717
for definition in &deferred_definitions {
718-
deferred::dynamic_class::check_dynamic_class_definition(&self.context, *definition);
718+
post_inference::dynamic_class::check_dynamic_class_definition(
719+
&self.context,
720+
*definition,
721+
);
719722
}
720723

721724
for function in &self.called_functions {
722-
deferred::overloaded_function::check_overloaded_function(
725+
post_inference::overloaded_function::check_overloaded_function(
723726
&self.context,
724727
Type::FunctionLiteral(*function),
725728
function.definition(self.db()),
@@ -730,7 +733,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
730733
);
731734
}
732735

733-
deferred::final_variable::check_final_without_value(&self.context, self.index);
736+
post_inference::final_variable::check_final_without_value(&self.context, self.index);
734737
}
735738
}
736739

@@ -1449,7 +1452,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
14491452
// Check that no type parameter with a default follows a TypeVarTuple
14501453
// in the type alias's PEP 695 type parameter list.
14511454
if let Some(type_params) = type_alias.type_params.as_deref() {
1452-
deferred::type_param_validation::check_no_default_after_typevar_tuple_pep695(
1455+
post_inference::type_param_validation::check_no_default_after_typevar_tuple_pep695(
14531456
&self.context,
14541457
type_params,
14551458
);

crates/ty_python_semantic/src/types/infer/deferred/dynamic_class.rs renamed to crates/ty_python_semantic/src/types/infer/builder/post_inference/dynamic_class.rs

File renamed without changes.

crates/ty_python_semantic/src/types/infer/deferred/final_variable.rs renamed to crates/ty_python_semantic/src/types/infer/builder/post_inference/final_variable.rs

File renamed without changes.

crates/ty_python_semantic/src/types/infer/deferred/function.rs renamed to crates/ty_python_semantic/src/types/infer/builder/post_inference/function.rs

File renamed without changes.

crates/ty_python_semantic/src/types/infer/deferred/mod.rs renamed to crates/ty_python_semantic/src/types/infer/builder/post_inference/mod.rs

File renamed without changes.

crates/ty_python_semantic/src/types/infer/deferred/overloaded_function.rs renamed to crates/ty_python_semantic/src/types/infer/builder/post_inference/overloaded_function.rs

File renamed without changes.

crates/ty_python_semantic/src/types/infer/deferred/static_class.rs renamed to crates/ty_python_semantic/src/types/infer/builder/post_inference/static_class.rs

File renamed without changes.

crates/ty_python_semantic/src/types/infer/deferred/type_param_validation.rs renamed to crates/ty_python_semantic/src/types/infer/builder/post_inference/type_param_validation.rs

File renamed without changes.

crates/ty_python_semantic/src/types/infer/deferred/typeguard.rs renamed to crates/ty_python_semantic/src/types/infer/builder/post_inference/typeguard.rs

File renamed without changes.

0 commit comments

Comments
 (0)