Closes #163, a reported issue earlier today where a student encountered the following form of parsing bug:
game Ex
type Content = {X,O}
f : Context -> Bool
f(X) = if X == O then True else False
Pre-patch this generates no parse error, and returns 'False' every time as if it were a constant function. Looking into this I found that the same behavior was also present in function application (would generate a type error instead of a parse error) and the name binding associated with a let expression (which would succeed silently as well). These cases are detailed as:
-- bad let
let X = 5 in 5
...
-- bad func app generates a type error instead of a parse error, as no function should start like this
type Content = {X,O}
X(1)
This patch introduces a lookAhead lower on all three of these instances where a new name can be bound to the environment, and enforces a leading lowercase alpha character. Failing tests for all three instances were added and verified to be corrected post-patch. As a followup, I double checked declarations for functions and value eqs, but found these to be properly verified.
@alexgrejuc this should be ready to merge, but let me know if I missed any cases where a new name can be bound that needs to be cased properly and is not. I think I covered everything here however.
Closes #163, a reported issue earlier today where a student encountered the following form of parsing bug:
Pre-patch this generates no parse error, and returns 'False' every time as if it were a constant function. Looking into this I found that the same behavior was also present in function application (would generate a type error instead of a parse error) and the name binding associated with a let expression (which would succeed silently as well). These cases are detailed as:
This patch introduces a
lookAhead lower
on all three of these instances where a new name can be bound to the environment, and enforces a leading lowercase alpha character. Failing tests for all three instances were added and verified to be corrected post-patch. As a followup, I double checked declarations for functions and value eqs, but found these to be properly verified.@alexgrejuc this should be ready to merge, but let me know if I missed any cases where a new name can be bound that needs to be cased properly and is not. I think I covered everything here however.