Merge pull request #17025 from Microsoft/master-16763
[Master] Fix 16763
This commit is contained in:
commit
1c93531f0f
6 changed files with 98 additions and 2 deletions
|
@ -5121,6 +5121,7 @@ namespace ts {
|
|||
|| kind === SyntaxKind.ThisKeyword
|
||||
|| kind === SyntaxKind.TrueKeyword
|
||||
|| kind === SyntaxKind.SuperKeyword
|
||||
|| kind === SyntaxKind.ImportKeyword
|
||||
|| kind === SyntaxKind.NonNullExpression
|
||||
|| kind === SyntaxKind.MetaProperty;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
//// [importCallExpressionShouldNotGetParen.ts]
|
||||
const localeName = "zh-CN";
|
||||
import(`./locales/${localeName}.js`).then(bar => {
|
||||
let x = bar;
|
||||
});
|
||||
|
||||
import("./locales/" + localeName + ".js").then(bar => {
|
||||
let x = bar;
|
||||
});
|
||||
|
||||
//// [importCallExpressionShouldNotGetParen.js]
|
||||
const localeName = "zh-CN";
|
||||
import(`./locales/${localeName}.js`).then(bar => {
|
||||
let x = bar;
|
||||
});
|
||||
import("./locales/" + localeName + ".js").then(bar => {
|
||||
let x = bar;
|
||||
});
|
|
@ -0,0 +1,27 @@
|
|||
=== tests/cases/conformance/dynamicImport/importCallExpressionShouldNotGetParen.ts ===
|
||||
const localeName = "zh-CN";
|
||||
>localeName : Symbol(localeName, Decl(importCallExpressionShouldNotGetParen.ts, 0, 5))
|
||||
|
||||
import(`./locales/${localeName}.js`).then(bar => {
|
||||
>import(`./locales/${localeName}.js`).then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
|
||||
>localeName : Symbol(localeName, Decl(importCallExpressionShouldNotGetParen.ts, 0, 5))
|
||||
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
|
||||
>bar : Symbol(bar, Decl(importCallExpressionShouldNotGetParen.ts, 1, 42))
|
||||
|
||||
let x = bar;
|
||||
>x : Symbol(x, Decl(importCallExpressionShouldNotGetParen.ts, 2, 7))
|
||||
>bar : Symbol(bar, Decl(importCallExpressionShouldNotGetParen.ts, 1, 42))
|
||||
|
||||
});
|
||||
|
||||
import("./locales/" + localeName + ".js").then(bar => {
|
||||
>import("./locales/" + localeName + ".js").then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
|
||||
>localeName : Symbol(localeName, Decl(importCallExpressionShouldNotGetParen.ts, 0, 5))
|
||||
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
|
||||
>bar : Symbol(bar, Decl(importCallExpressionShouldNotGetParen.ts, 5, 47))
|
||||
|
||||
let x = bar;
|
||||
>x : Symbol(x, Decl(importCallExpressionShouldNotGetParen.ts, 6, 7))
|
||||
>bar : Symbol(bar, Decl(importCallExpressionShouldNotGetParen.ts, 5, 47))
|
||||
|
||||
});
|
|
@ -0,0 +1,39 @@
|
|||
=== tests/cases/conformance/dynamicImport/importCallExpressionShouldNotGetParen.ts ===
|
||||
const localeName = "zh-CN";
|
||||
>localeName : "zh-CN"
|
||||
>"zh-CN" : "zh-CN"
|
||||
|
||||
import(`./locales/${localeName}.js`).then(bar => {
|
||||
>import(`./locales/${localeName}.js`).then(bar => { let x = bar;}) : Promise<void>
|
||||
>import(`./locales/${localeName}.js`).then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>import(`./locales/${localeName}.js`) : Promise<any>
|
||||
>`./locales/${localeName}.js` : string
|
||||
>localeName : "zh-CN"
|
||||
>then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>bar => { let x = bar;} : (bar: any) => void
|
||||
>bar : any
|
||||
|
||||
let x = bar;
|
||||
>x : any
|
||||
>bar : any
|
||||
|
||||
});
|
||||
|
||||
import("./locales/" + localeName + ".js").then(bar => {
|
||||
>import("./locales/" + localeName + ".js").then(bar => { let x = bar;}) : Promise<void>
|
||||
>import("./locales/" + localeName + ".js").then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>import("./locales/" + localeName + ".js") : Promise<any>
|
||||
>"./locales/" + localeName + ".js" : string
|
||||
>"./locales/" + localeName : string
|
||||
>"./locales/" : "./locales/"
|
||||
>localeName : "zh-CN"
|
||||
>".js" : ".js"
|
||||
>then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>bar => { let x = bar;} : (bar: any) => void
|
||||
>bar : any
|
||||
|
||||
let x = bar;
|
||||
>x : any
|
||||
>bar : any
|
||||
|
||||
});
|
|
@ -18,5 +18,5 @@ function foo() { return "foo"; }
|
|||
exports.foo = foo;
|
||||
//// [1.js]
|
||||
"use strict";
|
||||
var p1 = (import)("./0"); // error
|
||||
var p2 = (import)("./0"); // error
|
||||
var p1 = Promise.resolve().then(function () { return require("./0"); }); // error
|
||||
var p2 = Promise.resolve().then(function () { return require("./0"); }); // error
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// @module: esnext
|
||||
// @target: es6
|
||||
// @noImplicitAny: true
|
||||
const localeName = "zh-CN";
|
||||
import(`./locales/${localeName}.js`).then(bar => {
|
||||
let x = bar;
|
||||
});
|
||||
|
||||
import("./locales/" + localeName + ".js").then(bar => {
|
||||
let x = bar;
|
||||
});
|
Loading…
Reference in a new issue