Skip to content

Commit e66a0ec

Browse files
committed
add more test
1 parent 36ee08e commit e66a0ec

File tree

4 files changed

+153
-0
lines changed

4 files changed

+153
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//// [tests/cases/compiler/classFieldSuperAccessible.ts] ////
2+
3+
//// [classFieldSuperAccessible.ts]
4+
class A extends class Expr {} {
5+
static {
6+
console.log(super.name);
7+
}
8+
}
9+
class B extends Number {
10+
static {
11+
console.log(super.EPSILON);
12+
}
13+
}
14+
class C extends Array {
15+
foo() {
16+
console.log(super.length);
17+
}
18+
}
19+
20+
21+
//// [classFieldSuperAccessible.js]
22+
class A extends class Expr {
23+
} {
24+
static {
25+
console.log(super.name);
26+
}
27+
}
28+
class B extends Number {
29+
static {
30+
console.log(super.EPSILON);
31+
}
32+
}
33+
class C extends Array {
34+
foo() {
35+
console.log(super.length);
36+
}
37+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//// [tests/cases/compiler/classFieldSuperAccessible.ts] ////
2+
3+
=== classFieldSuperAccessible.ts ===
4+
class A extends class Expr {} {
5+
>A : Symbol(A, Decl(classFieldSuperAccessible.ts, 0, 0))
6+
>Expr : Symbol(Expr, Decl(classFieldSuperAccessible.ts, 0, 15))
7+
8+
static {
9+
console.log(super.name);
10+
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
11+
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
12+
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
13+
>super.name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --))
14+
>super : Symbol(Expr, Decl(classFieldSuperAccessible.ts, 0, 15))
15+
>name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --))
16+
}
17+
}
18+
class B extends Number {
19+
>B : Symbol(B, Decl(classFieldSuperAccessible.ts, 4, 1))
20+
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --))
21+
22+
static {
23+
console.log(super.EPSILON);
24+
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
25+
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
26+
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
27+
>super.EPSILON : Symbol(NumberConstructor.EPSILON, Decl(lib.es2015.core.d.ts, --, --))
28+
>super : Symbol(NumberConstructor, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
29+
>EPSILON : Symbol(NumberConstructor.EPSILON, Decl(lib.es2015.core.d.ts, --, --))
30+
}
31+
}
32+
class C extends Array {
33+
>C : Symbol(C, Decl(classFieldSuperAccessible.ts, 9, 1))
34+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more)
35+
36+
foo() {
37+
>foo : Symbol(C.foo, Decl(classFieldSuperAccessible.ts, 10, 23))
38+
39+
console.log(super.length);
40+
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
41+
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
42+
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
43+
>super.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
44+
>super : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more)
45+
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
46+
}
47+
}
48+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//// [tests/cases/compiler/classFieldSuperAccessible.ts] ////
2+
3+
=== classFieldSuperAccessible.ts ===
4+
class A extends class Expr {} {
5+
>A : A
6+
>class Expr {} : Expr
7+
>Expr : typeof Expr
8+
9+
static {
10+
console.log(super.name);
11+
>console.log(super.name) : void
12+
>console.log : (...data: any[]) => void
13+
>console : Console
14+
>log : (...data: any[]) => void
15+
>super.name : string
16+
>super : typeof Expr
17+
>name : string
18+
}
19+
}
20+
class B extends Number {
21+
>B : B
22+
>Number : Number
23+
24+
static {
25+
console.log(super.EPSILON);
26+
>console.log(super.EPSILON) : void
27+
>console.log : (...data: any[]) => void
28+
>console : Console
29+
>log : (...data: any[]) => void
30+
>super.EPSILON : number
31+
>super : NumberConstructor
32+
>EPSILON : number
33+
}
34+
}
35+
class C extends Array {
36+
>C : C
37+
>Array : any[]
38+
39+
foo() {
40+
>foo : () => void
41+
42+
console.log(super.length);
43+
>console.log(super.length) : void
44+
>console.log : (...data: any[]) => void
45+
>console : Console
46+
>log : (...data: any[]) => void
47+
>super.length : number
48+
>super : any[]
49+
>length : number
50+
}
51+
}
52+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// @target: esnext
2+
class A extends class Expr {} {
3+
static {
4+
console.log(super.name);
5+
}
6+
}
7+
class B extends Number {
8+
static {
9+
console.log(super.EPSILON);
10+
}
11+
}
12+
class C extends Array {
13+
foo() {
14+
console.log(super.length);
15+
}
16+
}

0 commit comments

Comments
 (0)