Completion entry details of union of methods with no call signature

Fixes #928
This commit is contained in:
Sheetal Nandi 2014-11-03 12:43:45 -08:00
parent 3c2f556306
commit c8dc2bdef0
2 changed files with 20 additions and 2 deletions

View File

@ -2764,7 +2764,8 @@ module ts {
if (flags & SymbolFlags.Property) {
if (flags & SymbolFlags.UnionProperty) {
return forEach(typeInfoResolver.getRootSymbols(symbol), rootSymbol => {
// If any of the property includes the declaration of property - the kind is property
var unionPropetyKind = forEach(typeInfoResolver.getRootSymbols(symbol), rootSymbol => {
var rootSymbolFlags = rootSymbol.getFlags();
if (rootSymbolFlags & SymbolFlags.Property) {
return ScriptElementKind.memberVariableElement;
@ -2772,7 +2773,16 @@ module ts {
if (rootSymbolFlags & SymbolFlags.GetAccessor) return ScriptElementKind.memberVariableElement;
if (rootSymbolFlags & SymbolFlags.SetAccessor) return ScriptElementKind.memberVariableElement;
Debug.assert((rootSymbolFlags & SymbolFlags.Method) !== undefined);
}) || ScriptElementKind.memberFunctionElement;
});
if (!unionPropetyKind) {
// If this was union of all methods, make sure it has call signatures before we call it method
var typeOfUnionProperty = typeInfoResolver.getTypeOfSymbol(symbol);
if (typeOfUnionProperty.getCallSignatures().length) {
return ScriptElementKind.memberFunctionElement;
}
return ScriptElementKind.memberVariableElement;
}
return unionPropetyKind;
}
return ScriptElementKind.memberVariableElement;
}

View File

@ -0,0 +1,8 @@
///<reference path="fourslash.ts" />
////var y: Array<string>|Array<number>;
////y.map/**/(
goTo.marker();
verify.quickInfoIs("(property) map: (<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | (<U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[])");
verify.completionListContains('map', "(property) map: (<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | (<U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[])");