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

[Constant Evaluator] Add support for string appends and string equals to the constant evaluator #22147

Merged
merged 1 commit into from
Feb 13, 2019

Conversation

ravikandhadai
Copy link
Contributor

This PR adds support for string appends and string equals to the constant evaluator. It adds new @_semantics attributes to the standard library functions: String.+= and String.== and models these operations in the evaluator.

if (literal.getKind() != SymbolicValue::String) {
return evaluator.getUnknown((SILInstruction *)apply,
UnknownReason::Default);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@marcrasi I added support for String.+= and also String.==. In addition to that I also changed the breaks here to return unknown. I wasn't sure why there was a break here? But, it seemed to me that it was perhaps because there are two functions with "makeUTF8" semantics attribute and the evaluator is handling just one of them. But, it turns out that the other one is also identical (in terms of semantics) and is redundant and is probably unused.

Choose a reason for hiding this comment

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

Ah, break is mistakenly left over from before I refactored the switch into its own function. It made sense in context of the the switch's original location, but it no longer makes sense.

@ravikandhadai
Copy link
Contributor Author

@swift-ci Please smoke test

Copy link
Contributor

@devincoughlin devincoughlin left a comment

Choose a reason for hiding this comment

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

LGTM.

@ravikandhadai
Copy link
Contributor Author

@swift-ci Please test and merge

1 similar comment
@ravikandhadai
Copy link
Contributor Author

@swift-ci Please test and merge

@swift-ci swift-ci merged commit aead660 into swiftlang:master Feb 13, 2019
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.

4 participants