-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 NSString.boolValue not matching Darwin Foundation #1571
Fix NSString.boolValue not matching Darwin Foundation #1571
Conversation
@swift-ci please test |
714d50d
to
8d24063
Compare
I pushed again because previous implementation changed the tests in a wrong way. Instead of |
Foundation/NSString.swift
Outdated
let _ = scanner.scanString("-") | ||
} | ||
// scan a single optional '+' or '-' character | ||
let hasSignal = scanner.scanString("+") != nil || scanner.scanString("-") != nil | ||
// scan any following zeroes |
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.
Looking at the Darwin implementation, it seems we check only the first character for t T y Y
and return true
. After that is when we do the scan for +
/-
and the digits.
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.
@otaviolima Can you switch this with the check in the return statement below? (i.e., check that first, then this.)
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.
You mean check in the same way @parkera explained it is in Darwin implementation?
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.
Yeah.
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.
Yup, doing that right now. ^-^
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.
Foundation/NSString.swift
Outdated
let _ = scanner.scanString("-") | ||
} | ||
// scan a single optional '+' or '-' character | ||
let hasSignal = scanner.scanString("+") != nil || scanner.scanString("-") != nil | ||
// scan any following zeroes |
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.
@otaviolima Can you switch this with the check in the return statement below? (i.e., check that first, then this.)
8d24063
to
bfe2a04
Compare
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.
Looks good
@swift-ci please test and merge |
There were some cases which were being evaluated to
true
but on Darwin/Objective-C they evaluate tofalse
.