Skip to content

Conversation

rafaelfranca
Copy link
Contributor

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

@rafaelfranca rafaelfranca force-pushed the rm-raise-incompatible-encoding branch from e8941f7 to 0679ef4 Compare October 28, 2019 17:23
@eregon eregon self-assigned this Oct 28, 2019
@eregon eregon added this to the 20.0.0 milestone Oct 28, 2019
@eregon
Copy link
Member

eregon commented Oct 29, 2019

@rafaelfranca Could you rebase on top of current master and add a CHANGELOG entry?

@rafaelfranca rafaelfranca force-pushed the rm-raise-incompatible-encoding branch from 0679ef4 to c672c5b Compare October 29, 2019 13:42
@eregon eregon added the in-ci The PR is being tested in CI. Do not push new commits. label Oct 29, 2019
@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));
Copy link
Member

@eregon eregon Oct 29, 2019

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.

Copy link
Member

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.

graalvmbot pushed a commit that referenced this pull request Oct 30, 2019
…ings on regexp (#1775).

PullRequest: truffleruby/1095
@graalvmbot graalvmbot merged commit c672c5b into oracle:master Oct 30, 2019
@chrisseaton chrisseaton deleted the rm-raise-incompatible-encoding branch December 3, 2019 20:48
@chrisseaton chrisseaton added the shopify Pull requests from Shopify label Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-ci The PR is being tested in CI. Do not push new commits. oca-signed shopify Pull requests from Shopify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants