Fix reporting an error on block-scope for module

This commit is contained in:
Yui T
2015-07-20 22:40:24 -07:00
parent 96b02a83ca
commit e960e0ddd2

View File

@@ -573,7 +573,16 @@ 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.Variable && result.flags & SymbolFlags.BlockScopedVariable) {
checkResolvedBlockScopedVariable(result, errorLocation);
}
}
@@ -4256,11 +4265,11 @@ namespace ts {
return getInferredType(context, i);
}
}
return t;
return t;
};
mapper.context = context;
return mapper;
return mapper;
}
function identityMapper(type: Type): Type {