Skip to content

Commit 3e85ac0

Browse files
committed
Test:index constraint check on js class expression
1 parent 49fd1ad commit 3e85ac0

4 files changed

+81
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//// [weird.js]
2+
someFunction(function(BaseClass) {
3+
class Hello extends BaseClass {
4+
constructor() {
5+
this.foo = "bar";
6+
}
7+
}
8+
});
9+
10+
11+
//// [foo.js]
12+
var __extends = (this && this.__extends) || (function () {
13+
var extendStatics = Object.setPrototypeOf ||
14+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
15+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
16+
return function (d, b) {
17+
extendStatics(d, b);
18+
function __() { this.constructor = d; }
19+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
20+
};
21+
})();
22+
someFunction(function (BaseClass) {
23+
var Hello = (function (_super) {
24+
__extends(Hello, _super);
25+
function Hello() {
26+
var _this = this;
27+
_this.foo = "bar";
28+
return _this;
29+
}
30+
return Hello;
31+
}(BaseClass));
32+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== tests/cases/compiler/weird.js ===
2+
someFunction(function(BaseClass) {
3+
>BaseClass : Symbol(BaseClass, Decl(weird.js, 0, 22))
4+
5+
class Hello extends BaseClass {
6+
>Hello : Symbol(Hello, Decl(weird.js, 0, 34))
7+
>BaseClass : Symbol(BaseClass, Decl(weird.js, 0, 22))
8+
9+
constructor() {
10+
this.foo = "bar";
11+
>this.foo : Symbol(Hello.foo, Decl(weird.js, 2, 17))
12+
>this : Symbol(Hello, Decl(weird.js, 0, 34))
13+
>foo : Symbol(Hello.foo, Decl(weird.js, 2, 17))
14+
}
15+
}
16+
});
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
=== tests/cases/compiler/weird.js ===
2+
someFunction(function(BaseClass) {
3+
>someFunction(function(BaseClass) { class Hello extends BaseClass { constructor() { this.foo = "bar"; } }}) : any
4+
>someFunction : any
5+
>function(BaseClass) { class Hello extends BaseClass { constructor() { this.foo = "bar"; } }} : (BaseClass: any) => void
6+
>BaseClass : any
7+
8+
class Hello extends BaseClass {
9+
>Hello : Hello
10+
>BaseClass : any
11+
12+
constructor() {
13+
this.foo = "bar";
14+
>this.foo = "bar" : "bar"
15+
>this.foo : string
16+
>this : this
17+
>foo : string
18+
>"bar" : "bar"
19+
}
20+
}
21+
});
22+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @Filename: weird.js
2+
// @allowJs: true
3+
// @out: foo.js
4+
someFunction(function(BaseClass) {
5+
class Hello extends BaseClass {
6+
constructor() {
7+
this.foo = "bar";
8+
}
9+
}
10+
});

0 commit comments

Comments
 (0)