dex-lang icon indicating copy to clipboard operation
dex-lang copied to clipboard

Parser bug: malformed `def` parses to something but probably shouldn't

Open RobertStanforth opened this issue 3 years ago • 1 comments

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

RobertStanforth avatar Jun 21 '21 12:06 RobertStanforth

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.

dougalm avatar Feb 15 '23 19:02 dougalm