Skip to content

Commit a264cea

Browse files
committed
Merge pull request microsoft#7268 from RyanCavanaugh/fix7063
Don't error on duplicate prototype property assignments
2 parents 619ed2b + 766439e commit a264cea

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

src/compiler/binder.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,8 @@ namespace ts {
14661466
}
14671467

14681468
// Declare the method/property
1469-
declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
1469+
// It's acceptable for multiple prototype property assignments of the same identifier to occur
1470+
declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
14701471
}
14711472

14721473
function bindCallExpression(node: CallExpression) {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
///<reference path="fourslash.ts" />
2+
3+
// @allowNonTsExtensions: true
4+
// @Filename: Foo.js
5+
6+
//// function fn() {
7+
//// this.foo = 10;
8+
//// }
9+
//// fn.prototype.foo = 14;
10+
//// var x = new fn();
11+
////
12+
//// function fn2() {
13+
//// this.foo = 10;
14+
//// this.foo = 10;
15+
//// }
16+
//// fn2.prototype.foo = 14;
17+
//// fn2.prototype.foo = 14;
18+
//// var y = new fn2();
19+
////
20+
//// function fn3() {
21+
//// this.foo = 10;
22+
//// }
23+
//// fn3.prototype.foo = 14;
24+
//// fn3.prototype.foo = 14;
25+
//// var z = new fn3();
26+
27+
verify.numberOfErrorsInCurrentFile(0);
28+

0 commit comments

Comments
 (0)