mirror of
https://github.com/microsoft/pyright.git
synced 2024-10-06 21:07:19 +03:00
Added name to dummy type created for protocol variance testing.
This commit is contained in:
parent
57cc03dca0
commit
60e49580e4
@ -3303,19 +3303,28 @@ export class Checker extends ParseTreeWalker {
|
||||
const updatedClassType = ClassType.cloneWithNewTypeParameters(classType, updatedTypeParams);
|
||||
|
||||
const objectObject = ClassType.cloneAsInstance(objectType);
|
||||
const arbitraryTypeObject = ClassType.createInstantiable('', '', '', '', 0, 0, undefined, undefined);
|
||||
const dummyTypeObject = ClassType.createInstantiable(
|
||||
'__protocolVarianceDummy',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
0,
|
||||
undefined,
|
||||
undefined
|
||||
);
|
||||
|
||||
updatedTypeParams.forEach((param, paramIndex) => {
|
||||
// Replace all type arguments with an arbitary type except for the
|
||||
// Replace all type arguments with a dummy type except for the
|
||||
// TypeVar of interest, which is replaced with an object instance.
|
||||
const srcTypeArgs = updatedTypeParams.map((_, i) => {
|
||||
return i === paramIndex ? objectObject : arbitraryTypeObject;
|
||||
return i === paramIndex ? objectObject : dummyTypeObject;
|
||||
});
|
||||
|
||||
// Replace all type arguments with an arbitary type except for the
|
||||
// Replace all type arguments with a dummy type except for the
|
||||
// TypeVar of interest, which is replaced with itself.
|
||||
const destTypeArgs = updatedTypeParams.map((p, i) => {
|
||||
return i === paramIndex ? p : arbitraryTypeObject;
|
||||
return i === paramIndex ? p : dummyTypeObject;
|
||||
});
|
||||
|
||||
const srcType = ClassType.cloneForSpecialization(
|
||||
|
Loading…
Reference in New Issue
Block a user