mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
fix(52749): Assertion failure in derived class completion (#52787)
This commit is contained in:
parent
2c67c8f756
commit
733d7aed97
@ -751,7 +751,7 @@ function createMethodImplementingSignatures(
|
||||
function getReturnTypeFromSignatures(signatures: readonly Signature[], checker: TypeChecker, context: TypeConstructionContext, enclosingDeclaration: ClassLikeDeclaration): TypeNode | undefined {
|
||||
if (length(signatures)) {
|
||||
const type = checker.getUnionType(map(signatures, checker.getReturnTypeOfSignature));
|
||||
return checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
|
||||
return checker.typeToTypeNode(type, enclosingDeclaration, NodeBuilderFlags.NoTruncation, getNoopSymbolTrackerWithResolver(context));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
319
tests/baselines/reference/completionsClassMembers4.baseline
Normal file
319
tests/baselines/reference/completionsClassMembers4.baseline
Normal file
@ -0,0 +1,319 @@
|
||||
=== /foo.ts ===
|
||||
// export class Observable<T> {
|
||||
// pipe(): Observable<T>;
|
||||
// pipe<A>(): Observable<A>;
|
||||
// pipe<A, B>(): Observable<B>;
|
||||
// pipe<A, B, C>(): Observable<C>;
|
||||
// pipe<A, B, C, D>(): Observable<D>;
|
||||
// pipe<A, B, C, D, E>(): Observable<E>;
|
||||
// pipe<A, B, C, D, E, F>(): Observable<F>;
|
||||
// pipe<A, B, C, D, E, F, G>(): Observable<G>;
|
||||
// pipe<A, B, C, D, E, F, G, H>(): Observable<H>;
|
||||
// pipe<A, B, C, D, E, F, G, H, I>(): Observable<I>;
|
||||
// pipe<A, B, C, D, E, F, G, H, I>(): Observable<unknown>;
|
||||
// }
|
||||
// export class Foo extends Observable<any> {
|
||||
//
|
||||
// ^
|
||||
// | ----------------------------------------------------------------------
|
||||
// | abstract
|
||||
// | accessor
|
||||
// | async
|
||||
// | constructor
|
||||
// | declare
|
||||
// | get
|
||||
// | override
|
||||
// | private
|
||||
// | protected
|
||||
// | public
|
||||
// | readonly
|
||||
// | set
|
||||
// | static
|
||||
// | (method) Observable<any>.pipe(): Observable<any> (+10 overloads)
|
||||
// | ----------------------------------------------------------------------
|
||||
// }
|
||||
|
||||
[
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/foo.ts",
|
||||
"position": 543,
|
||||
"name": ""
|
||||
},
|
||||
"item": {
|
||||
"flags": 0,
|
||||
"isGlobalCompletion": false,
|
||||
"isMemberCompletion": true,
|
||||
"isNewIdentifierLocation": true,
|
||||
"entries": [
|
||||
{
|
||||
"name": "abstract",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "abstract",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "accessor",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "accessor",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "async",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "async",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "constructor",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "constructor",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "declare",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "declare",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "get",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "get",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "override",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "override",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "private",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "private",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "protected",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "protected",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "public",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "public",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "readonly",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "readonly",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "set",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "set",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "static",
|
||||
"kind": "keyword",
|
||||
"kindModifiers": "",
|
||||
"sortText": "15",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "static",
|
||||
"kind": "keyword"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pipe",
|
||||
"kind": "method",
|
||||
"kindModifiers": "",
|
||||
"sortText": "17",
|
||||
"insertText": "pipe(): Observable<any>;\npipe<A>(): Observable<A>;\npipe<A, B>(): Observable<B>;\npipe<A, B, C>(): Observable<C>;\npipe<A, B, C, D>(): Observable<D>;\npipe<A, B, C, D, E>(): Observable<E>;\npipe<A, B, C, D, E, F>(): Observable<F>;\npipe<A, B, C, D, E, F, G>(): Observable<G>;\npipe<A, B, C, D, E, F, G, H>(): Observable<H>;\npipe<A, B, C, D, E, F, G, H, I>(): Observable<I>;\npipe<A, B, C, D, E, F, G, H, I>(): Observable<unknown>;\npipe(): Observable<any> | Observable<A> | Observable<B> | Observable<C> | Observable<D> | Observable<E> | Observable<F> | Observable<G> | Observable<H> | Observable<I> | Observable<unknown> {\n $0\n}",
|
||||
"isSnippet": true,
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "(",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "method",
|
||||
"kind": "text"
|
||||
},
|
||||
{
|
||||
"text": ")",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "Observable",
|
||||
"kind": "className"
|
||||
},
|
||||
{
|
||||
"text": "<",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "any",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": ">",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ".",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "pipe",
|
||||
"kind": "methodName"
|
||||
},
|
||||
{
|
||||
"text": "(",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ")",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ":",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "Observable",
|
||||
"kind": "className"
|
||||
},
|
||||
{
|
||||
"text": "<",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "any",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": ">",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "(",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "+",
|
||||
"kind": "operator"
|
||||
},
|
||||
{
|
||||
"text": "10",
|
||||
"kind": "numericLiteral"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "overloads",
|
||||
"kind": "text"
|
||||
},
|
||||
{
|
||||
"text": ")",
|
||||
"kind": "punctuation"
|
||||
}
|
||||
],
|
||||
"documentation": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
25
tests/cases/fourslash/completionsClassMembers4.ts
Normal file
25
tests/cases/fourslash/completionsClassMembers4.ts
Normal file
@ -0,0 +1,25 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @filename: /foo.ts
|
||||
////export class Observable<T> {
|
||||
//// pipe(): Observable<T>;
|
||||
//// pipe<A>(): Observable<A>;
|
||||
//// pipe<A, B>(): Observable<B>;
|
||||
//// pipe<A, B, C>(): Observable<C>;
|
||||
//// pipe<A, B, C, D>(): Observable<D>;
|
||||
//// pipe<A, B, C, D, E>(): Observable<E>;
|
||||
//// pipe<A, B, C, D, E, F>(): Observable<F>;
|
||||
//// pipe<A, B, C, D, E, F, G>(): Observable<G>;
|
||||
//// pipe<A, B, C, D, E, F, G, H>(): Observable<H>;
|
||||
//// pipe<A, B, C, D, E, F, G, H, I>(): Observable<I>;
|
||||
//// pipe<A, B, C, D, E, F, G, H, I>(): Observable<unknown>;
|
||||
////}
|
||||
////export class Foo extends Observable<any> {
|
||||
//// /**/
|
||||
////}
|
||||
|
||||
verify.baselineCompletions({
|
||||
includeCompletionsWithInsertText: true,
|
||||
includeCompletionsWithSnippetText: true,
|
||||
includeCompletionsWithClassMemberSnippets: true,
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user