roc/test/snapshots/simple_module_no_blanks.md
2025-12-03 23:02:46 -05:00

1.5 KiB

META

description=A simple module with no blanks
type=snippet

SOURCE

import pf.Stdout
hello! = Stdout.line!("Hello")
world = "World"

EXPECTED

UNDEFINED VARIABLE - simple_module_no_blanks.md:2:10:2:22

PROBLEMS

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

simple_module_no_blanks.md:2:10:2:22:

hello! = Stdout.line!("Hello")
     ^^^^^^^^^^^^

TOKENS

KwImport,LowerIdent,NoSpaceDotUpperIdent,
LowerIdent,OpAssign,UpperIdent,NoSpaceDotLowerIdent,NoSpaceOpenRound,StringStart,StringPart,StringEnd,CloseRound,
LowerIdent,OpAssign,StringStart,StringPart,StringEnd,
EndOfFile,

PARSE

(file
	(type-module)
	(statements
		(s-import (raw "pf.Stdout"))
		(s-decl
			(p-ident (raw "hello!"))
			(e-apply
				(e-ident (raw "Stdout.line!"))
				(e-string
					(e-string-part (raw "Hello")))))
		(s-decl
			(p-ident (raw "world"))
			(e-string
				(e-string-part (raw "World"))))))

FORMATTED

NO CHANGE

CANONICALIZE

(can-ir
	(d-let
		(p-assign (ident "hello!"))
		(e-call
			(e-runtime-error (tag "ident_not_in_scope"))
			(e-string
				(e-literal (string "Hello")))))
	(d-let
		(p-assign (ident "world"))
		(e-string
			(e-literal (string "World"))))
	(s-import (module "pf.Stdout")
		(exposes)))

TYPES

(inferred-types
	(defs
		(patt (type "Error"))
		(patt (type "Str")))
	(expressions
		(expr (type "Error"))
		(expr (type "Str"))))