You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a couple limited forms of this problem that Sorbet could nonetheless solve:
Warn for duplicate enum values (potentially encoding sorbet-runtime's serialized_val computation to know that Foo1 = new; Foo2 = new('Foo1') is an error as well
Warn for re-assigned constants if the redefinition happens within a single file
Either of these would help bring another class of runtime errors into the static checks.
This becomes especially useful the larger the enum is, because the two duplicates might be at arbitrary spots in the list of values.
The text was updated successfully, but these errors were encountered:
jez
added
bug
Something isn't working
enhancement
New feature or surprising current feature
and removed
bug
Something isn't working
labels
May 3, 2024
jez
changed the title
Warn for duplicate enum values
Error for duplicate enum values
May 3, 2024
Input
→ View on sorbet.run
Observed output
Expected behavior
Sorbet does not in general report constant redefinition errors, because it does not track code loading order:
https://sorbet.org/docs/unsupported#tracking-code-loading-order
There are a couple limited forms of this problem that Sorbet could nonetheless solve:
serialized_val
computation to know thatFoo1 = new; Foo2 = new('Foo1')
is an error as wellEither of these would help bring another class of runtime errors into the static checks.
This becomes especially useful the larger the enum is, because the two duplicates might be at arbitrary spots in the list of values.
The text was updated successfully, but these errors were encountered: