tock-mirror/testcases/automatic/initial-result-2.occ.test
Adam Sampson 6ee21f76c9 Initial work on supporting INITIAL and RESULT abbreviations.
This fixes the AST, parser and typechecker, and adds a pass to
transform Result back into Abbrev, but doesn't transform Initial yet.
(It actually works for trivial stuff anyway, but it won't do the right
thing for complex types or PROC parameters.)

It appears (to me) to make sense to support INITIAL/RESULT reshaping
and retyping too, so this does.

Refs #42.
2008-06-02 20:41:37 +00:00

47 lines
785 B
Plaintext

-- This file tests INITIAL and RESULT formals and actuals.
PROC main ()
INT var:
REAL32 var.r:
VAL INT const IS 42:
VAL REAL32 const.r IS 9.8:
PROC on.init (INITIAL INT init)
init := init + 1
:
PROC on.result (RESULT INT result)
result := 42
:
%%
:
%PASS Just the PROCs
SKIP
%PASS Initial actual from var
on.init (var)
%PASS Initial actual from const
on.init (const)
%FAIL Initial actual from wrong type
on.init (const.r)
%PASS Result actual from var
on.result (var)
%FAIL Result actual from const
on.result (const)
%FAIL Result actual from wrong type
on.result (var.r)
%FAIL Initial formal in FUNCTION
INT FUNCTION function (INITIAL INT arg) IS 42:
%FAIL Result formal in FUNCTION
INT FUNCTION function (RESULT INT arg) IS 42:
%