-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Enforce identical enum values in compatibility checks #55924
Conversation
@typescript-bot pack this |
Heya @DanielRosenwasser, I've started to run the parallelized Definitely Typed test suite on this PR at 41e7790. You can monitor the build here. Update: The results are in! |
Heya @DanielRosenwasser, I've started to run the regular perf test suite on this PR at 41e7790. You can monitor the build here. Update: The results are in! |
Heya @DanielRosenwasser, I've started to run the diff-based top-repos suite on this PR at 41e7790. You can monitor the build here. Update: The results are in! |
Heya @DanielRosenwasser, I've started to run the tarball bundle task on this PR at 41e7790. You can monitor the build here. |
Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
@DanielRosenwasser Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
StartupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
Hey @DanielRosenwasser, the results of running the DT tests are ready. |
@DanielRosenwasser Here are the results of running the top-repos suite comparing Everything looks good! |
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.
I think this is worth trying for 5.4.
src/compiler/diagnosticMessages.json
Outdated
@@ -4132,6 +4132,10 @@ | |||
"category": "Error", | |||
"code": 4124 | |||
}, | |||
"The values of '{0}.{1}' differ in their declarations, where '{2}' was expected but '{3}' was given.": { |
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.
'First.E.c' has value '2' but 'Decl.E.c' has value '3'.
"The values of '{0}.{1}' differ in their declarations, where '{2}' was expected but '{3}' was given.": { | |
"'{0}.{1}' has value '{2}', but '{3}.{1}' has value '{4}'.": { |
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.
The problem is that each of them have identical names between members and enums 😄
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.
Unless I fully qualified the name - but the earlier error message will have done that anyway.
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.
I agree with Nathan's suggestion that it would be better to use the fully qualified names when talking about the members and the different values, even though you can figure it out with the current error message + elaboration.
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.
It's definitely redundant, but the redundancy makes it easier to read in this case because there's less context to piece together, and less work to do overall to read the message.
@typescript-bot test this |
Heya @DanielRosenwasser, I've started to run the diff-based top-repos suite on this PR at b2033b3. You can monitor the build here. Update: The results are in! |
@DanielRosenwasser Here are the results of running the top-repos suite comparing Everything looks good! |
@typescript-bot pack this |
Heya @DanielRosenwasser, I've started to run the parallelized Definitely Typed test suite on this PR at af7f5b8. You can monitor the build here. Update: The results are in! |
Heya @DanielRosenwasser, I've started to run the regular perf test suite on this PR at af7f5b8. You can monitor the build here. Update: The results are in! |
Heya @DanielRosenwasser, I've started to run the tarball bundle task on this PR at af7f5b8. You can monitor the build here. |
Heya @DanielRosenwasser, I've started to run the diff-based top-repos suite on this PR at af7f5b8. You can monitor the build here. Update: The results are in! |
Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
@DanielRosenwasser Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
StartupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
Hey @DanielRosenwasser, the results of running the DT tests are ready. |
@DanielRosenwasser Here are the results of running the top-repos suite comparing Everything looks good! |
Fixes #55915.
This change proposes a new check for compatibility between two distinct enum declarations. On top of previous expectations around enum compatibility, where
this change checks that each enum member in the source must have a known value, and that value must have an identical known value in the target.
You can view some examples here.
You can also see these in action in a recent playground build.Important
This is an update that the aforementioned playground link and examples reflect older behavior where known values were incompatible with unknown values. Check the introduced tests to get a sense of the new behavior.