dex-lang
dex-lang copied to clipboard
Parser bug: malformed `def` parses to something but probably shouldn't
The following (syntactically incorrect) code causes the compiler itself to fail with a Haskell error:
def f : _ 0 \x.
y = x
y
n = 0
:p n
dex: Unexpected let binding in type annotation CallStack (from HasCallStack): error, called at src/lib/Parser.hs:263:18 in dex-0.1.0.0-1c1KJ1laoEjKvvidxV1QZ9:Parser
It no longer crashes the compiler but it parses to something very unexpected:
def f : _ 0 \x.
y = x
y
n = 0
> Error: variable not in scope: n
>
> n = 0
> ^^
So I consider this a parser bug.