mirror of
https://github.com/microsoft/pyright.git
synced 2024-08-16 11:20:22 +03:00
Simplified FunctionType.cloneForSpecialization method.
This commit is contained in:
parent
ec196107e2
commit
2b0a1d92dd
@ -1689,25 +1689,15 @@ export namespace FunctionType {
|
||||
specializedTypes: SpecializedFunctionTypes,
|
||||
specializedInferredReturnType: Type | undefined
|
||||
): FunctionType {
|
||||
const newFunction = create(
|
||||
type.details.name,
|
||||
type.details.fullName,
|
||||
type.details.moduleName,
|
||||
type.details.flags,
|
||||
type.flags,
|
||||
type.details.docString
|
||||
);
|
||||
newFunction.details = type.details;
|
||||
const newFunction = TypeBase.cloneType(type);
|
||||
|
||||
assert(specializedTypes.parameterTypes.length === type.details.parameters.length);
|
||||
if (specializedTypes.parameterDefaultArgs) {
|
||||
assert(specializedTypes.parameterDefaultArgs.length === type.details.parameters.length);
|
||||
}
|
||||
newFunction.specializedTypes = specializedTypes;
|
||||
|
||||
if (specializedInferredReturnType) {
|
||||
newFunction.inferredReturnType = specializedInferredReturnType;
|
||||
}
|
||||
newFunction.specializedTypes = specializedTypes;
|
||||
newFunction.inferredReturnType = specializedInferredReturnType;
|
||||
|
||||
return newFunction;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user