diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7f20c542128..b9f603d5c9b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12119,8 +12119,8 @@ namespace ts { const symbol = getSymbolOfNode(node); const localSymbol = node.localSymbol || symbol; - // Since the javascript won't do semantic analysis like typescript, - // if the javascript file comes before the typescript file and both contain same name functions, + // Since the javascript won't do semantic analysis like typescript, + // if the javascript file comes before the typescript file and both contain same name functions, // checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function. const firstDeclaration = forEach(localSymbol.declarations, // Get first non javascript function declaration @@ -14370,6 +14370,7 @@ namespace ts { emitExtends = false; emitDecorate = false; emitParam = false; + emitAwaiter = false; potentialThisCollisions.length = 0; forEach(node.statements, checkSourceElement); diff --git a/tests/baselines/reference/asyncMultiFile.js b/tests/baselines/reference/asyncMultiFile.js new file mode 100644 index 00000000000..e93dc586255 --- /dev/null +++ b/tests/baselines/reference/asyncMultiFile.js @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/async/es6/asyncMultiFile.ts] //// + +//// [a.ts] +async function f() {} +//// [b.ts] +function g() { } + +//// [a.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) { + return new Promise(function (resolve, reject) { + generator = generator.call(thisArg, _arguments); + function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); } + function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } } + function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } } + function step(verb, value) { + var result = generator[verb](value); + result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject); + } + step("next", void 0); + }); +}; +function f() { + return __awaiter(this, void 0, Promise, function* () { }); +} +//// [b.js] +function g() { } diff --git a/tests/baselines/reference/asyncMultiFile.symbols b/tests/baselines/reference/asyncMultiFile.symbols new file mode 100644 index 00000000000..790ceafef8f --- /dev/null +++ b/tests/baselines/reference/asyncMultiFile.symbols @@ -0,0 +1,8 @@ +=== tests/cases/conformance/async/es6/a.ts === +async function f() {} +>f : Symbol(f, Decl(a.ts, 0, 0)) + +=== tests/cases/conformance/async/es6/b.ts === +function g() { } +>g : Symbol(g, Decl(b.ts, 0, 0)) + diff --git a/tests/baselines/reference/asyncMultiFile.types b/tests/baselines/reference/asyncMultiFile.types new file mode 100644 index 00000000000..70eebc0577a --- /dev/null +++ b/tests/baselines/reference/asyncMultiFile.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/async/es6/a.ts === +async function f() {} +>f : () => Promise + +=== tests/cases/conformance/async/es6/b.ts === +function g() { } +>g : () => void + diff --git a/tests/cases/conformance/async/es6/asyncMultiFile.ts b/tests/cases/conformance/async/es6/asyncMultiFile.ts new file mode 100644 index 00000000000..55f5e4b9e92 --- /dev/null +++ b/tests/cases/conformance/async/es6/asyncMultiFile.ts @@ -0,0 +1,5 @@ +// @target: es6 +// @filename: a.ts +async function f() {} +// @filename: b.ts +function g() { } \ No newline at end of file