@@ -6799,7 +6799,7 @@ impl<'db> Type<'db> {
67996799 }
68006800 KnownInstanceType::Literal(ty) => Ok(ty.inner(db)),
68016801 KnownInstanceType::Annotated(ty) => Ok(ty.inner(db)),
6802- KnownInstanceType::TypeGenericAlias(ty ) => {
6802+ KnownInstanceType::TypeGenericAlias(instance ) => {
68036803 // When `type[…]` appears in a value position (e.g. in an implicit type alias),
68046804 // we infer its argument as a type expression. This ensures that we can emit
68056805 // diagnostics for invalid type expressions, and more importantly, that we can
@@ -6808,7 +6808,7 @@ impl<'db> Type<'db> {
68086808 // (`int` -> instance of `int` -> subclass of `int`) can be lossy, but it is
68096809 // okay for all valid arguments to `type[…]`.
68106810
6811- Ok(ty .inner(db).to_meta_type(db))
6811+ Ok(instance .inner(db).to_meta_type(db))
68126812 }
68136813 KnownInstanceType::Callable(instance) => {
68146814 Ok(Type::Callable(instance.callable_type(db)))
@@ -7046,16 +7046,8 @@ impl<'db> Type<'db> {
70467046 }
70477047 Type::Callable(_) | Type::DataclassTransformer(_) => KnownClass::Type.to_instance(db),
70487048 Type::ModuleLiteral(_) => KnownClass::ModuleType.to_class_literal(db),
7049- Type::TypeVar(bound_typevar) => {
7050- match bound_typevar.typevar(db).bound_or_constraints(db) {
7051- None => KnownClass::Type.to_instance(db),
7052- Some(TypeVarBoundOrConstraints::UpperBound(bound)) => bound.to_meta_type(db),
7053- Some(TypeVarBoundOrConstraints::Constraints(constraints)) => {
7054- // TODO: If we add a proper `OneOf` connector, we should use that here instead
7055- // of union. (Using a union here doesn't break anything, but it is imprecise.)
7056- constraints.map(db, |constraint| constraint.to_meta_type(db))
7057- }
7058- }
7049+ Type::TypeVar(_) => {
7050+ todo_type!("type[T]")
70597051 }
70607052
70617053 Type::ClassLiteral(class) => class.metaclass(db),
0 commit comments