Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support constants in patterns (fixes #696) #697

Merged
merged 1 commit into from
Apr 27, 2024
Merged

Support constants in patterns (fixes #696) #697

merged 1 commit into from
Apr 27, 2024

Conversation

udoprog
Copy link
Collaborator

@udoprog udoprog commented Apr 27, 2024

This adds support for using const values as patterns.

The supported value types are:

  • booleans, like true.
  • characters, like 'a'.
  • bytes, like b1.
  • strings, like "Hello World"
  • byte strings, like #"Hello World".
  • integers, like 42
  • tuples, like (1, 2, 3, true).
  • vectors, like [1, 2, 3, ].
  • anonymous objects, like #{foo: 12}

... or any arbitrarily complex combination of the above.

We can't support constant structs and enums (yes) due to the lack of representation in ConstValue, but this might be solvable in the future.

@udoprog udoprog added the bug Something isn't working label Apr 27, 2024
@udoprog udoprog merged commit a2dd09a into main Apr 27, 2024
19 checks passed
@udoprog udoprog deleted the const-patterns branch April 27, 2024 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant