Skip to content

feat: string-based-union support#679

Draft
ThijsBroersen wants to merge 2 commits intocom-lihaoyi:mainfrom
ThijsBroersen:feat/literal-string-based-union-support
Draft

feat: string-based-union support#679
ThijsBroersen wants to merge 2 commits intocom-lihaoyi:mainfrom
ThijsBroersen:feat/literal-string-based-union-support

Conversation

@ThijsBroersen
Copy link
Copy Markdown

@ThijsBroersen ThijsBroersen commented Sep 5, 2025

Initial draft of string based literal type union support.

@lihaoyi
Copy link
Copy Markdown
Member

lihaoyi commented Sep 10, 2025

I think the approach looks fine as a first draft, but my concern is how it scales to broader usages of union types? Apart from unions of literal String types, can we also support unions of different primitives (e.g. String | Int | Boolean), or unions of different distinct case classes or objects?

I mainly to make sure there's some coherent approach that we can document and users can understand, and that whatever we implement now doesn't get in the way of implementing other union types in future since we'll be locking in the public API

@ThijsBroersen
Copy link
Copy Markdown
Author

See #682 for my idea on how this could be done.

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