Skip to content

[4.2] SR-1464: NSNumber.description is not compatible between OS X and linux #1929

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

Merged
merged 2 commits into from
Feb 22, 2019

Conversation

spevans
Copy link
Contributor

@spevans spevans commented Feb 19, 2019

  • Use Swift's stringification of numbers for .description and .stringValue

  • Use String(format:locale:...) with the correct format for the
    NSNumber type if locale is not nil.

  • Enable use of __CFStringFormatLocalizedNumber() on
    DEPLOYMENT_TARGET_LINUX.

(cherry picked from commit 6450221)

  • Add NSDecimalNumber.description

(cherry picked from commit 7cb608f)

- Use Swift's stringification of numbers for .description and .stringValue

- Use String(format:locale:...) with the correct format for the
  NSNumber type if locale is not nil.

- Enable use of __CFStringFormatLocalizedNumber() on
  DEPLOYMENT_TARGET_LINUX.

(cherry picked from commit 6450221)
@spevans
Copy link
Contributor Author

spevans commented Feb 19, 2019

@swift-ci test 4.2

2 similar comments
@weissi
Copy link
Contributor

weissi commented Feb 21, 2019

@swift-ci test 4.2

@weissi
Copy link
Contributor

weissi commented Feb 22, 2019

@swift-ci test 4.2

@weissi weissi merged commit 0df0449 into swiftlang:swift-4.2-branch Feb 22, 2019
@futurejones
Copy link

As reported in https://bugs.swift.org/browse/SR-9985 since the addition of this PR
TestNSNumber.test_descriptionWithLocale and TestNSString.test_initializeWithFormat3
are now failing on Linux/Ubuntu/AArch64

@weissi
Copy link
Contributor

weissi commented Feb 25, 2019

@futurejones thanks for reporting! So this PR passed all the tests here, are the ones you mention disabled?

Could this (on swift5) maybe be an artefact of vendoring ICU on Swift 5?

We definitely need to sort this out before releasing. @spevans / @kevints you know more about the ICU interactions here. Any insight?

@spevans
Copy link
Contributor Author

spevans commented Feb 25, 2019

Its odd that the swift-5.0-branch fails because none of the differences between 5.0 and master should matter. Also @futurejones tested 5.0 with #1866 which is a specific check for ICU >= 61, which is the only thing that could possibly make any difference so I cant see why that would fail either. Ubuntu18 comes with ICU60 so it must be getting built.

@futurejones
Copy link

@weissi These 2 tests TestNSNumber.test_descriptionWithLocale and TestNSString.test_initializeWithFormat3 were passing in 4.2.1 RELEASE and as far as I know they were passing in the 4.2.2 RELEASE. I am currently doing a 4.2.2 RELEASE build to verify this.
They are now failing in the current 4.2-branch. @spevans indicated that this PR may be the cause.
I have been testing on Ubuntu 16.04 only.

@futurejones
Copy link

futurejones commented Feb 25, 2019

To clarify these tests were passing on a build done from the swift-4.2-branch on 2019-02-21.

Test Case 'TestNSNumber.test_descriptionWithLocale' started at 2019-02-25 10:19:02.135
Test Case 'TestNSNumber.test_descriptionWithLocale' passed (0.0 seconds)
Test Case 'TestNSString.test_initializeWithFormat3' started at 2019-02-25 10:19:06.142
Test Case 'TestNSString.test_initializeWithFormat3' passed (0.0 seconds)

@spevans
Copy link
Contributor Author

spevans commented Feb 26, 2019

@weissi I think we should revert this one for now. I cant work out why it is breaking but it could just be an arm specific build issue. However the swift-5.0-branch breaking v master working is more worrying as I cant see any difference between the 2 branches wrt this change. But I think that would need to be looked at first.

@weissi
Copy link
Contributor

weissi commented Feb 26, 2019

thanks for looking into this @spevans .

@weissi weissi mentioned this pull request Feb 26, 2019
@weissi
Copy link
Contributor

weissi commented Feb 26, 2019

@spevans I created #1950 to revert this

weissi added a commit that referenced this pull request Feb 26, 2019
@spevans
Copy link
Contributor Author

spevans commented Feb 27, 2019

Further testing found that the fix for signed char in #1871 fixes this issue on ARM64 - the bug was that localised formatting was being disabled. So it should be ok to reintroduce after 4.2.3 has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants