on master help sign in
Merge pull request #2516 from david-christiansen/issue/2512
65f4945David Christiansen
src/Idris/ParseHelpers.hs+3−2
@@ -450,8 +450,9 @@ pushIndent = do pos <- position
450-- | Pops indentation from stack
450-- | Pops indentation from stack
451popIndent :: IdrisParser ()
451popIndent :: IdrisParser ()
452popIndent = do ist <- get
452popIndent = do ist <- get
453− let (x : xs) = indent_stack ist
453+ case indent_stack ist of
454+ [] -> error "The impossible happened! Tried to pop an indentation level where none was pushed (underflow)."
454− put (ist { indent_stack = xs })
455+ (x : xs) -> put (ist { indent_stack = xs })
455
456
456
457
457-- | Gets current indentation
458-- | Gets current indentation
src/Idris/Parser.hs+2−1
@@ -834,8 +834,9 @@ CAF ::= 'let' FnName '=' Expr Terminator;
834caf :: SyntaxInfo -> IdrisParser PDecl
834caf :: SyntaxInfo -> IdrisParser PDecl
835caf syn = do reservedHL "let"
835caf syn = do reservedHL "let"
836 n_in <- fst <$> fnName; let n = expandNS syn n_in
836 n_in <- fst <$> fnName; let n = expandNS syn n_in
837+ pushIndent
837 lchar '='
838 lchar '='
838− t <- expr syn
839+ t <- indented $ expr syn
839 terminator
840 terminator
840 fc <- getFC
841 fc <- getFC
841 return (PCAF fc n t)
842 return (PCAF fc n t)