-
Notifications
You must be signed in to change notification settings - Fork 13k
Changed "Duplicate Identifier" to "enum cannot be merged..." #18579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ca89bd9
to
1ac2b8f
Compare
@DanielRosenwasser can i get your input on the proposed error message here? |
@DanielRosenwasser If you OK the message, I'll rebase the PR and we can merge it^^. |
src/compiler/diagnosticMessages.json
Outdated
"category": "Error", | ||
"code": 2563 | ||
}, | ||
"An enum cannot be merged with a class, interface, function, namespace or variable.": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about Enum declarations can only merge with namespace or other enum declarations.
when either declaration of the identifier is an enum. Partial (?) fix for microsoft#529 Not sure if the new test is necessary, all the cases seem to have been covered by others tests.
1ac2b8f
to
8d4bd48
Compare
@mhegazy "Enum declarations can only merge with namespace or other enum declarations." definitely seems better. I rebased and changed it. |
src/compiler/checker.ts
Outdated
else { | ||
const message = target.flags & SymbolFlags.BlockScopedVariable || source.flags & SymbolFlags.BlockScopedVariable | ||
? Diagnostics.Cannot_redeclare_block_scoped_variable_0 : Diagnostics.Duplicate_identifier_0; | ||
let message = Diagnostics.Duplicate_identifier_0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
const message = target.flags & SymbolFlags.Enum || source.flags & SymbolFlags.Enum
? Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declaration
: target.flags & SymbolFlags.BlockScopedVariable || source.flags & SymbolFlags.BlockScopedVariable
? Diagnostics.Cannot_redeclare_block_scoped_variable_0
: Diagnostics.Duplicate_identifier_0;
thanks! |
when either declaration of the identifier is an enum.
Partial (?) fix for #529