-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[Constant Evaluator] Add support for string appends and string equals to the constant evaluator #22147
Conversation
ecc3056
to
2c0627e
Compare
the constant evaluator.
2c0627e
to
ee222c3
Compare
if (literal.getKind() != SymbolicValue::String) { | ||
return evaluator.getUnknown((SILInstruction *)apply, | ||
UnknownReason::Default); | ||
} |
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.
@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.
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.
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.
@swift-ci Please smoke test |
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.
LGTM.
@swift-ci Please test and merge |
1 similar comment
@swift-ci Please test and merge |
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.+=
andString.==
and models these operations in the evaluator.