mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
1 KiB
1 KiB
META
description=Block expression with two decls and final binop expr
type=expr
SOURCE
{
x = 42
y = x + 1
y * 2
}
EXPECTED
NIL
PROBLEMS
NIL
TOKENS
OpenCurly,
LowerIdent,OpAssign,Int,
LowerIdent,OpAssign,LowerIdent,OpPlus,Int,
LowerIdent,OpStar,Int,
CloseCurly,
EndOfFile,
PARSE
(e-block
(statements
(s-decl
(p-ident (raw "x"))
(e-int (raw "42")))
(s-decl
(p-ident (raw "y"))
(e-binop (op "+")
(e-ident (raw "x"))
(e-int (raw "1"))))
(e-binop (op "*")
(e-ident (raw "y"))
(e-int (raw "2")))))
FORMATTED
{
x = 42
y = x + 1
y * 2
}
CANONICALIZE
(e-block
(s-let
(p-assign (ident "x"))
(e-num (value "42")))
(s-let
(p-assign (ident "y"))
(e-binop (op "add")
(e-lookup-local
(p-assign (ident "x")))
(e-num (value "1"))))
(e-binop (op "mul")
(e-lookup-local
(p-assign (ident "y")))
(e-num (value "2"))))
TYPES
(expr (type "a where [a.from_numeral : Numeral -> Try(a, [InvalidNumeral(Str)])]"))