Skip to content

Support BasicObject to avoid NoMethodError for RBS::Test::TypeCheck#2565

Merged
ksss merged 1 commit intoruby:masterfrom
ksss:typecheck-value-is_a
Jun 24, 2025
Merged

Support BasicObject to avoid NoMethodError for RBS::Test::TypeCheck#2565
ksss merged 1 commit intoruby:masterfrom
ksss:typecheck-value-is_a

Conversation

@ksss
Copy link
Collaborator

@ksss ksss commented Jun 24, 2025

Fixes a type-checking problem for bool and singleton() types of objects that do not have an is_a? method, such as BasicObject instance.

@ksss ksss added this to the RBS 4.0 milestone Jun 24, 2025
@ksss ksss added this pull request to the merge queue Jun 24, 2025
Merged via the queue into ruby:master with commit fe043d4 Jun 24, 2025
21 checks passed
@ksss ksss deleted the typecheck-value-is_a branch June 24, 2025 07:01
when Types::Bases::Any
true
when Types::Bases::Bool
val.is_a?(TrueClass) || val.is_a?(FalseClass)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative may be Module#===: TrueClass === val

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants