Not great error for using `x` for multiplication.
If I write:
5 x 10
I get the following error:
I wonder if there is a way to trigger unbound identifier errors first? I'm not sure if that's the right way to improve this, but it at least feels like it would be better to see something like:
We really ought to be able to notice this case of multiple expressions on the same line that overlap with an x in the middle. The issue is with the literal id x, which requires no special scope resolution, etc.
Oh that's an interesting ergonomic issue, and I'm kinda impressed we haven't encountered it before... I think we could handle that using the pattern Joe suggested above, though I'm slightly worried about false-positives: I can easily believe that a student writing 5 x 10 meant for multiplication, because of the two integer literals, but should something like w x y z trigger a "x isn't multiplication" warning?
While obviously there are more complicated math expressions that it wouldn't catch, I feel like this is most likely to occur at first, and so it might be "good enough" to recognize NUM x NUM, rather than EXPR x EXPR (or even more general, as your example @blerner).
Could be. I don't like the thought of hard-coding such a brittle warning pattern, but it may be worth it...
There's already an issue where we report 2 different errors for one line with 3 expressions. (In general for e1 e2 e3... en we report $$n-1$$ errors). It would be good to clean that up in general, and in doing so we collapse adjacent errors if the shared expression is x