-
Notifications
You must be signed in to change notification settings - Fork 194
Raise Encoding::CompatibilityError with incompatible encodings on regexp #1775
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
Raise Encoding::CompatibilityError with incompatible encodings on regexp #1775
Conversation
e8941f7
to
0679ef4
Compare
@rafaelfranca Could you rebase on top of current master and add a CHANGELOG entry? |
When the string and the regular expression have different encodings we should raise an Encoding::CompatibilityError.
0679ef4
to
c672c5b
Compare
@Cached("toEncodingNode.executeToEncoding(regexp)") Encoding regexpEncoding, | ||
@Cached("toEncodingNode.executeToEncoding(string)") Encoding stringEncoding, | ||
@Cached EncodingNodes.CompatibleQueryNode isCompatibleNode) { | ||
throw new RaiseException(getContext(), coreExceptions().encodingCompatibilityErrorIncompatible(regexpEncoding, stringEncoding, 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.
I found out that we can use EncodingNodes.CheckEncodingNode
instead and that removes the need for an extra specialization. I'll change it to that.
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 in 7adbc48 and PR merged, thank you.
…ings on regexp (#1775). PullRequest: truffleruby/1095
When the string and the regular expression have different encodings we should raise an Encoding::CompatibilityError.
This fixes String#blank? of Active Support that depends on this behavior.
https://github.com/rails/rails/blob/ac193d0cc338bd024d1b9f41dee384da4f7c51c4/activesupport/lib/active_support/core_ext/object/blank.rb#L128-L129
Shopify#1