Skip to content

Commit 1251317

Browse files
committed
Add test
1 parent 190d709 commit 1251317

4 files changed

+155
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//// [tests/cases/compiler/declarationEmitTypeParameterNameInOuterScope.ts] ////
2+
3+
//// [declarationEmitTypeParameterNameInOuterScope.ts]
4+
class A { }
5+
6+
var a = <A,>(x: A) => x;
7+
function a2<A,>(x: A) { return x }
8+
9+
var a3 = <A,>(x: A) => new A();
10+
function a4<A,>(x: A) { return new A() }
11+
12+
13+
interface B { }
14+
15+
var b = <B,>(x: B) => x;
16+
function b2<B,>(x: B) { return x }
17+
18+
19+
//// [declarationEmitTypeParameterNameInOuterScope.js]
20+
var A = /** @class */ (function () {
21+
function A() {
22+
}
23+
return A;
24+
}());
25+
var a = function (x) { return x; };
26+
function a2(x) { return x; }
27+
var a3 = function (x) { return new A(); };
28+
function a4(x) { return new A(); }
29+
var b = function (x) { return x; };
30+
function b2(x) { return x; }
31+
32+
33+
//// [declarationEmitTypeParameterNameInOuterScope.d.ts]
34+
declare class A {
35+
}
36+
declare var a: <A_1>(x: A_1) => A_1;
37+
declare function a2<A>(x: A): A;
38+
declare var a3: <A_1>(x: A_1) => A;
39+
declare function a4<A>(x: A): globalThis.A;
40+
interface B {
41+
}
42+
declare var b: <B_1>(x: B_1) => B_1;
43+
declare function b2<B>(x: B): B;
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//// [tests/cases/compiler/declarationEmitTypeParameterNameInOuterScope.ts] ////
2+
3+
=== declarationEmitTypeParameterNameInOuterScope.ts ===
4+
class A { }
5+
>A : Symbol(A, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 0, 0))
6+
7+
var a = <A,>(x: A) => x;
8+
>a : Symbol(a, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 2, 3))
9+
>A : Symbol(A, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 2, 9))
10+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 2, 13))
11+
>A : Symbol(A, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 2, 9))
12+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 2, 13))
13+
14+
function a2<A,>(x: A) { return x }
15+
>a2 : Symbol(a2, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 2, 24))
16+
>A : Symbol(A, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 3, 12))
17+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 3, 16))
18+
>A : Symbol(A, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 3, 12))
19+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 3, 16))
20+
21+
var a3 = <A,>(x: A) => new A();
22+
>a3 : Symbol(a3, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 5, 3))
23+
>A : Symbol(A, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 5, 10))
24+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 5, 14))
25+
>A : Symbol(A, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 5, 10))
26+
>A : Symbol(A, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 0, 0))
27+
28+
function a4<A,>(x: A) { return new A() }
29+
>a4 : Symbol(a4, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 5, 31))
30+
>A : Symbol(A, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 6, 12))
31+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 6, 16))
32+
>A : Symbol(A, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 6, 12))
33+
>A : Symbol(A, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 0, 0))
34+
35+
36+
interface B { }
37+
>B : Symbol(B, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 6, 40))
38+
39+
var b = <B,>(x: B) => x;
40+
>b : Symbol(b, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 11, 3))
41+
>B : Symbol(B, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 11, 9))
42+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 11, 13))
43+
>B : Symbol(B, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 11, 9))
44+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 11, 13))
45+
46+
function b2<B,>(x: B) { return x }
47+
>b2 : Symbol(b2, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 11, 24))
48+
>B : Symbol(B, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 12, 12))
49+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 12, 16))
50+
>B : Symbol(B, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 12, 12))
51+
>x : Symbol(x, Decl(declarationEmitTypeParameterNameInOuterScope.ts, 12, 16))
52+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//// [tests/cases/compiler/declarationEmitTypeParameterNameInOuterScope.ts] ////
2+
3+
=== declarationEmitTypeParameterNameInOuterScope.ts ===
4+
class A { }
5+
>A : A
6+
7+
var a = <A,>(x: A) => x;
8+
>a : <A>(x: A) => A
9+
><A,>(x: A) => x : <A>(x: A) => A
10+
>x : A
11+
>x : A
12+
13+
function a2<A,>(x: A) { return x }
14+
>a2 : <A>(x: A) => A
15+
>x : A
16+
>x : A
17+
18+
var a3 = <A,>(x: A) => new A();
19+
>a3 : <A>(x: A) => A
20+
><A,>(x: A) => new A() : <A>(x: A) => A
21+
>x : A
22+
>new A() : globalThis.A
23+
>A : typeof A
24+
25+
function a4<A,>(x: A) { return new A() }
26+
>a4 : <A>(x: A) => globalThis.A
27+
>x : A
28+
>new A() : globalThis.A
29+
>A : typeof A
30+
31+
32+
interface B { }
33+
34+
var b = <B,>(x: B) => x;
35+
>b : <B>(x: B) => B
36+
><B,>(x: B) => x : <B>(x: B) => B
37+
>x : B
38+
>x : B
39+
40+
function b2<B,>(x: B) { return x }
41+
>b2 : <B>(x: B) => B
42+
>x : B
43+
>x : B
44+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// @declaration: true
2+
// @skipLibCheck: false
3+
4+
class A { }
5+
6+
var a = <A,>(x: A) => x;
7+
function a2<A,>(x: A) { return x }
8+
9+
var a3 = <A,>(x: A) => new A();
10+
function a4<A,>(x: A) { return new A() }
11+
12+
13+
interface B { }
14+
15+
var b = <B,>(x: B) => x;
16+
function b2<B,>(x: B) { return x }

0 commit comments

Comments
 (0)