From d05b6f456c45d45c6d91ee4d20e98cf2cf231269 Mon Sep 17 00:00:00 2001 From: Scarlett Date: Wed, 2 Apr 2025 11:54:13 -0400 Subject: [PATCH] rebase --- tests/sprint2/test/sp2_carls_mistake.alpha | 2 ++ .../test/sp3_carls_second_mistake.alpha | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/sprint3/test/sp3_carls_second_mistake.alpha diff --git a/tests/sprint2/test/sp2_carls_mistake.alpha b/tests/sprint2/test/sp2_carls_mistake.alpha index f2b3703..75fa12f 100644 --- a/tests/sprint2/test/sp2_carls_mistake.alpha +++ b/tests/sprint2/test/sp2_carls_mistake.alpha @@ -1,6 +1,7 @@ type rec: [integer: x; integer: y] type T1: integer -> integer type T2: rec -> integer +type arr : 1 -> integer function foo : T1 function bar1 : T2 @@ -23,5 +24,6 @@ entry(arg) := { w.y := 7; result := bar1(w); (* pass w (a rec type value) to bar1 *) result := bar2(5,7); (* implicitly build a rec type value, assign 5 and 7 to fields x and y, but call them r and s *) + arr(3); return 0; } diff --git a/tests/sprint3/test/sp3_carls_second_mistake.alpha b/tests/sprint3/test/sp3_carls_second_mistake.alpha new file mode 100644 index 0000000..9eb4864 --- /dev/null +++ b/tests/sprint3/test/sp3_carls_second_mistake.alpha @@ -0,0 +1,25 @@ +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 ] + one_name := "a string literal"; + another_name := reserve another_name(4); (* reserve space for an an array of character, with 4 members *) + another_name(0) := 'C'; + another_name(1) := 'a'; + another_name(2) := 'r'; + another_name(3) := 'l'; + a_of_s := reserve a_of_s(3); + a_of_s(0) := one_name; + a_of_s(1) := another_name; + many_names(2) := reserve many_names(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"; + many_names(2)(1) := "a"; + many_names(2)(2) := "r"; + many_names(2)(3) := "t"; + many_names(2)(4) := "h"; + many_names(2)(5) := "o"; + return 0; +} \ No newline at end of file