Make sure to instantiate merged type parameters
This commit is contained in:
parent
f95f51fefc
commit
3bdfd8f477
5 changed files with 72 additions and 1 deletions
|
@ -5464,7 +5464,7 @@ namespace ts {
|
|||
const declaration = <DeclarationWithTypeParameters>node;
|
||||
if (declaration.typeParameters) {
|
||||
for (const d of declaration.typeParameters) {
|
||||
if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(d.symbol))) {
|
||||
if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(getMergedSymbol(d.symbol)))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
15
tests/baselines/reference/instantiateCrossFileMerge.js
Normal file
15
tests/baselines/reference/instantiateCrossFileMerge.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
//// [tests/cases/compiler/instantiateCrossFileMerge.ts] ////
|
||||
|
||||
//// [first.ts]
|
||||
declare class P<R> {
|
||||
constructor(callback: (resolve: (value: R) => void) => void);
|
||||
}
|
||||
|
||||
//// [second.ts]
|
||||
interface P<R> { }
|
||||
new P<string>(r => { r('foo') });
|
||||
|
||||
|
||||
//// [first.js]
|
||||
//// [second.js]
|
||||
new P(function (r) { r('foo'); });
|
22
tests/baselines/reference/instantiateCrossFileMerge.symbols
Normal file
22
tests/baselines/reference/instantiateCrossFileMerge.symbols
Normal file
|
@ -0,0 +1,22 @@
|
|||
=== tests/cases/compiler/first.ts ===
|
||||
declare class P<R> {
|
||||
>P : Symbol(P, Decl(first.ts, 0, 0), Decl(second.ts, 0, 0))
|
||||
>R : Symbol(R, Decl(first.ts, 0, 16), Decl(second.ts, 0, 12))
|
||||
|
||||
constructor(callback: (resolve: (value: R) => void) => void);
|
||||
>callback : Symbol(callback, Decl(first.ts, 1, 16))
|
||||
>resolve : Symbol(resolve, Decl(first.ts, 1, 27))
|
||||
>value : Symbol(value, Decl(first.ts, 1, 37))
|
||||
>R : Symbol(R, Decl(first.ts, 0, 16), Decl(second.ts, 0, 12))
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/second.ts ===
|
||||
interface P<R> { }
|
||||
>P : Symbol(P, Decl(first.ts, 0, 0), Decl(second.ts, 0, 0))
|
||||
>R : Symbol(R, Decl(first.ts, 0, 16), Decl(second.ts, 0, 12))
|
||||
|
||||
new P<string>(r => { r('foo') });
|
||||
>P : Symbol(P, Decl(first.ts, 0, 0), Decl(second.ts, 0, 0))
|
||||
>r : Symbol(r, Decl(second.ts, 1, 14))
|
||||
>r : Symbol(r, Decl(second.ts, 1, 14))
|
||||
|
26
tests/baselines/reference/instantiateCrossFileMerge.types
Normal file
26
tests/baselines/reference/instantiateCrossFileMerge.types
Normal file
|
@ -0,0 +1,26 @@
|
|||
=== tests/cases/compiler/first.ts ===
|
||||
declare class P<R> {
|
||||
>P : P<R>
|
||||
>R : R
|
||||
|
||||
constructor(callback: (resolve: (value: R) => void) => void);
|
||||
>callback : (resolve: (value: R) => void) => void
|
||||
>resolve : (value: R) => void
|
||||
>value : R
|
||||
>R : R
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/second.ts ===
|
||||
interface P<R> { }
|
||||
>P : P<R>
|
||||
>R : R
|
||||
|
||||
new P<string>(r => { r('foo') });
|
||||
>new P<string>(r => { r('foo') }) : P<string>
|
||||
>P : typeof P
|
||||
>r => { r('foo') } : (r: (value: string) => void) => void
|
||||
>r : (value: string) => void
|
||||
>r('foo') : void
|
||||
>r : (value: string) => void
|
||||
>'foo' : string
|
||||
|
8
tests/cases/compiler/instantiateCrossFileMerge.ts
Normal file
8
tests/cases/compiler/instantiateCrossFileMerge.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
// @filename: first.ts
|
||||
declare class P<R> {
|
||||
constructor(callback: (resolve: (value: R) => void) => void);
|
||||
}
|
||||
|
||||
// @filename: second.ts
|
||||
interface P<R> { }
|
||||
new P<string>(r => { r('foo') });
|
Loading…
Reference in a new issue