From db8db536f8b80dea48d79df84a85a8045d2c659e Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Thu, 5 Jun 2025 22:46:26 -0700 Subject: [PATCH] [ty] clarify requirements for scope_id argument to in_type_expression (#18488) --- crates/ty_python_semantic/src/types.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ty_python_semantic/src/types.rs b/crates/ty_python_semantic/src/types.rs index c6407e0001..22fa5316d5 100644 --- a/crates/ty_python_semantic/src/types.rs +++ b/crates/ty_python_semantic/src/types.rs @@ -4967,7 +4967,10 @@ impl<'db> Type<'db> { /// `Type::ClassLiteral(builtins.int)`, that is, it is the `int` class itself. As a type /// expression, it names the type `Type::NominalInstance(builtins.int)`, that is, all objects whose /// `__class__` is `int`. - pub fn in_type_expression( + /// + /// The `scope_id` argument must always be a scope from the file we are currently inferring, so + /// as to avoid cross-module AST dependency. + pub(crate) fn in_type_expression( &self, db: &'db dyn Db, scope_id: ScopeId<'db>,