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 NSString.boolValue not matching Darwin Foundation #1571

Merged

Conversation

otaviolima
Copy link
Contributor

@otaviolima otaviolima commented May 31, 2018

There were some cases which were being evaluated to true but on Darwin/Objective-C they evaluate to false.

@spevans
Copy link
Contributor

spevans commented May 31, 2018

@swift-ci please test

@otaviolima otaviolima force-pushed the match-darwing-nsstring-boolValue branch from 714d50d to 8d24063 Compare May 31, 2018 18:32
@otaviolima
Copy link
Contributor Author

I pushed again because previous implementation changed the tests in a wrong way.

Instead of "-00000, +t" it should be two different items in the array, like this -> "-00000", "+t",

let _ = scanner.scanString("-")
}
// scan a single optional '+' or '-' character
let hasSignal = scanner.scanString("+") != nil || scanner.scanString("-") != nil
// scan any following zeroes
Copy link
Contributor

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.

Copy link
Contributor

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.)

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.

Copy link
Contributor Author

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. ^-^

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

let _ = scanner.scanString("-")
}
// scan a single optional '+' or '-' character
let hasSignal = scanner.scanString("+") != nil || scanner.scanString("-") != nil
// scan any following zeroes
Copy link
Contributor

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.)

@otaviolima otaviolima force-pushed the match-darwing-nsstring-boolValue branch from 8d24063 to bfe2a04 Compare May 31, 2018 21:52
Copy link
Contributor

@parkera parkera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@millenomi
Copy link
Contributor

@swift-ci please test and merge

@swift-ci swift-ci merged commit e78f471 into swiftlang:master Jun 1, 2018
@otaviolima otaviolima deleted the match-darwing-nsstring-boolValue branch June 2, 2018 10:50
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.

5 participants