Skip to content

Commit 61c6ecb

Browse files
authored
Tests for #17371 (#17373)
1 parent 5b77ef8 commit 61c6ecb

File tree

52 files changed

+3694
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3694
-0
lines changed
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
//// [test.ts]
2+
export async function fn() {
3+
const req = await import('./test') // ONE
4+
}
5+
6+
export class cl1 {
7+
public async m() {
8+
const req = await import('./test') // TWO
9+
}
10+
}
11+
12+
export const obj = {
13+
m: async () => {
14+
const req = await import('./test') // THREE
15+
}
16+
}
17+
18+
export class cl2 {
19+
public p = {
20+
m: async () => {
21+
const req = await import('./test') // FOUR
22+
}
23+
}
24+
}
25+
26+
export const l = async () => {
27+
const req = await import('./test') // FIVE
28+
}
29+
30+
31+
//// [test.js]
32+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
33+
return new (P || (P = Promise))(function (resolve, reject) {
34+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
35+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
36+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
37+
step((generator = generator.apply(thisArg, _arguments || [])).next());
38+
});
39+
};
40+
var __generator = (this && this.__generator) || function (thisArg, body) {
41+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
42+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
43+
function verb(n) { return function (v) { return step([n, v]); }; }
44+
function step(op) {
45+
if (f) throw new TypeError("Generator is already executing.");
46+
while (_) try {
47+
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
48+
if (y = 0, t) op = [0, t.value];
49+
switch (op[0]) {
50+
case 0: case 1: t = op; break;
51+
case 4: _.label++; return { value: op[1], done: false };
52+
case 5: _.label++; y = op[1]; op = [0]; continue;
53+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
54+
default:
55+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
56+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
57+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
58+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
59+
if (t[2]) _.ops.pop();
60+
_.trys.pop(); continue;
61+
}
62+
op = body.call(thisArg, _);
63+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
64+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
65+
}
66+
};
67+
define(["require", "exports"], function (require, exports) {
68+
"use strict";
69+
var _this = this;
70+
exports.__esModule = true;
71+
function fn() {
72+
return __awaiter(this, void 0, void 0, function () {
73+
var req;
74+
return __generator(this, function (_a) {
75+
switch (_a.label) {
76+
case 0: return [4 /*yield*/, new Promise(function (resolve_1, reject_1) { require(['./test'], resolve_1, reject_1); })]; // ONE
77+
case 1:
78+
req = _a.sent() // ONE
79+
;
80+
return [2 /*return*/];
81+
}
82+
});
83+
});
84+
}
85+
exports.fn = fn;
86+
var cl1 = (function () {
87+
function cl1() {
88+
}
89+
cl1.prototype.m = function () {
90+
return __awaiter(this, void 0, void 0, function () {
91+
var req;
92+
return __generator(this, function (_a) {
93+
switch (_a.label) {
94+
case 0: return [4 /*yield*/, new Promise(function (resolve_2, reject_2) { require(['./test'], resolve_2, reject_2); })]; // TWO
95+
case 1:
96+
req = _a.sent() // TWO
97+
;
98+
return [2 /*return*/];
99+
}
100+
});
101+
});
102+
};
103+
return cl1;
104+
}());
105+
exports.cl1 = cl1;
106+
exports.obj = {
107+
m: function () { return __awaiter(_this, void 0, void 0, function () {
108+
var req;
109+
return __generator(this, function (_a) {
110+
switch (_a.label) {
111+
case 0: return [4 /*yield*/, new Promise(function (resolve_3, reject_3) { require(['./test'], resolve_3, reject_3); })]; // THREE
112+
case 1:
113+
req = _a.sent() // THREE
114+
;
115+
return [2 /*return*/];
116+
}
117+
});
118+
}); }
119+
};
120+
var cl2 = (function () {
121+
function cl2() {
122+
var _this = this;
123+
this.p = {
124+
m: function () { return __awaiter(_this, void 0, void 0, function () {
125+
var req;
126+
return __generator(this, function (_a) {
127+
switch (_a.label) {
128+
case 0: return [4 /*yield*/, new Promise(function (resolve_4, reject_4) { require(['./test'], resolve_4, reject_4); })]; // FOUR
129+
case 1:
130+
req = _a.sent() // FOUR
131+
;
132+
return [2 /*return*/];
133+
}
134+
});
135+
}); }
136+
};
137+
}
138+
return cl2;
139+
}());
140+
exports.cl2 = cl2;
141+
exports.l = function () { return __awaiter(_this, void 0, void 0, function () {
142+
var req;
143+
return __generator(this, function (_a) {
144+
switch (_a.label) {
145+
case 0: return [4 /*yield*/, new Promise(function (resolve_5, reject_5) { require(['./test'], resolve_5, reject_5); })]; // FIVE
146+
case 1:
147+
req = _a.sent() // FIVE
148+
;
149+
return [2 /*return*/];
150+
}
151+
});
152+
}); };
153+
});
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
=== tests/cases/conformance/dynamicImport/test.ts ===
2+
export async function fn() {
3+
>fn : Symbol(fn, Decl(test.ts, 0, 0))
4+
5+
const req = await import('./test') // ONE
6+
>req : Symbol(req, Decl(test.ts, 1, 9))
7+
>'./test' : Symbol("tests/cases/conformance/dynamicImport/test", Decl(test.ts, 0, 0))
8+
}
9+
10+
export class cl1 {
11+
>cl1 : Symbol(cl1, Decl(test.ts, 2, 1))
12+
13+
public async m() {
14+
>m : Symbol(cl1.m, Decl(test.ts, 4, 18))
15+
16+
const req = await import('./test') // TWO
17+
>req : Symbol(req, Decl(test.ts, 6, 13))
18+
>'./test' : Symbol("tests/cases/conformance/dynamicImport/test", Decl(test.ts, 0, 0))
19+
}
20+
}
21+
22+
export const obj = {
23+
>obj : Symbol(obj, Decl(test.ts, 10, 12))
24+
25+
m: async () => {
26+
>m : Symbol(m, Decl(test.ts, 10, 20))
27+
28+
const req = await import('./test') // THREE
29+
>req : Symbol(req, Decl(test.ts, 12, 13))
30+
>'./test' : Symbol("tests/cases/conformance/dynamicImport/test", Decl(test.ts, 0, 0))
31+
}
32+
}
33+
34+
export class cl2 {
35+
>cl2 : Symbol(cl2, Decl(test.ts, 14, 1))
36+
37+
public p = {
38+
>p : Symbol(cl2.p, Decl(test.ts, 16, 18))
39+
40+
m: async () => {
41+
>m : Symbol(m, Decl(test.ts, 17, 16))
42+
43+
const req = await import('./test') // FOUR
44+
>req : Symbol(req, Decl(test.ts, 19, 17))
45+
>'./test' : Symbol("tests/cases/conformance/dynamicImport/test", Decl(test.ts, 0, 0))
46+
}
47+
}
48+
}
49+
50+
export const l = async () => {
51+
>l : Symbol(l, Decl(test.ts, 24, 12))
52+
53+
const req = await import('./test') // FIVE
54+
>req : Symbol(req, Decl(test.ts, 25, 9))
55+
>'./test' : Symbol("tests/cases/conformance/dynamicImport/test", Decl(test.ts, 0, 0))
56+
}
57+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
=== tests/cases/conformance/dynamicImport/test.ts ===
2+
export async function fn() {
3+
>fn : () => Promise<void>
4+
5+
const req = await import('./test') // ONE
6+
>req : typeof "tests/cases/conformance/dynamicImport/test"
7+
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
8+
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
9+
>'./test' : "./test"
10+
}
11+
12+
export class cl1 {
13+
>cl1 : cl1
14+
15+
public async m() {
16+
>m : () => Promise<void>
17+
18+
const req = await import('./test') // TWO
19+
>req : typeof "tests/cases/conformance/dynamicImport/test"
20+
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
21+
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
22+
>'./test' : "./test"
23+
}
24+
}
25+
26+
export const obj = {
27+
>obj : { m: () => Promise<void>; }
28+
>{ m: async () => { const req = await import('./test') // THREE }} : { m: () => Promise<void>; }
29+
30+
m: async () => {
31+
>m : () => Promise<void>
32+
>async () => { const req = await import('./test') // THREE } : () => Promise<void>
33+
34+
const req = await import('./test') // THREE
35+
>req : typeof "tests/cases/conformance/dynamicImport/test"
36+
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
37+
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
38+
>'./test' : "./test"
39+
}
40+
}
41+
42+
export class cl2 {
43+
>cl2 : cl2
44+
45+
public p = {
46+
>p : { m: () => Promise<void>; }
47+
>{ m: async () => { const req = await import('./test') // FOUR } } : { m: () => Promise<void>; }
48+
49+
m: async () => {
50+
>m : () => Promise<void>
51+
>async () => { const req = await import('./test') // FOUR } : () => Promise<void>
52+
53+
const req = await import('./test') // FOUR
54+
>req : typeof "tests/cases/conformance/dynamicImport/test"
55+
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
56+
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
57+
>'./test' : "./test"
58+
}
59+
}
60+
}
61+
62+
export const l = async () => {
63+
>l : () => Promise<void>
64+
>async () => { const req = await import('./test') // FIVE} : () => Promise<void>
65+
66+
const req = await import('./test') // FIVE
67+
>req : typeof "tests/cases/conformance/dynamicImport/test"
68+
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
69+
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
70+
>'./test' : "./test"
71+
}
72+

0 commit comments

Comments
 (0)