Skip to content

Commit 89ebe5a

Browse files
committed
Merge pull request microsoft#8719 from Microsoft/instantiate-cross-file-merges
Instantiate cross file merges
2 parents 61154b6 + 7562ef0 commit 89ebe5a

5 files changed

Lines changed: 72 additions & 1 deletion

File tree

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5459,7 +5459,7 @@ namespace ts {
54595459
const declaration = <DeclarationWithTypeParameters>node;
54605460
if (declaration.typeParameters) {
54615461
for (const d of declaration.typeParameters) {
5462-
if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(d.symbol))) {
5462+
if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) {
54635463
return true;
54645464
}
54655465
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//// [tests/cases/compiler/instantiateCrossFileMerge.ts] ////
2+
3+
//// [first.ts]
4+
declare class P<R> {
5+
constructor(callback: (resolve: (value: R) => void) => void);
6+
}
7+
8+
//// [second.ts]
9+
interface P<R> { }
10+
new P<string>(r => { r('foo') });
11+
12+
13+
//// [first.js]
14+
//// [second.js]
15+
new P(function (r) { r('foo'); });
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
=== tests/cases/compiler/first.ts ===
2+
declare class P<R> {
3+
>P : Symbol(P, Decl(first.ts, 0, 0), Decl(second.ts, 0, 0))
4+
>R : Symbol(R, Decl(first.ts, 0, 16), Decl(second.ts, 0, 12))
5+
6+
constructor(callback: (resolve: (value: R) => void) => void);
7+
>callback : Symbol(callback, Decl(first.ts, 1, 16))
8+
>resolve : Symbol(resolve, Decl(first.ts, 1, 27))
9+
>value : Symbol(value, Decl(first.ts, 1, 37))
10+
>R : Symbol(R, Decl(first.ts, 0, 16), Decl(second.ts, 0, 12))
11+
}
12+
13+
=== tests/cases/compiler/second.ts ===
14+
interface P<R> { }
15+
>P : Symbol(P, Decl(first.ts, 0, 0), Decl(second.ts, 0, 0))
16+
>R : Symbol(R, Decl(first.ts, 0, 16), Decl(second.ts, 0, 12))
17+
18+
new P<string>(r => { r('foo') });
19+
>P : Symbol(P, Decl(first.ts, 0, 0), Decl(second.ts, 0, 0))
20+
>r : Symbol(r, Decl(second.ts, 1, 14))
21+
>r : Symbol(r, Decl(second.ts, 1, 14))
22+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
=== tests/cases/compiler/first.ts ===
2+
declare class P<R> {
3+
>P : P<R>
4+
>R : R
5+
6+
constructor(callback: (resolve: (value: R) => void) => void);
7+
>callback : (resolve: (value: R) => void) => void
8+
>resolve : (value: R) => void
9+
>value : R
10+
>R : R
11+
}
12+
13+
=== tests/cases/compiler/second.ts ===
14+
interface P<R> { }
15+
>P : P<R>
16+
>R : R
17+
18+
new P<string>(r => { r('foo') });
19+
>new P<string>(r => { r('foo') }) : P<string>
20+
>P : typeof P
21+
>r => { r('foo') } : (r: (value: string) => void) => void
22+
>r : (value: string) => void
23+
>r('foo') : void
24+
>r : (value: string) => void
25+
>'foo' : string
26+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// @filename: first.ts
2+
declare class P<R> {
3+
constructor(callback: (resolve: (value: R) => void) => void);
4+
}
5+
6+
// @filename: second.ts
7+
interface P<R> { }
8+
new P<string>(r => { r('foo') });

0 commit comments

Comments
 (0)