mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-14 07:02:44 -05:00
"No repeated property names" error in object literals is duplicated in strict mode (#46929)
* "No repeated property names" error in object literals is duplicated in strict mode * fix indent
This commit is contained in:
@@ -2066,12 +2066,6 @@ namespace ts {
|
||||
seen.set(identifier.escapedText, currentKind);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (currentKind === ElementKind.Property && existingKind === ElementKind.Property) {
|
||||
const span = getErrorSpanForNode(file, identifier);
|
||||
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length,
|
||||
Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43126,9 +43126,12 @@ namespace ts {
|
||||
seen.set(effectiveName, currentKind);
|
||||
}
|
||||
else {
|
||||
if ((currentKind & DeclarationMeaning.PropertyAssignmentOrMethod) && (existingKind & DeclarationMeaning.PropertyAssignmentOrMethod)) {
|
||||
if ((currentKind & DeclarationMeaning.Method) && (existingKind & DeclarationMeaning.Method)) {
|
||||
grammarErrorOnNode(name, Diagnostics.Duplicate_identifier_0, getTextOfNode(name));
|
||||
}
|
||||
else if ((currentKind & DeclarationMeaning.PropertyAssignment) && (existingKind & DeclarationMeaning.PropertyAssignment)) {
|
||||
grammarErrorOnNode(name, Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name, getTextOfNode(name));
|
||||
}
|
||||
else if ((currentKind & DeclarationMeaning.GetOrSetAccessor) && (existingKind & DeclarationMeaning.GetOrSetAccessor)) {
|
||||
if (existingKind !== DeclarationMeaning.GetOrSetAccessor && currentKind !== existingKind) {
|
||||
seen.set(effectiveName, currentKind | existingKind);
|
||||
|
||||
@@ -335,7 +335,7 @@
|
||||
"category": "Error",
|
||||
"code": 1116
|
||||
},
|
||||
"An object literal cannot have multiple properties with the same name in strict mode.": {
|
||||
"An object literal cannot have multiple properties with the same name.": {
|
||||
"category": "Error",
|
||||
"code": 1117
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user