tealish icon indicating copy to clipboard operation
tealish copied to clipboard

[BUG] cannot parse expression with `const int`

Open 1m1-github opened this issue 2 years ago • 1 comments

Describe the bug

int x = 1
const int X = 1
int y = 1
 # next line is ok
_ = x * y
 # next line is NOT ok
_ = X * y

Error: Cannot parse "X * y" as Expression

To Reproduce Steps to reproduce the behavior.

Expected behavior both lines should compile

Additional context Add any other context about the problem here.

1m1-github avatar Apr 14 '23 12:04 1m1-github

I think there is an inconsistency in the parsing rules for const names. The declaration allows 1 character names but the rest of the code expects >1 character in the name. The solution for now is to use multi character names. I'll look into it in more detail to check if we really want to support 1 character names for consts.

fergalwalsh avatar Apr 21 '23 10:04 fergalwalsh