[ty] Use 'unknown' specialization for upper bound on Self (#20325)

## Summary

closes https://github.com/astral-sh/ty/issues/1156

## Test Plan

Added a regression test
This commit is contained in:
David Peter
2025-09-10 17:00:28 +02:00
committed by GitHub
parent 57d1f7132d
commit 65982a1e14
2 changed files with 19 additions and 4 deletions

View File

@@ -5711,9 +5711,7 @@ impl<'db> Type<'db> {
],
});
};
let instance = Type::ClassLiteral(class).to_instance(db).expect(
"nearest_enclosing_class must return type that can be instantiated",
);
let instance = Type::instance(db, class.unknown_specialization(db));
let class_definition = class.definition(db);
let typevar = TypeVarInstance::new(
db,