#454 √ resolved
kwatch

[BUG] Regexp#match(nil) should be nil but raises error

Reported by kwatch | March 30th, 2008 @ 11:59 PM | in 1.0 preview

Regexp#match(nil) returns nil in Ruby1.8 but raises error in Rubinius.

$ ruby -e 'p /\w+/.match(nil)'
nil

$ shotgun/rubinius -e 'p /\w+/.match(nil)'
An exception has occurred:
    No method 'size' on an instance of NilClass. (NoMethodError)

Backtrace:
    Kernel(NilClass)#size (method_missing_cv) at kernel/core/kernel.rb:606
                                Regexp#match at kernel/core/regexp.rb:255
                        Object#__script__ {} at (eval):1
                         Kernel(Module)#eval at kernel/core/eval.rb:98
                             Compile.execute at kernel/core/compile.rb:73
                           Object#__script__ at kernel/loader.rb:256

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Tags