worked on function call return type check and started checking return type
This commit is contained in:
16
tests/sprint2/test/sp2_sp2_arrayargs.alpha
Normal file
16
tests/sprint2/test/sp2_sp2_arrayargs.alpha
Normal file
@ -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;
|
||||
}
|
16
tests/sprint2/test/sp2_sp2_arrayargs.alpha~
Normal file
16
tests/sprint2/test/sp2_sp2_arrayargs.alpha~
Normal file
@ -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;
|
||||
}
|
17
tests/sprint3/test/sp3_multiple_args.alpha
Normal file
17
tests/sprint3/test/sp3_multiple_args.alpha
Normal file
@ -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;
|
||||
}
|
17
tests/sprint3/test/sp3_multiple_args.alpha~
Normal file
17
tests/sprint3/test/sp3_multiple_args.alpha~
Normal file
@ -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;
|
||||
}
|
Reference in New Issue
Block a user