Skip to content

Commit

Permalink
Do not error in comm code generator when 'name' property present in o…
Browse files Browse the repository at this point in the history
…bject that has enum (#5645)

Addresses #2139. This isn't causing active harm, but a sharp edge that
will hit comm developers with a confusing error message when an object
property is called "name" and there is another property that is an enum.
I tested this out with the example from the linked issue and it works
correctly. I also checked that this change does not impact any of the
generated comm code.
  • Loading branch information
wesm authored Dec 6, 2024
1 parent c46e44b commit be57de1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion positron/comms/generate-comms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ function* enumVisitor(
} else if (typeof contract === 'object') {
// If this object is an object, recurse into each property
for (const key of Object.keys(contract)) {
if (contract['name']) {
if (contract['name'] && typeof contract['name'] === 'string') {
// If this is a named object, push the name onto the context
// and recurse
yield* enumVisitor(
Expand Down

0 comments on commit be57de1

Please sign in to comment.