mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
1.5 KiB
1.5 KiB
META
description=Block with pattern unification testing
type=expr
SOURCE
{
x = 42
str = "hello"
result = x + 5
result
}
EXPECTED
UNUSED VARIABLE - block_pattern_unify.md:3:5:3:8
PROBLEMS
UNUSED VARIABLE
Variable str is not used anywhere in your code.
If you don't need this variable, prefix it with an underscore like _str to suppress this warning.
The unused variable is declared here:
block_pattern_unify.md:3:5:3:8:
str = "hello"
^^^
TOKENS
OpenCurly,
LowerIdent,OpAssign,Int,
LowerIdent,OpAssign,StringStart,StringPart,StringEnd,
LowerIdent,OpAssign,LowerIdent,OpPlus,Int,
LowerIdent,
CloseCurly,
EndOfFile,
PARSE
(e-block
(statements
(s-decl
(p-ident (raw "x"))
(e-int (raw "42")))
(s-decl
(p-ident (raw "str"))
(e-string
(e-string-part (raw "hello"))))
(s-decl
(p-ident (raw "result"))
(e-binop (op "+")
(e-ident (raw "x"))
(e-int (raw "5"))))
(e-ident (raw "result"))))
FORMATTED
{
x = 42
str = "hello"
result = x + 5
result
}
CANONICALIZE
(e-block
(s-let
(p-assign (ident "x"))
(e-num (value "42")))
(s-let
(p-assign (ident "str"))
(e-string
(e-literal (string "hello"))))
(s-let
(p-assign (ident "result"))
(e-binop (op "add")
(e-lookup-local
(p-assign (ident "x")))
(e-num (value "5"))))
(e-lookup-local
(p-assign (ident "result"))))
TYPES
(expr (type "a where [a.from_numeral : Numeral -> Try(a, [InvalidNumeral(Str)])]"))