mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-11 07:55:56 +03:00
Changed the way that PEP 695 type aliases are displayed when hovering over a reference to the type alias. Previously, the symbol was displayed as TypeAliasType
rather than the expanded type alias type. This addresses #8147.
This commit is contained in:
parent
6dc3b39902
commit
7ca7631808
@ -1330,6 +1330,14 @@ export function createTypeEvaluator(
|
||||
validateTypeIsInstantiable(typeResult, flags, node);
|
||||
}
|
||||
|
||||
// If this is a PEP 695 type alias, remove the special form so the type
|
||||
// printer prints it as its aliased type rather than TypeAliasType.
|
||||
if ((flags & EvaluatorFlags.ExpectingTypeAnnotation) !== 0) {
|
||||
if (typeResult.type.specialForm && ClassType.isBuiltIn(typeResult.type.specialForm, 'TypeAliasType')) {
|
||||
typeResult.type = TypeBase.cloneAsSpecialForm(typeResult.type, undefined);
|
||||
}
|
||||
}
|
||||
|
||||
return typeResult;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user