Closes #103. This PR fixes up a previously observed bug where signatures and equations that did not match names were not caught at the parser level. This resulted in bad error reporting from the type checker instead, and was misleading as it would only trip when the type checker was invoked to verify that value or function equation. An example of an offending statement would be:
game Test
b2 : Int -> Int
b(x) = x+1
-- or
b : Int
a = 2
These are now both reported correctly as parse errors (Language errors in the online tool), and are caught even if one name is a sub-string of the other name (which was not the case before).
In my local environment, this patch now correctly fails this program to parse no matter what is typed in, and reports:
Language Error: "Code" (line 4, column 2):
unexpected "("
expecting letter or digit or 'b2' but got b'
The expecting letter or digit part could be slightly improved, but this is vastly improved over the prior message.
Closes #103. This PR fixes up a previously observed bug where signatures and equations that did not match names were not caught at the parser level. This resulted in bad error reporting from the type checker instead, and was misleading as it would only trip when the type checker was invoked to verify that value or function equation. An example of an offending statement would be:
These are now both reported correctly as parse errors (Language errors in the online tool), and are caught even if one name is a sub-string of the other name (which was not the case before).
In my local environment, this patch now correctly fails this program to parse no matter what is typed in, and reports:
The expecting letter or digit part could be slightly improved, but this is vastly improved over the prior message.