From 8334aeac4dba023c19a77cfb31f5318d46af91be Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 26 Feb 2016 14:58:01 -0800 Subject: [PATCH] Don't error on duplicate prototype property assignments Fixes #7063 --- src/compiler/binder.ts | 2 +- tests/cases/fourslash/jsDocClasses1.ts | 28 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/jsDocClasses1.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 933381afa92..43feb6008cf 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1465,7 +1465,7 @@ namespace ts { } // Declare the method/property - declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes); + declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property); } function bindCallExpression(node: CallExpression) { diff --git a/tests/cases/fourslash/jsDocClasses1.ts b/tests/cases/fourslash/jsDocClasses1.ts new file mode 100644 index 00000000000..c68afa0e14b --- /dev/null +++ b/tests/cases/fourslash/jsDocClasses1.ts @@ -0,0 +1,28 @@ +/// + +// @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); +