Merge pull request #7268 from RyanCavanaugh/fix7063

Don't error on duplicate prototype property assignments
This commit is contained in:
Ryan Cavanaugh
2016-03-01 13:57:04 -08:00
2 changed files with 30 additions and 1 deletions

View File

@@ -1466,7 +1466,8 @@ namespace ts {
}
// Declare the method/property
declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
// It's acceptable for multiple prototype property assignments of the same identifier to occur
declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
}
function bindCallExpression(node: CallExpression) {

View File

@@ -0,0 +1,28 @@
///<reference path="fourslash.ts" />
// @allowNonTsExtensions: true
// @Filename: Foo.js
//// function fn() {
//// this.foo = 10;
//// }
//// fn.prototype.foo = 14;
//// var x = new fn();
////
//// function fn2() {
//// this.foo = 10;
//// this.foo = 10;
//// }
//// fn2.prototype.foo = 14;
//// fn2.prototype.foo = 14;
//// var y = new fn2();
////
//// function fn3() {
//// this.foo = 10;
//// }
//// fn3.prototype.foo = 14;
//// fn3.prototype.foo = 14;
//// var z = new fn3();
verify.numberOfErrorsInCurrentFile(0);