Skip to content

Unary minus seems broken #6210

@catsidhe

Description

@catsidhe

Strange unary minus behavior that also prevents overriding it.

> -nil
undefined method '-@' (NoMethodError)
> -nil; nil
 => nil # this doesn't seem OK
> +nil; nil
undefined method '+@' (NoMethodError)
> class Foo; def -@; p 'bar'; end; end; -Foo.new; nil
 => nil # doesn't print "bar" 

e42f192 is the first bad commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions