worked on function call return type check and started checking return type

This commit is contained in:
Annie committed 2025-04-15 00:53:03 -04:00
1 parent 06db190428
commit 2b1557b52c
5 files changed
+150 -17

No files matched your search

@@ -0,0 +1,16 @@
type string: 1 -> character
type a_of_s: 1 -> string
(* maybe some other type definitions *)
entry(arg) := {
[ string: one_name; string: another_name; a_of_s: many_names ]
another_name := reserve another_name(4); (* reserve space for an an array of character, with 4 members *)
many_names := reserve a_of_s(many_names);
many_names(0) := one_name;
many_names(1) := another_name;
many_names(2) := reserve a_of_s(2)(6); (* reserve space for an item of the same type as a_of_s(2), an array of character, with 6 members *)
many_names(2)(0) := "P";
return 0;
}
@@ -0,0 +1,16 @@
type string: 1 -> character
type a_of_s: 1 -> string
(* maybe some other type definitions *)
entry(arg) := {
[ string: one_name; string: another_name; a_of_s: many_names ]
another_name := reserve another_name(4); (* reserve space for an an array of character, with 4 members *)
many_names := reserve a_of_s(3);
many_names(0) := one_name;
many_names(1) := another_name;
many_names(2) := reserve a_of_s(2)(6); (* reserve space for an item of the same type as a_of_s(2), an array of character, with 6 members *)
many_names(2)(0) := "P";
return 0;
}
@@ -0,0 +1,17 @@
type rec: [character: x; integer: y]
type T2: rec -> integer
type main: string -> integer
function entry: main
function bar: T2
bar2 (r,s) := {
return r;
}
entry (arg) := {
[ integer: result ; rec: w]
result := bar('c', 7);
return 0;
}
@@ -0,0 +1,17 @@
type rec: [character: x; integer: y]
type T2: rec -> integer
type main: string -> integer
function entry: main
function bar: T2
bar2 (r,s) := {
return s;
}
entry (arg) := {
[ integer: result ; rec: w]
result := bar('c', 7);
return 0;
}