Skip to content

Initial commit with Boolean and Enum implementation#33

Open
abhishek130904 wants to merge 1 commit intolow-rb:mainfrom
abhishek130904:feature/boolean-enum-types
Open

Initial commit with Boolean and Enum implementation#33
abhishek130904 wants to merge 1 commit intolow-rb:mainfrom
abhishek130904:feature/boolean-enum-types

Conversation

@abhishek130904
Copy link
Copy Markdown

Summary

This PR adds support for Boolean and Enum types in LowType.

Changes

Boolean

  • Introduced a dedicated Boolean type
  • Validates only true and false values
  • Replaces factory-based implementation

Enum

  • Added Enum[val1, val2, ...] type constructor
  • Implemented Enum::Definition with match? validation
  • Supports union types (e.g. Enum[:a, :b] | nil)

Core Integration

  • Updated TypeQuery to recognize Enum::Definition
  • Extended TypeExpression to support non-Class types with match?

Tests

  • Added unit tests for Boolean and Enum
  • Added feature tests
  • All existing tests pass (140 examples, 0 failures)

Motivation

  • Improves readability (Boolean vs TrueClass | FalseClass)
  • Adds support for constrained value sets
  • Aligns with planned features in project roadmap

Notes

  • Maintains backward compatibility
  • Integrates cleanly with existing type system

@maedi
Copy link
Copy Markdown
Member

maedi commented Mar 27, 2026

Thank you for this PR. There are a few people interested in this issue via GSoC and it will take a while to sort through the solutions and apply the most suitable one. I have a few proposals via GSoC, including a strong proposal, so I will have to get all of the solutions in my head at once somehow :) Your contribution is appreciated and I will read it and provide feedback

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