Skip to content

Fixes #5564. #5840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ namespace ts {
}

// Because of module/namespace merging, a module's exports are in scope,
// yet we never want to treat an export specifier as putting a member in scope.
// yet we never want to treat an export specifier as putting a member in scope.
// Therefore, if the name we find is purely an export specifier, it is not actually considered in scope.
// Two things to note about this:
// 1. We have to check this without calling getSymbol. The problem with calling getSymbol
Expand Down Expand Up @@ -11398,7 +11398,7 @@ namespace ts {
// we can get here in two cases
// 1. mixed static and instance class members
// 2. something with the same name was defined before the set of overloads that prevents them from merging
// here we'll report error only for the first case since for second we should already report error in binder
// here we'll report error only for the first case since for second we should already report error in binder
if (reportError) {
const diagnostic = node.flags & NodeFlags.Static ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
error(errorNode, diagnostic);
Expand Down Expand Up @@ -12065,8 +12065,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
Expand Down Expand Up @@ -14321,6 +14321,7 @@ namespace ts {
emitExtends = false;
emitDecorate = false;
emitParam = false;
emitAwaiter = false;
potentialThisCollisions.length = 0;

forEach(node.statements, checkSourceElement);
Expand Down
26 changes: 26 additions & 0 deletions tests/baselines/reference/asyncMultiFile.js
Original file line number Diff line number Diff line change
@@ -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() { }
8 changes: 8 additions & 0 deletions tests/baselines/reference/asyncMultiFile.symbols
Original file line number Diff line number Diff line change
@@ -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))

8 changes: 8 additions & 0 deletions tests/baselines/reference/asyncMultiFile.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=== tests/cases/conformance/async/es6/a.ts ===
async function f() {}
>f : () => Promise<void>

=== tests/cases/conformance/async/es6/b.ts ===
function g() { }
>g : () => void

5 changes: 5 additions & 0 deletions tests/cases/conformance/async/es6/asyncMultiFile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// @target: es6
// @filename: a.ts
async function f() {}
// @filename: b.ts
function g() { }