Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Treat YAML 1.1 style octals with sign as string, not base 10 number #228

Merged
merged 2 commits into from Dec 13, 2021

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Dec 13, 2021

Previously we'd treat values like 0127 as correctly a string not a number, per the YAML 1.2 spec. However that check did not kick in when there was a sign: -0127 or +0127, and those would end up getting parsed as a base 10 number via u64::from_str or i64::from_str, which is not correct.

The latter two of these currently fail.

    thread 'test_numbers' panicked at 'expected string. input="+0127", result=Number(PosInt(127))', tests/test_de.rs:352:18

    thread 'test_numbers' panicked at 'expected string. input="-0127", result=Number(NegInt(-127))', tests/test_de.rs:352:18
@dtolnay dtolnay merged commit f850da3 into master Dec 13, 2021
@dtolnay dtolnay deleted the octal branch December 13, 2021 04:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant