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

fix: Jenny now always stringifies whole numbers without .0 #2265

Merged
merged 2 commits into from
Jan 12, 2023

Conversation

st-pasha
Copy link
Contributor

Description

The YarnSpinner language supports variables of type numeric, but not integers or doubles. The closest concept in Dart is the num type, which is a union of int and double. However, we need to make sure that a number stringifies in a consistent manner regardless of whether its underlying representation is integer or double. Thus, we must make sure that 12 and 12.0 not only compare equal (which they already do), but also have the same representation when converted to string.

This PR ensures that any integer-like double looks like an integer when converted to a string.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • [-] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • [-] I have updated/added relevant examples in examples or docs.

Breaking Change?

  • No, this PR is not a breaking change.

@st-pasha st-pasha added the jenny Issues/PRs related to the Jenny package label Jan 12, 2023
@spydon spydon enabled auto-merge (squash) January 12, 2023 08:35
@spydon spydon merged commit f262b7e into main Jan 12, 2023
@spydon spydon deleted the ps.stringify-whole-numbers branch January 12, 2023 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jenny Issues/PRs related to the Jenny package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants