Allow string initializer for enums#139
Conversation
|
What about testcase: enum abc {
a,
b = "def",
c,
} |
|
Did you mean creating a new test case with this input? or just modifying the current one? |
|
I meant adding a new testcase with that specific enum, it is not allowed in typescript and should error out (which you can test) |
|
Also you probably shouldn't change old tests, just add some new ones. |
|
Yes. You are right, this test case will result an error. |
9b89ada to
2b76593
Compare
|
@Perryvw I've updated the test cases. |
Perryvw
left a comment
There was a problem hiding this comment.
Looks good! There is one more testcase I would like you to revert back to what it originally was (enum.ts), once that is done I think this can be merged!
test/translation/lua/enum.lua
Outdated
| TestEnum.val2=2 | ||
| TestEnum.val3=3 No newline at end of file | ||
| TestEnum.val3=3 | ||
| TestEnum.val4="bye" No newline at end of file |
There was a problem hiding this comment.
Revert this file back to just a generic enum as it was before, this case is covered by enumHeterogeneous.lua
test/translation/ts/enum.ts
Outdated
| } No newline at end of file | ||
| val3, | ||
| val4 = "bye" | ||
| } |
|
@Perryvw I've reverted the test case. 😄 |
String enum is a useful language feature, I think we should support it.