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

Add type restriction and conversion to YAML::PullParser#location #10997

Conversation

straight-shoota
Copy link
Member

YAML::PullParser location numbers are Int because of SizeT in LibYAML::Mark properties. This patch casts the return types to Int32. This is technically a breaking change, because it was previously UInt64 on 64-bit systems and UInt32 on 32-bit.

Most methods already had a type restriction of Int. Narrowing that to Int32 should technically be fine, but it can still break code expecting the return value to be some UInt (because the compiler does not use the type restriction for determining the return type, it just makes sure the actual return type fulfills the restriction).
#location itself had no prior type restriction at all and returned {LibC::SizeT, LibC::SizeT}. Changing that to {Int32, Int32} is a pretty hard change. I wouldn't expect much collateral from changing it though.

Question is if we can accept this as a necessary bug fix for a minor release.

See #10645 (comment)

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. breaking-change topic:stdlib:serialization labels Jul 23, 2021
@straight-shoota straight-shoota added this to the 1.2.0 milestone Jul 29, 2021
@straight-shoota straight-shoota merged commit 4673e76 into crystal-lang:master Aug 1, 2021
@straight-shoota straight-shoota deleted the fix/yaml-pull_parser-location branch August 1, 2021 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:serialization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants