-
-
Notifications
You must be signed in to change notification settings - Fork 758
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
ICU-21947 Replace FixedDecimal with DecimalQuantity in PluralRule sample parsing #2007
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you ensure that CLDR can build with these changes? (You can't delete FixedDecimal, etc. unless that is true.)
Yes, I haven't yet gotten to the CLDR part, but you're right, this shouldn't be merged without testing it together with a PR on the CLDR side. FYI, Another FYI, the file that this PR is attempting to remove is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too disruptive of a change to land right now, and C++ is not done. I suggest holding this until at least after RC.
icu4j/main/classes/core/src/com/ibm/icu/impl/number/DecimalQuantity_AbstractBCD.java
Outdated
Show resolved
Hide resolved
icu4j/main/classes/core/src/com/ibm/icu/impl/number/DecimalQuantity_DualStorageBCD.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know what you think of these changes to the ICU side of work based on the review feedback so far.
FYI, in parallel, I'm working on the CLDR side of work, over in PR #1800. I've managed to reverse-engineer the instructions for how to do this type of ICU-CLDR tandem development, I've gotten the tests to compile, and I've gotten test failures down to 6 cases across 2 tests.
icu4j/main/classes/core/src/com/ibm/icu/impl/number/DecimalQuantity_DualStorageBCD.java
Outdated
Show resolved
Hide resolved
icu4j/main/classes/core/src/com/ibm/icu/impl/number/DecimalQuantity_AbstractBCD.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done with PluralRules.java
A good test would be that each of the samples in the plural and ordinal
rules in CLDR round-trip; you get exactly the same results from ICU code.
This doesn't fully test what CLDR does, because it also *selects* the
samples using code that depends on FixedDecimal — but it goes a long way,
and lets you iterate in the ICU environment in case there are problems.
…On Fri, Mar 18, 2022 at 8:15 AM Shane F. Carr ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In icu4j/main/classes/core/src/com/ibm/icu/text/PluralRules.java
<#2007 (comment)>:
> @@ -1225,10 +1225,12 @@ static DecimalQuantitySamples parse(String source) {
}
private static void checkDecimal(SampleType sampleType2, DecimalQuantity sample) {
- if ((sampleType2 == SampleType.INTEGER && sample.getPluralOperand(Operand.v) != 0) ||
- (sampleType2 == SampleType.DECIMAL && sample.getPluralOperand(Operand.v) == 0
- && sample.getPluralOperand(Operand.e) == 0
- && sample.getPluralOperand(Operand.n) != 0)) { // is this double == 0 comparison fine? I think it is, just want to make sure.
+ // TODO: Remove the need for the fallback check for exponent notation integers classified
Nit: TODO(CLDR-15452)
—
Reply to this email directly, view it on GitHub
<#2007 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJLEMFETGUDRJAPLKHBILTVASMY5ANCNFSM5PLBLYBQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
@macchiati I believe that we already have tests in ICU that do what you were describing as occurring in CLDR. I just now added source comments on relevant tests to clarify what each test is actually doing because it is not always obvious. So for the round trip that goes And the CLDR tests are still passing when I run the corresponding CLDR changes unicode-org/cldr#1800 against this PR, via the instructions in the CLDR PR. So long as there are tests in CLDR that cover any extra functionality we are concerned about, then we have checked all the impacts that we know how to check. |
if (!samplesString.matches(".*\\d+e[-]?\\d+.*")) { | ||
assertEquals("samples; " + title, samplesString, samples.toString()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: do a global replacement for e
with c
in samplesString
and then perform the equality check as usual
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/PluralRulesTest.java
Show resolved
Hide resolved
Looks like I approved these changes 6 months ago, and the changes since then look reasonable, so I will approve again :) |
@macchiati You still have the "changes requested" bit set that blocks merging. How does this PR look, and how does the above discussion sound? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good, but I'm concerned about the staging. We use FixedDecimal heavily in CLDR. If that disappears, we would not be able to update to the latest version of ICU until CLDR is fixed to work around it. We're heads-to-the ground trying to get the freeze done by the 17th.
Would it be feasible to leave FixedDecimal around so that we have the chance to get rid of it when the timing is better (and having both of them work at the same time, to ease the migration)?
273b9eb
to
6c1fea4
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rslgtm
Checklist