Skip to content
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

Assign to properties with explicit self in encode(to encoder: any Encoder) #698

Conversation

Dragna
Copy link

@Dragna Dragna commented Dec 11, 2024

Motivation

The generated encode(to encoder: any Encoder) assigns to properties without using explicit self. This is a problem because it can produce conflicts with the local variables created in the function, e.g. the encoding container, which will then fail to compile for schemas with properties named container, as found in #695.

Modifications

  • Assign to properties with explicit self in encode(to encoder: any Encoder)

Test Plan

  • Update the reference tests.

@simonjbeaumont it seems to be working on my project with this change, sadly I didn't know what updates I should make for the snippet tests 😕. I you have any insight on this that would be helpful 🙏 .

Copy link

@djnivek djnivek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! 👏

@simonjbeaumont
Copy link
Collaborator

@Dragna thanks for taking the time to put the patch up. I think we raced on this one. There's another PR up which adds the relevant snippet and reference tests: #699.

@simonjbeaumont simonjbeaumont added the 🔨 semver/patch No public API change. label Dec 11, 2024
@Dragna Dragna closed this Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants