-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Swift: Models for String methods involving closures. #14578
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
Conversation
I fixed a merge conflict. |
";StringProtocol;true;withCString(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint", | ||
";StringProtocol;true;withCString(_:);;;Argument[0].ReturnValue;ReturnValue;value", |
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.
Should there be a step from the mutated parameter of the callback to the this
parameter of the method?
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.
Discussed on the other comment.
";String;true;withPlatformString(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint", | ||
";String;true;withPlatformString(_:);;;Argument[0].ReturnValue;ReturnValue;value", |
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.
Same question here.
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.
I don't think you can mutate the string with these particular methods. I'll check...
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.
Sorry for taking a while to get back to this. I think it's only possible to modify the object using the methods marked mutating
, that is withMutableCharacters
and withUTF8
in this PR (and I'm not sure it's practically possible with the latter, see the doc).
Some experimentation here - notice that the changes are never reflected back in s
.
Add flow models for
String
methods involving closures, such asString.withUTF8(_:)
. Most already had test coverage, but I did have to add tests forwithMutableCharacters(_:)
and an additional test forString(unsafeUninitializedCapacity:initializingUTF8With:)
to show that the model is working despite other issues in the existing test. Unfortunately the diff of the test is also polluted by a renumbering.