Skip to content

.is_a? works with constant values #15389

Open
@Blacksmoke16

Description

@Blacksmoke16

Bug Report

This came up in the Discord and was surprised this even works:

require "http/status"

pp HTTP::Status::OK.is_a? HTTP::Status::OK        # => true
pp HTTP::Status::NOT_FOUND.is_a? HTTP::Status::OK # => false

Or more simply:

NUM = 1
 
pp NUM.is_a? NUM # => true

Is this expected?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions