Merge pull request #3946 from Microsoft/disambiguating

Fix resolution when block-scoped variable names collide with those of other entities
This commit is contained in:
Yui
2015-07-28 16:01:48 -07:00
21 changed files with 230 additions and 1 deletions
+13 -1
View File
@@ -592,7 +592,19 @@ namespace ts {
declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg));
return undefined;
}
if (result.flags & SymbolFlags.BlockScopedVariable) {
// Only check for block-scoped variable if we are looking for the
// name with variable meaning
// For example,
// declare module foo {
// interface bar {}
// }
// let foo/*1*/: foo/*2*/.bar;
// The foo at /*1*/ and /*2*/ will share same symbol with two meaning
// block - scope variable and namespace module. However, only when we
// try to resolve name in /*1*/ which is used in variable position,
// we want to check for block- scoped
if (meaning & SymbolFlags.BlockScopedVariable && result.flags & SymbolFlags.BlockScopedVariable) {
checkResolvedBlockScopedVariable(result, errorLocation);
}
}