Skip to content

Define Boolean so its operators resolve - #1351

Open
apiology wants to merge 1 commit into
castwide:masterfrom
apiology:define-boolean-namespace
Open

Define Boolean so its operators resolve#1351
apiology wants to merge 1 commit into
castwide:masterfrom
apiology:define-boolean-namespace

Conversation

@apiology

@apiology apiology commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This PR was written by Claude Code on behalf of @apiology.

Problem: a value documented @return [Boolean] cannot answer the three operators TrueClass and FalseClass both define.

# @return [Boolean]
def flag; true; end

flag & flag
# Unresolved call to & on Boolean

Store#get_superclass gives TrueClass and FalseClass a superclass of Boolean, and try_special_superclasses gives Boolean a superclass of Object, but nothing ever declared Boolean - so it had no namespace pin and carried only Object's methods, 53 against its subclasses' 60. The missing three were &, ^ and |.

Solution: declare Boolean in the core fills with those three members, completing the inheritance chain Solargraph already assumed rather than replacing it. Strong typecheck is unchanged at 531 problems.

Store#get_superclass gives TrueClass and FalseClass a superclass of
Boolean, and try_special_superclasses gives Boolean a superclass of
Object, but nothing ever declared Boolean. It had no Pin::Namespace, so
it carried only Object's methods: 53 against its subclasses' 60.

The three it lacked were &, ^ and |, so a value documented
@return [Boolean] could not answer operators that both classes it stands
for define, and `flag & flag` reported Unresolved call to & on Boolean.

Declare it in the core fills with those three members, completing the
inheritance chain Solargraph already assumed rather than replacing it.

Strong typecheck is unchanged at 531 problems.
@apiology
apiology marked this pull request as ready for review September 9, 2026 00:00
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.

1 participant