Skip to content

Commit

Permalink
Remove property-override-method error (#34494)
Browse files Browse the repository at this point in the history
Originally removed incorrectly along with method-override-property error
in #24343, then both were restored in #33509. Only
method-override-property should be an error, since it doesn't actually
work at runtime.
  • Loading branch information
sandersn authored Oct 15, 2019
1 parent d8d5ead commit ab56cc0
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 79 deletions.
10 changes: 4 additions & 6 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31692,15 +31692,13 @@ namespace ts {
}
}
else if (isPrototypeProperty(base)) {
if (isPrototypeProperty(derived)) {
// method is overridden with method -- correct case
if (isPrototypeProperty(derived) || derived.flags & SymbolFlags.Property) {
// method is overridden with method or property -- correct case
continue;
}
else if (derived.flags & SymbolFlags.Accessor) {
errorMessage = Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
}
else {
errorMessage = Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property;
Debug.assert(!!(derived.flags & SymbolFlags.Accessor));
errorMessage = Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
}
}
else if (base.flags & SymbolFlags.Accessor) {
Expand Down
4 changes: 0 additions & 4 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1561,10 +1561,6 @@
"category": "Error",
"code": 2423
},
"Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.": {
"category": "Error",
"code": 2424
},
"Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": {
"category": "Error",
"code": 2425
Expand Down
25 changes: 0 additions & 25 deletions tests/baselines/reference/checkJsFiles_noErrorLocation.errors.txt

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions tests/baselines/reference/propertyOverridesMethod.errors.txt

This file was deleted.

16 changes: 0 additions & 16 deletions tests/baselines/reference/propertyOverridingPrototype.errors.txt

This file was deleted.

0 comments on commit ab56cc0

Please sign in to comment.