Check that private properties originate in the same declaration

This commit is contained in:
Jason Freeman
2014-09-11 18:08:10 -07:00
parent 1eb924f2d6
commit ba574725c2
4 changed files with 90 additions and 4 deletions

View File

@@ -2888,10 +2888,12 @@ module ts {
}
if (getDeclarationFlagsFromSymbol(sourceProp) & NodeFlags.Private || getDeclarationFlagsFromSymbol(targetProp) & NodeFlags.Private) {
if (reportErrors) {
reportError(Diagnostics.Private_property_0_cannot_be_reimplemented, symbolToString(targetProp));
if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) {
if (reportErrors) {
reportError(Diagnostics.Private_property_0_cannot_be_reimplemented, symbolToString(targetProp));
}
return false;
}
return false;
}
if (!isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors)) {
if (reportErrors) {
@@ -4338,7 +4340,7 @@ module ts {
var widenedType = getWidenedType(exprType, /*supressNoImplicitAnyErrors*/ true);
if (!(isTypeAssignableTo(targetType, widenedType))) {
checkTypeAssignableTo(exprType, targetType, node, Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other_Colon, Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other);
}
}
}
return targetType;
}