roc/test/snapshots/expr_if_missing_else.md
2025-11-25 23:34:54 -05:00

1.3 KiB

META

description=
type=snippet

SOURCE

foo = if tru 0

EXPECTED

UNDEFINED VARIABLE - expr_if_missing_else.md:1:10:1:13 MISSING METHOD - expr_if_missing_else.md:1:14:1:15

PROBLEMS

UNDEFINED VARIABLE Nothing is named tru in this scope. Is there an import or exposing missing up-top?

expr_if_missing_else.md:1:10:1:13:

foo = if tru 0
     ^^^

MISSING METHOD This from_numeral method is being called on a value whose type doesn't have that method: expr_if_missing_else.md:1:14:1:15:

foo = if tru 0
         ^

The value's type, which does not have a method named from_numeral, is:

_{}_

TOKENS

LowerIdent,OpAssign,KwIf,LowerIdent,Int,
EndOfFile,

PARSE

(file
	(type-module)
	(statements
		(s-decl
			(p-ident (raw "foo"))
			(e-if-without-else
				(e-ident (raw "tru"))
				(e-int (raw "0"))))))

FORMATTED

NO CHANGE

CANONICALIZE

(can-ir
	(d-let
		(p-assign (ident "foo"))
		(e-if
			(if-branches
				(if-branch
					(e-runtime-error (tag "ident_not_in_scope"))
					(e-num (value "0"))))
			(if-else
				(e-empty_record)))))

TYPES

(inferred-types
	(defs
		(patt (type "{}")))
	(expressions
		(expr (type "{}"))))