mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-19 23:03:11 +00:00
1.6 KiB
1.6 KiB
META
description=Mixed capture patterns in block expression
type=expr
SOURCE
(|base| {
simple = |x| base + x + 1
simple(1)
})(1)
EXPECTED
NIL
PROBLEMS
NIL
TOKENS
OpenRound,OpBar,LowerIdent,OpBar,OpenCurly,
LowerIdent,OpAssign,OpBar,LowerIdent,OpBar,LowerIdent,OpPlus,LowerIdent,OpPlus,Int,
LowerIdent,NoSpaceOpenRound,Int,CloseRound,
CloseCurly,CloseRound,NoSpaceOpenRound,Int,CloseRound,
EndOfFile,
PARSE
(e-apply
(e-tuple
(e-lambda
(args
(p-ident (raw "base")))
(e-block
(statements
(s-decl
(p-ident (raw "simple"))
(e-lambda
(args
(p-ident (raw "x")))
(e-binop (op "+")
(e-binop (op "+")
(e-ident (raw "base"))
(e-ident (raw "x")))
(e-int (raw "1")))))
(e-apply
(e-ident (raw "simple"))
(e-int (raw "1")))))))
(e-int (raw "1")))
FORMATTED
(
|base| {
simple = |x| base + x + 1
simple(1)
},
)(1)
CANONICALIZE
(e-call
(e-lambda
(args
(p-assign (ident "base")))
(e-block
(s-let
(p-assign (ident "simple"))
(e-closure
(captures
(capture (ident "base")))
(e-lambda
(args
(p-assign (ident "x")))
(e-binop (op "add")
(e-binop (op "add")
(e-lookup-local
(p-assign (ident "base")))
(e-lookup-local
(p-assign (ident "x"))))
(e-num (value "1"))))))
(e-call
(e-lookup-local
(p-assign (ident "simple")))
(e-num (value "1")))))
(e-num (value "1")))
TYPES
(expr (type "a where [a.from_numeral : Numeral -> Try(a, [InvalidNumeral(Str)])]"))