lang: Check that set type matches actual expression

I forgot to include these two invariants which are occasionally
necessary, although in most cases they're necessary to prevent incorrect
code from getting past unification. In any case, they would have been
caught by the engine.
This commit is contained in:
James Shubin
2019-01-20 04:01:34 -05:00
parent 6c5c38f5a7
commit 32e29862f2
2 changed files with 21 additions and 0 deletions

View File

@@ -859,6 +859,7 @@ arg:
}
;
bind:
// `$s = "hey"`
VAR_IDENTIFIER EQUALS expr
{
posLast(yylex, yyDollar) // our pos
@@ -867,6 +868,8 @@ bind:
Value: $3.expr,
}
}
// `$x bool = true`
// `$x int = if true { 42 } else { 13 }`
| VAR_IDENTIFIER type EQUALS expr
{
posLast(yylex, yyDollar) // our pos