Skip to content

Commit b01a050

Browse files
committed
Update error message as requested in PR comments
1 parent 02fc8b1 commit b01a050

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12052,7 +12052,7 @@ namespace ts {
1205212052
error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility);
1205312053
}
1205412054
if (((node.flags & NodeFlags.Abstract) !== (otherAccessor.flags & NodeFlags.Abstract))) {
12055-
error(node.name, Diagnostics.Accessors_must_both_be_abstract_or_not_abstract);
12055+
error(node.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
1205612056
}
1205712057

1205812058
const currentAccessorType = getAnnotatedAccessorType(node);

src/compiler/diagnosticMessages.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1843,7 +1843,7 @@
18431843
"category": "Error",
18441844
"code": 2675
18451845
},
1846-
"Accessors must both be abstract or not abstract.": {
1846+
"Accessors must both be abstract or non-abstract.": {
18471847
"category": "Error",
18481848
"code": 2676
18491849
},

tests/baselines/reference/abstractPropertyNegative.errors.txt

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ tests/cases/compiler/abstractPropertyNegative.ts(30,7): error TS2415: Class 'Wro
1616
tests/cases/compiler/abstractPropertyNegative.ts(33,7): error TS2415: Class 'WrongTypeAccessorImpl2' incorrectly extends base class 'WrongTypeAccessor'.
1717
Types of property 'num' are incompatible.
1818
Type 'string' is not assignable to type 'number'.
19-
tests/cases/compiler/abstractPropertyNegative.ts(38,18): error TS2676: Accessors must both be abstract or not abstract.
20-
tests/cases/compiler/abstractPropertyNegative.ts(39,9): error TS2676: Accessors must both be abstract or not abstract.
21-
tests/cases/compiler/abstractPropertyNegative.ts(40,9): error TS2676: Accessors must both be abstract or not abstract.
22-
tests/cases/compiler/abstractPropertyNegative.ts(41,18): error TS2676: Accessors must both be abstract or not abstract.
19+
tests/cases/compiler/abstractPropertyNegative.ts(38,18): error TS2676: Accessors must both be abstract or non-abstract.
20+
tests/cases/compiler/abstractPropertyNegative.ts(39,9): error TS2676: Accessors must both be abstract or non-abstract.
21+
tests/cases/compiler/abstractPropertyNegative.ts(40,9): error TS2676: Accessors must both be abstract or non-abstract.
22+
tests/cases/compiler/abstractPropertyNegative.ts(41,18): error TS2676: Accessors must both be abstract or non-abstract.
2323

2424

2525
==== tests/cases/compiler/abstractPropertyNegative.ts (16 errors) ====
@@ -92,15 +92,15 @@ tests/cases/compiler/abstractPropertyNegative.ts(41,18): error TS2676: Accessors
9292
abstract class AbstractAccessorMismatch {
9393
abstract get p1(): string;
9494
~~
95-
!!! error TS2676: Accessors must both be abstract or not abstract.
95+
!!! error TS2676: Accessors must both be abstract or non-abstract.
9696
set p1(val: string) { };
9797
~~
98-
!!! error TS2676: Accessors must both be abstract or not abstract.
98+
!!! error TS2676: Accessors must both be abstract or non-abstract.
9999
get p2(): string { return "should work"; }
100100
~~
101-
!!! error TS2676: Accessors must both be abstract or not abstract.
101+
!!! error TS2676: Accessors must both be abstract or non-abstract.
102102
abstract set p2(val: string);
103103
~~
104-
!!! error TS2676: Accessors must both be abstract or not abstract.
104+
!!! error TS2676: Accessors must both be abstract or non-abstract.
105105
}
106106

0 commit comments

Comments
 (0)