Skip to content

Commit fda0a8f

Browse files
committed
Add regression test
1 parent d3529bd commit fda0a8f

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
=== tests/cases/compiler/typeofThisInMethodSignature.ts ===
2+
// Repro from #54167
3+
4+
export class A {
5+
>A : Symbol(A, Decl(typeofThisInMethodSignature.ts, 0, 0))
6+
7+
x = 1
8+
>x : Symbol(A.x, Decl(typeofThisInMethodSignature.ts, 2, 16))
9+
10+
a(x: typeof this.x): void {}
11+
>a : Symbol(A.a, Decl(typeofThisInMethodSignature.ts, 3, 6))
12+
>x : Symbol(x, Decl(typeofThisInMethodSignature.ts, 4, 3))
13+
>this.x : Symbol(A.x, Decl(typeofThisInMethodSignature.ts, 2, 16))
14+
>this : Symbol(A, Decl(typeofThisInMethodSignature.ts, 0, 0))
15+
>x : Symbol(A.x, Decl(typeofThisInMethodSignature.ts, 2, 16))
16+
}
17+
18+
const a = new A().a(1);
19+
>a : Symbol(a, Decl(typeofThisInMethodSignature.ts, 7, 5))
20+
>new A().a : Symbol(A.a, Decl(typeofThisInMethodSignature.ts, 3, 6))
21+
>A : Symbol(A, Decl(typeofThisInMethodSignature.ts, 0, 0))
22+
>a : Symbol(A.a, Decl(typeofThisInMethodSignature.ts, 3, 6))
23+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
=== tests/cases/compiler/typeofThisInMethodSignature.ts ===
2+
// Repro from #54167
3+
4+
export class A {
5+
>A : A
6+
7+
x = 1
8+
>x : number
9+
>1 : 1
10+
11+
a(x: typeof this.x): void {}
12+
>a : (x: typeof this.x) => void
13+
>x : number
14+
>this.x : number
15+
>this : this
16+
>x : number
17+
}
18+
19+
const a = new A().a(1);
20+
>a : void
21+
>new A().a(1) : void
22+
>new A().a : (x: number) => void
23+
>new A() : A
24+
>A : typeof A
25+
>a : (x: number) => void
26+
>1 : 1
27+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @strict: true
2+
// @noEmit: true
3+
4+
// Repro from #54167
5+
6+
export class A {
7+
x = 1
8+
a(x: typeof this.x): void {}
9+
}
10+
11+
const a = new A().a(1);

0 commit comments

Comments
 (0)