DanielXMoore / Civet

A TypeScript superset that favors more types and less typing
https://civet.dev
MIT License
1.56k stars 33 forks source link

Cannot pattern-match object with numeric keys #1606

Closed bbrk24 closed 1 week ago

bbrk24 commented 1 week ago

This works just fine:

switch x
  { a: /^(?:foo|bar)$/ }
    ;

This causes the compiler to crash with a TypeError:

switch x
  { 0: /^(?:foo|bar)$/ }
    ;

There is the question of how you'd access the value of x.0, since you can't name a variable 0. But we can at least test that it's there without binding it.