quantified-uncertainty / squiggle

An estimation language
https://squiggle-language.com
MIT License
152 stars 23 forks source link

Confusing errors for capital dict keys #2561

Open OAGr opened 11 months ago

OAGr commented 11 months ago

Description of suggestion or shortcoming:

When a dict key is capitalized, we don't parse it, and often give an error suggesting the problem is elsewhere. Annoying to debug.

image image

(See line ~46 there)

I know that parser error messages are really annoying though.

rob-gordon commented 11 months ago

@OAGr Wanted to add this isn't just for dicts. In this code:

a = 0.46 to 0.66;
b = .5;
f = ;
c = (B) * F

The error is correctly reported on line 3. But for this code:

A = 0.46 to 0.66;
B = .5;
F = ;
C = (B) * F

it's reported as being on line 1.

OAGr commented 11 months ago

@rob-gordon To be clear, it does seem like the lines are correct there? In the first example, the problem is with ";", which is on line 3. In the second example, the problem is with "A", which is on line 1.

rob-gordon commented 11 months ago

@OAGr Maybe I was confused, are uppercase variable names not allowed in squiggle? Or is there another problem with A in the second example I'm missing?

OAGr commented 11 months ago

Uppercase variable names are not allowed