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

Regexp.new does not coerce input to string #2705

Closed
HoneyryderChuck opened this issue Aug 11, 2022 · 1 comment
Closed

Regexp.new does not coerce input to string #2705

HoneyryderChuck opened this issue Aug 11, 2022 · 1 comment

Comments

@HoneyryderChuck
Copy link
Contributor

Given the following snippet:

class A
  def to_str
    "bang"
   end
end
Regexp.new(A.new)

CRuby will return /bang/. Truffleruby fails:

TruffleRuby doesn't have a case for the org.truffleruby.core.regexp.RegexpNodesFactory$RegexpCompileNodeFactory$RegexpCompileNodeGen node with values of type Cel::Macro::A(org.truffleruby.core.basicobject.RubyBasicObject) java.lang.Integer=0 (TypeError)
        from org.truffleruby.core.regexp.RegexpNodesFactory$RegexpCompileNodeFactory$RegexpCompileNodeGen.executeAndSpecialize(RegexpNodesFactory.java:901)
        from org.truffleruby.core.regexp.RegexpNodesFactory$RegexpCompileNodeFactory$RegexpCompileNodeGen.execute(RegexpNodesFactory.java:878)
        from org.truffleruby.language.control.SequenceNode.execute(SequenceNode.java:36)
        from org.truffleruby.language.RubyMethodRootNode.execute(RubyMethodRootNode.java:65)
        from org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:659)
@andrykonchin andrykonchin self-assigned this Aug 11, 2022
@andrykonchin andrykonchin added this to the 22.3.0 milestone Aug 22, 2022
@andrykonchin
Copy link
Member

Fixed in f9ae7a9. Thank you for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants