mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-13 06:20:23 -06:00
Merge pull request #16335 from Microsoft/delay-signature-return-type-instantiation
Delay signature return type instantiation
This commit is contained in:
commit
b94c51360b
@ -8069,7 +8069,7 @@ namespace ts {
|
||||
const result = createSignature(signature.declaration, freshTypeParameters,
|
||||
signature.thisParameter && instantiateSymbol(signature.thisParameter, mapper),
|
||||
instantiateList(signature.parameters, mapper, instantiateSymbol),
|
||||
instantiateType(signature.resolvedReturnType, mapper),
|
||||
/*resolvedReturnType*/ undefined,
|
||||
freshTypePredicate,
|
||||
signature.minArgumentCount, signature.hasRestParameter, signature.hasLiteralTypes);
|
||||
result.target = signature;
|
||||
|
||||
15
tests/baselines/reference/returnInfiniteIntersection.js
Normal file
15
tests/baselines/reference/returnInfiniteIntersection.js
Normal file
@ -0,0 +1,15 @@
|
||||
//// [returnInfiniteIntersection.ts]
|
||||
function recursive() {
|
||||
let x = <T>(subkey: T) => recursive();
|
||||
return x as typeof x & { p };
|
||||
}
|
||||
|
||||
let result = recursive()(1)
|
||||
|
||||
|
||||
//// [returnInfiniteIntersection.js]
|
||||
function recursive() {
|
||||
var x = function (subkey) { return recursive(); };
|
||||
return x;
|
||||
}
|
||||
var result = recursive()(1);
|
||||
21
tests/baselines/reference/returnInfiniteIntersection.symbols
Normal file
21
tests/baselines/reference/returnInfiniteIntersection.symbols
Normal file
@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/returnInfiniteIntersection.ts ===
|
||||
function recursive() {
|
||||
>recursive : Symbol(recursive, Decl(returnInfiniteIntersection.ts, 0, 0))
|
||||
|
||||
let x = <T>(subkey: T) => recursive();
|
||||
>x : Symbol(x, Decl(returnInfiniteIntersection.ts, 1, 7))
|
||||
>T : Symbol(T, Decl(returnInfiniteIntersection.ts, 1, 13))
|
||||
>subkey : Symbol(subkey, Decl(returnInfiniteIntersection.ts, 1, 16))
|
||||
>T : Symbol(T, Decl(returnInfiniteIntersection.ts, 1, 13))
|
||||
>recursive : Symbol(recursive, Decl(returnInfiniteIntersection.ts, 0, 0))
|
||||
|
||||
return x as typeof x & { p };
|
||||
>x : Symbol(x, Decl(returnInfiniteIntersection.ts, 1, 7))
|
||||
>x : Symbol(x, Decl(returnInfiniteIntersection.ts, 1, 7))
|
||||
>p : Symbol(p, Decl(returnInfiniteIntersection.ts, 2, 28))
|
||||
}
|
||||
|
||||
let result = recursive()(1)
|
||||
>result : Symbol(result, Decl(returnInfiniteIntersection.ts, 5, 3))
|
||||
>recursive : Symbol(recursive, Decl(returnInfiniteIntersection.ts, 0, 0))
|
||||
|
||||
27
tests/baselines/reference/returnInfiniteIntersection.types
Normal file
27
tests/baselines/reference/returnInfiniteIntersection.types
Normal file
@ -0,0 +1,27 @@
|
||||
=== tests/cases/compiler/returnInfiniteIntersection.ts ===
|
||||
function recursive() {
|
||||
>recursive : () => (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
|
||||
let x = <T>(subkey: T) => recursive();
|
||||
>x : <T>(subkey: T) => any & { p: any; }
|
||||
><T>(subkey: T) => recursive() : <T>(subkey: T) => any & { p: any; }
|
||||
>T : T
|
||||
>subkey : T
|
||||
>T : T
|
||||
>recursive() : (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>recursive : () => (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
|
||||
return x as typeof x & { p };
|
||||
>x as typeof x & { p } : (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>x : <T>(subkey: T) => any & { p: any; }
|
||||
>x : <T>(subkey: T) => any & { p: any; }
|
||||
>p : any
|
||||
}
|
||||
|
||||
let result = recursive()(1)
|
||||
>result : (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>recursive()(1) : (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>recursive() : (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>recursive : () => (<T>(subkey: T) => any & { p: any; }) & { p: any; }
|
||||
>1 : 1
|
||||
|
||||
6
tests/cases/compiler/returnInfiniteIntersection.ts
Normal file
6
tests/cases/compiler/returnInfiniteIntersection.ts
Normal file
@ -0,0 +1,6 @@
|
||||
function recursive() {
|
||||
let x = <T>(subkey: T) => recursive();
|
||||
return x as typeof x & { p };
|
||||
}
|
||||
|
||||
let result = recursive()(1)
|
||||
Loading…
x
Reference in New Issue
Block a user