roc/test/snapshots/expr/if_numeric_comparison.md
2025-11-23 01:22:01 -05:00

691 B

META

description=If expression with numeric comparison
type=expr

SOURCE

if 5 > 3 1 else 2

EXPECTED

NIL

PROBLEMS

NIL

TOKENS

KwIf,Int,OpGreaterThan,Int,Int,KwElse,Int,
EndOfFile,

PARSE

(e-if-then-else
	(e-binop (op ">")
		(e-int (raw "5"))
		(e-int (raw "3")))
	(e-int (raw "1"))
	(e-int (raw "2")))

FORMATTED

NO CHANGE

CANONICALIZE

(e-if
	(if-branches
		(if-branch
			(e-binop (op "gt")
				(e-num (value "5"))
				(e-num (value "3")))
			(e-num (value "1"))))
	(if-else
		(e-num (value "2"))))

TYPES

(expr (type "a where [a.from_numeral : Numeral -> Try(a, [InvalidNumeral(Str)])]"))