cryptol/tests/constraint-guards/noTypeSigNested.cry
Ryan Scott fbbbb8f56f
Check for syntactically invalid constraint guards in the parser (#1686)
Numeric constraint guards have very particular syntactic requirements:

* They must always be used in top-level definitions.
* Their definitions must always be accompanied by a top-level type signature.

Previously, we checked these requirements in a combination of places in the
parser and the typechecker. The checks in the typechecker weren't very
thorough, however, and they failed to catch local definitions without type
signatures that use constraint guards, as seen in #1685.

This patch moves all of these syntactic checks to the parser (in
`Cryptol.Parser.ExpandPropGuards`). We now recurse into expressions to check
for local definition that use constraint guards and error if we encounter one.
This ensures that by the time we reach the typechecker, all constraint guard
expressions are at least syntactically valid.

Fixes #1685.
2024-07-01 07:13:36 -04:00

6 lines
74 B
Plaintext

// A regression test for #1685.
f : ()
f = g
where
g | 0 == 0 => ()