diff --git a/tests/sprint3/expected/sp3_and_or_type_check.expected b/tests/sprint3/expected/sp3_and_or_type_check.expected index 600a1f9..493f53b 100644 --- a/tests/sprint3/expected/sp3_and_or_type_check.expected +++ b/tests/sprint3/expected/sp3_and_or_type_check.expected @@ -1,34 +1,50 @@ -NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION : -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -test : 001001 : : undefined : Function Definition -main : 001001 : : rec -> integer : Type of Function -rec : 001001 : : Record Type : elements-2 size-8 bytes -integer : 001001 : : Primitive Type : size-4 bytes -address : 001001 : : Primitive Type : size-8 bytes -character : 001001 : : Primitive Type : size-1 bytes -string : 001001 : : 1 -> character : Type of Array -Boolean : 001001 : : Primitive Type : size-4 bytes -reserve type : 001001 : : integer -> address : Type of Function -reserve : 001001 : : undefined : Function Definition -release type : 001001 : : address -> integer : Type of Function -release : 001001 : : undefined : Function Definition -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -b : 005000 : 001001 : Boolean : Primitive Instance -x : 005000 : 001001 : integer : Primitive Instance -arg : 005000 : 001001 : integer : Primitive Instance -undefined : 005000 : 001001 : integer : Primitive Instance -------------------------------:--------:--------:-----------------------------------:-----------------------------------: - : 023009 : 005000 : : Empty Scope -------------------------------:--------:--------:-----------------------------------:-----------------------------------: - : 021014 : 005000 : : Empty Scope -------------------------------:--------:--------:-----------------------------------:-----------------------------------: - : 017009 : 005000 : : Empty Scope -------------------------------:--------:--------:-----------------------------------:-----------------------------------: - : 015017 : 005000 : : Empty Scope -------------------------------:--------:--------:-----------------------------------:-----------------------------------: - : 011012 : 005000 : : Empty Scope -------------------------------:--------:--------:-----------------------------------:-----------------------------------: - : 007015 : 005000 : : Empty Scope -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -y : 001000 : 001001 : integer : Primitive Instance -x : 001000 : 001001 : integer : Primitive Instance +001: type rec: [integer: x; integer: y] +002: type main: rec -> integer +003: function test: main +004: +005: test (arg) := { +006: [integer:x; Boolean: b] +007: while (true) { +008: x := 0; +009: } +010: +011: while (7) { +012: x := 1; +013: } +014: +015: if (true) then { +016: x := 1; +017: } else { +018: x := 0; +019: } +020: +021: if (x) then { +022: x := 0; +023: } else { +024: x := 1; +025: } +026: +027: b := b | b; +028: b := b & b; +029: b := 1 | b; + LINE (29:12) ** TYPE ERROR: b != undefined + +030: b := b | 1; + LINE (30:12) ** TYPE ERROR: b != undefined + +031: b := b & 1; + LINE (31:12) ** TYPE ERROR: b != undefined + +032: b := 1 & b; + LINE (32:12) ** TYPE ERROR: b != undefined + +033: b := 1 = 1; +034: +035: +036: +037: b := 1 = b; + LINE (37:12) ** TYPE ERROR: b != undefined + +038: +039: return 0; +040: } diff --git a/tests/sprint3/expected/sp3_boolean_binary_op_typecheck.expected b/tests/sprint3/expected/sp3_boolean_binary_op_typecheck.expected index 1653f88..f95e765 100644 --- a/tests/sprint3/expected/sp3_boolean_binary_op_typecheck.expected +++ b/tests/sprint3/expected/sp3_boolean_binary_op_typecheck.expected @@ -1,20 +1,16 @@ -NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION : -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -entry : 001001 : : undefined : Function Definition -main : 001001 : : string -> integer : Type of Function -integer : 001001 : : Primitive Type : size-4 bytes -address : 001001 : : Primitive Type : size-8 bytes -character : 001001 : : Primitive Type : size-1 bytes -string : 001001 : : 1 -> character : Type of Array -Boolean : 001001 : : Primitive Type : size-4 bytes -reserve type : 001001 : : integer -> address : Type of Function -reserve : 001001 : : undefined : Function Definition -release type : 001001 : : address -> integer : Type of Function -release : 001001 : : undefined : Function Definition -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -b1 : 004000 : 001001 : Boolean : Primitive Instance -b2 : 004000 : 001001 : Boolean : Primitive Instance -arr2 : 004000 : 001001 : address : Primitive Instance -arr : 004000 : 001001 : address : Primitive Instance -x : 004000 : 001001 : integer : Primitive Instance -arg : 004000 : 001001 : string : Array Instance +001: type main: string -> integer +002: function entry: main +003: +004: entry (arg) := { +005: [integer:x; address: arr; address: arr2; Boolean : b2; Boolean : b1] +006: +007: b2 := 3 < x; +008: b1 := arr = 2; + LINE (8:18) ** TYPE ERROR: b1 != undefined + +009: b1 := 6<7 & arr2=7; + LINE (9:23) ** TYPE ERROR: b1 != undefined + +010: +011: return 0; +012: } diff --git a/tests/sprint3/expected/sp3_boolean_unary_op_typecheck.expected b/tests/sprint3/expected/sp3_boolean_unary_op_typecheck.expected index 1653f88..39237bc 100644 --- a/tests/sprint3/expected/sp3_boolean_unary_op_typecheck.expected +++ b/tests/sprint3/expected/sp3_boolean_unary_op_typecheck.expected @@ -1,20 +1,13 @@ -NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION : -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -entry : 001001 : : undefined : Function Definition -main : 001001 : : string -> integer : Type of Function -integer : 001001 : : Primitive Type : size-4 bytes -address : 001001 : : Primitive Type : size-8 bytes -character : 001001 : : Primitive Type : size-1 bytes -string : 001001 : : 1 -> character : Type of Array -Boolean : 001001 : : Primitive Type : size-4 bytes -reserve type : 001001 : : integer -> address : Type of Function -reserve : 001001 : : undefined : Function Definition -release type : 001001 : : address -> integer : Type of Function -release : 001001 : : undefined : Function Definition -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -b1 : 004000 : 001001 : Boolean : Primitive Instance -b2 : 004000 : 001001 : Boolean : Primitive Instance -arr2 : 004000 : 001001 : address : Primitive Instance -arr : 004000 : 001001 : address : Primitive Instance -x : 004000 : 001001 : integer : Primitive Instance -arg : 004000 : 001001 : string : Array Instance +001: type main: string -> integer +002: function entry: main +003: +004: entry (arg) := { +005: [integer:x; address: arr; address: arr2; Boolean : b2; Boolean : b1] +006: +007: b2 := !(3 < 2); +008: b1 := !5; + LINE (8:13) ** TYPE ERROR: b1 != undefined + +009: +010: return 0; +011: } diff --git a/tests/sprint3/expected/sp3_integer_binary_op_typecheck.expected b/tests/sprint3/expected/sp3_integer_binary_op_typecheck.expected index 8344120..0b4c83f 100644 --- a/tests/sprint3/expected/sp3_integer_binary_op_typecheck.expected +++ b/tests/sprint3/expected/sp3_integer_binary_op_typecheck.expected @@ -1,26 +1,25 @@ -NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION : -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -entry : 001001 : : undefined : Function Definition -rec : 001001 : : Record Type : elements-2 size-8 bytes -main : 001001 : : string -> integer : Type of Function -integer : 001001 : : Primitive Type : size-4 bytes -address : 001001 : : Primitive Type : size-8 bytes -character : 001001 : : Primitive Type : size-1 bytes -string : 001001 : : 1 -> character : Type of Array -Boolean : 001001 : : Primitive Type : size-4 bytes -reserve type : 001001 : : integer -> address : Type of Function -reserve : 001001 : : undefined : Function Definition -release type : 001001 : : address -> integer : Type of Function -release : 001001 : : undefined : Function Definition -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -r : 006000 : 001001 : rec : Record Instance -a : 006000 : 001001 : character : Primitive Instance -b1 : 006000 : 001001 : Boolean : Primitive Instance -b2 : 006000 : 001001 : Boolean : Primitive Instance -arr2 : 006000 : 001001 : address : Primitive Instance -arr : 006000 : 001001 : address : Primitive Instance -x : 006000 : 001001 : integer : Primitive Instance -arg : 006000 : 001001 : string : Array Instance -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -y : 003000 : 001001 : integer : Primitive Instance -x : 003000 : 001001 : integer : Primitive Instance +001: type main: string -> integer +002: +003: type rec: [integer: x; integer: y] +004: function entry: main +005: +006: entry (arg) := { +007: [integer:x; address: arr; address: arr2; Boolean : b2; Boolean : b1; character : a; rec : r] +008: +009: x := 3 + 2 * 8; +010: x := 3 - 2 / 8; +011: x := a * 2 % 8; + LINE (11:20) ** TYPE ERROR: x != undefined + +012: b2 := 3 * 2 % 8; +013: x := 3 % 2 * 8; +014: x := 3 + arr - 8; + LINE (14:22) ** TYPE ERROR: x != undefined + +015: x := r.x; + LINE (15:10) ** TYPE ERROR: x != r + +016: x := a.x; +017: +018: return 0; +019: } diff --git a/tests/sprint3/expected/sp3_integer_unary_op_typecheck.expected b/tests/sprint3/expected/sp3_integer_unary_op_typecheck.expected index 1653f88..18bd5a7 100644 --- a/tests/sprint3/expected/sp3_integer_unary_op_typecheck.expected +++ b/tests/sprint3/expected/sp3_integer_unary_op_typecheck.expected @@ -1,20 +1,14 @@ -NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION : -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -entry : 001001 : : undefined : Function Definition -main : 001001 : : string -> integer : Type of Function -integer : 001001 : : Primitive Type : size-4 bytes -address : 001001 : : Primitive Type : size-8 bytes -character : 001001 : : Primitive Type : size-1 bytes -string : 001001 : : 1 -> character : Type of Array -Boolean : 001001 : : Primitive Type : size-4 bytes -reserve type : 001001 : : integer -> address : Type of Function -reserve : 001001 : : undefined : Function Definition -release type : 001001 : : address -> integer : Type of Function -release : 001001 : : undefined : Function Definition -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -b1 : 004000 : 001001 : Boolean : Primitive Instance -b2 : 004000 : 001001 : Boolean : Primitive Instance -arr2 : 004000 : 001001 : address : Primitive Instance -arr : 004000 : 001001 : address : Primitive Instance -x : 004000 : 001001 : integer : Primitive Instance -arg : 004000 : 001001 : string : Array Instance +001: type main: string -> integer +002: function entry: main +003: +004: entry (arg) := { +005: [integer:x; address: arr; address: arr2; Boolean : b2; Boolean : b1] +006: +007: x := -8; +008: x := -b1; + LINE (8:10) ** TYPE ERROR: x != undefined + +009: b2 := -x; +010: +011: return 0; +012: } diff --git a/tests/sprint3/test/sp3_multiple_args.alpha b/tests/sprint3/test/sp3_multiple_args.alpha index e59c4b6..8475d92 100644 --- a/tests/sprint3/test/sp3_multiple_args.alpha +++ b/tests/sprint3/test/sp3_multiple_args.alpha @@ -6,12 +6,13 @@ type main: string -> integer function entry: main function bar: T2 -bar2 (r,s) := { - return r; +bar (r,s) := { + return 0; } entry (arg) := { [ integer: result ; rec: w] + result := bar(1,2); result := bar('c', 7); return 0; } \ No newline at end of file diff --git a/tests/sprint3/test/sp3_multiple_args.alpha~ b/tests/sprint3/test/sp3_multiple_args.alpha~ deleted file mode 100644 index 641c654..0000000 --- a/tests/sprint3/test/sp3_multiple_args.alpha~ +++ /dev/null @@ -1,17 +0,0 @@ -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; -} \ No newline at end of file