Skip to content

Fix #7966: A non-anonymous type can still fail to have a symbol. #8576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
1 commit merged into from
May 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/services/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4349,7 +4349,7 @@ namespace ts {
displayParts.push(keywordPart(SyntaxKind.NewKeyword));
displayParts.push(spacePart());
}
if (!(type.flags & TypeFlags.Anonymous)) {
if (!(type.flags & TypeFlags.Anonymous) && type.symbol) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just if (type.symbol)?

Copy link
Author

@ghost ghost May 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we allow anything with .symbol, anonymous function tooltips will look like var lambdaFoo: (Anonymous function)(a: number, b: number) => number instead of var lambdaFoo: (a: number, b: number) => number.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see.

addRange(displayParts, symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments));
}
addSignatureDisplayParts(signature, allSignatures, TypeFormatFlags.WriteArrowStyleSignature);
Expand Down
8 changes: 8 additions & 0 deletions tests/cases/fourslash/getQuickInfoForIntersectionTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
////function f(): string & {(): any} {
//// return <any>{};
////}
////let x = f();
////x/**/();

goTo.marker();
verify.quickInfoIs("let x: () => any");