test updates woooo

This commit is contained in:
Scarlett
2025-05-04 16:05:13 -04:00
parent ea7c284665
commit a61d0a57e8
167 changed files with 1757 additions and 572 deletions

View File

@ -0,0 +1,92 @@
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;
LINE (8:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t1 of type integer
LINE (8:9) ** TYPE ERROR: Invalid type passed to assignable.
LINE (8:3) ** TYPE ERROR: Undefined variable x
009: }
010:
011: while (7) {
012: x := 1;
LINE (12:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t3 of type integer
LINE (12:9) ** TYPE ERROR: Invalid type passed to assignable.
LINE (12:3) ** TYPE ERROR: Undefined variable x
013: }
014:
015: if (true) then {
016: x := 1;
LINE (16:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t5 of type integer
LINE (16:9) ** TYPE ERROR: Invalid type passed to assignable.
LINE (16:3) ** TYPE ERROR: Undefined variable x
017: } else {
018: x := 0;
LINE (18:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t6 of type integer
LINE (18:9) ** TYPE ERROR: Invalid type passed to assignable.
LINE (18:3) ** TYPE ERROR: Undefined variable x
019: }
020:
021: if (x) then {
LINE (21:6) ** TYPE ERROR: Undefined variable x
022: x := 0;
LINE (22:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t7 of type integer
LINE (22:9) ** TYPE ERROR: Invalid type passed to assignable.
LINE (22:3) ** TYPE ERROR: Undefined variable x
023: } else {
024: x := 1;
LINE (24:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t8 of type integer
LINE (24:9) ** TYPE ERROR: Invalid type passed to assignable.
LINE (24:3) ** TYPE ERROR: Undefined variable x
025: }
026:
027: b := b | b;
LINE (27:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (27:12) ** TYPE ERROR: Object undefined of type undefined and Object undefined of type undefined must both be Boolean
LINE (27:11) ** TYPE ERROR: Undefined variable b
LINE (27:7) ** TYPE ERROR: Undefined variable b
LINE (27:2) ** TYPE ERROR: Undefined variable b
028: b := b & b;
LINE (28:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (28:12) ** TYPE ERROR: Object undefined of type undefined and Object undefined of type undefined must both be Boolean
LINE (28:11) ** TYPE ERROR: Undefined variable b
LINE (28:7) ** TYPE ERROR: Undefined variable b
LINE (28:2) ** TYPE ERROR: Undefined variable b
029: b := 1 | b;
LINE (29:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (29:12) ** TYPE ERROR: Object $t9 of type integer and Object undefined of type undefined must both be Boolean
LINE (29:11) ** TYPE ERROR: Undefined variable b
LINE (29:2) ** TYPE ERROR: Undefined variable b
030: b := b | 1;
LINE (30:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (30:12) ** TYPE ERROR: Object undefined of type undefined and Object $t10 of type integer must both be Boolean
LINE (30:7) ** TYPE ERROR: Undefined variable b
LINE (30:2) ** TYPE ERROR: Undefined variable b
031: b := b & 1;
LINE (31:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (31:12) ** TYPE ERROR: Object undefined of type undefined and Object $t11 of type integer must both be Boolean
LINE (31:7) ** TYPE ERROR: Undefined variable b
LINE (31:2) ** TYPE ERROR: Undefined variable b
032: b := 1 & b;
LINE (32:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (32:12) ** TYPE ERROR: Object $t12 of type integer and Object undefined of type undefined must both be Boolean
LINE (32:11) ** TYPE ERROR: Undefined variable b
LINE (32:2) ** TYPE ERROR: Undefined variable b
033: b := 1 = 1;
LINE (33:12) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t15 of type Boolean
LINE (33:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (33:2) ** TYPE ERROR: Undefined variable b
034:
035:
036:
037: b := 1 = b;
LINE (37:12) ** TYPE ERROR: Invalid type passed to assignable.
LINE (37:12) ** TYPE ERROR: Object $t16 of type integer and Object undefined of type undefined must both be the same type
LINE (37:11) ** TYPE ERROR: Undefined variable b
LINE (37:2) ** TYPE ERROR: Undefined variable b
038:
039: return 0;
040: }

View File

@ -1,50 +0,0 @@
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: }

View File

@ -0,0 +1,17 @@
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: Assignable Assign Expression - Object b1 of type Boolean != Object undefined of type undefined
LINE (8:18) ** TYPE ERROR: Object arr of type address and Object $t2 of type integer must both be the same type
009: b1 := 6<7 & arr2=7;
LINE (9:23) ** TYPE ERROR: Assignable Assign Expression - Object b1 of type Boolean != Object undefined of type undefined
LINE (9:23) ** TYPE ERROR: Object $t5 of type Boolean and Object undefined of type undefined must both be Boolean
LINE (9:23) ** TYPE ERROR: Object arr2 of type address and Object $t6 of type integer must both be the same type
010:
011: return 0;
012: }

View File

@ -1,16 +0,0 @@
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: }

View File

@ -6,8 +6,8 @@
006:
007: b2 := !(3 < 2);
008: b1 := !5;
LINE (8:13) ** TYPE ERROR: b1 != undefined
LINE (8:13) ** TYPE ERROR: Assignable Assign Expression - Object b1 of type Boolean != Object undefined of type undefined
LINE (8:12) ** TYPE ERROR: Object $t4 of type integer is not of type Boolean and can't be negated
009:
010: return 0;
011: }

View File

@ -0,0 +1,36 @@
001: type main: string -> integer
002: function entry: main
003:
004: type string: 1 -> character
005: type a_of_s: 1 -> string
006:
007: (* maybe some other type definitions *)
008:
009: entry (arg) := {
010: [ string: one_name; string: another_name; a_of_s: many_names ]
011:
012: one_name := "a string literal";
013: another_name := reserve another_name(4); (* reserve space for an an array of character, with 4 members *)
LINE (13:44) ** TYPE ERROR: Assignable Assign Expression - Object another_name of type string != Object undefined of type undefined
014: another_name(0) := 'C';
015: another_name(1) := 'a';
016: another_name(2) := 'r';
017: another_name(3) := 'l';
018: many_names := reserve many_names(3);
LINE (18:40) ** TYPE ERROR: Assignable Assign Expression - Object many_names of type a_of_s != Object undefined of type undefined
019: many_names(0) := one_name;
020: many_names(1) := another_name;
021: 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 *)
LINE (21:45) ** SYNTAX ERROR: Incorrect syntax at token ')'
LINE (21:44) ** SYNTAX ERROR: Incorrect syntax at token '6'
LINE (21:43) ** SYNTAX ERROR: Incorrect syntax at token '('
LINE (21:43) ** TYPE ERROR: Assignable Assign Expression - Object $t20 of type string != Object undefined of type undefined
022: many_names(2)(0) := 'P';
023: many_names(2)(1) := 'a';
024: many_names(2)(2) := 'r';
025: many_names(2)(3) := 't';
026: many_names(2)(4) := 'h';
027: many_names(2)(5) := 'o';
028:
029: return 0;
030: }

View File

@ -1,20 +0,0 @@
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
a_of_s : 001001 : : 1 -> string : Type of Array
string : 001001 : : 1 -> character : Type of Array
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
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
many_names : 009000 : 001001 : a_of_s : Array Instance
another_name : 009000 : 001001 : string : Array Instance
one_name : 009000 : 001001 : string : Array Instance
arg : 009000 : 001001 : string : Array Instance

View File

@ -0,0 +1,25 @@
001: type rec: [character: x; integer: y]
002:
003: type T2: rec -> integer
004:
005: type main: string -> integer
006: function entry: main
007: function bar: T2
008:
009: bar (r,s) := {
010: return 0;
011: }
012:
013: entry (arg) := {
014: [ integer: result ; rec: w]
015: if ( result = result ) then {
016: if ( result < w.y ) then {
017: result := 8;
018: } else {
019: result := 9;
020: }(* *)
021: } else {
022: result := bar('c', 7);
023: }
024: return 0;
025: }

View File

@ -0,0 +1,27 @@
001: type rec: [character: x; integer: y]
002:
003: type T2: rec -> integer
004:
005: type main: string -> integer
006: function entry: main
007: function bar: T2
008:
009: bar (r,s) := {
010: return 0;
011: }
012:
013: entry (arg) := {
014: [ integer: result ; rec: w]
015: while ( result = result ) {
016: result := result + 8;
017: if ( result < w.y ) then {
018: while (true) {
019: result := 8;
020: }
021: } else {
022: result := 9;
023: }
024: result := bar('c', 7);
025: }
026: return 0;
027: }

View File

@ -0,0 +1,28 @@
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: Assignable Assign Expression - Object x of type integer != Object undefined of type undefined
LINE (11:19) ** TYPE ERROR: Object undefined of type undefined and Object $t11 of type integer must both be integers
LINE (11:15) ** TYPE ERROR: Object a of type character and Object $t10 of type integer must both be integers
012: b2 := 3 * 2 % 8;
013: x := 3 % 2 * 8;
014: x := 3 + arr - 8;
LINE (14:22) ** TYPE ERROR: Assignable Assign Expression - Object x of type integer != Object undefined of type undefined
LINE (14:22) ** TYPE ERROR: Object undefined of type undefined and Object $t23 of type integer must both be integers
LINE (14:19) ** TYPE ERROR: Object $t22 of type integer and Object arr of type address must both be integers
LINE (14:19) ** TYPE ERROR: $t22 != arr
015: x := r.x;
016: x := a.x;
LINE (16:10) ** TYPE ERROR: Assignable Assign Expression - Object x of type integer != Object undefined of type undefined
LINE (16:9) ** TYPE ERROR: Invalid type passed to record access
017:
018: return 0;
019: }

View File

@ -1,25 +0,0 @@
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: }

View File

@ -6,8 +6,8 @@
006:
007: x := -8;
008: x := -b1;
LINE (8:10) ** TYPE ERROR: x != undefined
LINE (8:10) ** TYPE ERROR: Assignable Assign Expression - Object x of type integer != Object undefined of type undefined
LINE (8:10) ** TYPE ERROR: Object b1 of type Boolean is not of type integer and can't be negated
009: b2 := -x;
010:
011: return 0;

View File

@ -0,0 +1,23 @@
001: type rec: [character: x; integer: y]
002:
003: type T2: rec -> integer
004:
005: type main: string -> integer
006: function entry: main
007: function bar: T2
008:
009: bar (r,s) := {
010: return 0;
011: }
012:
013: entry (arg) := {
014: [ integer: result ; rec: w]
015: while ( result = result ) {
016: while ( result < w.y ) {
017: result := 8;
018: }
019: result := 9;
020: }
021: result := bar('c', 7);
022: return 0;
023: }

View File

@ -1,25 +0,0 @@
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
bar : 001001 : : undefined : Function Definition
entry : 001001 : : undefined : Function Definition
main : 001001 : : string -> integer : Type of Function
T2 : 001001 : : rec -> integer : Type of Function
rec : 001001 : : Record Type : elements-2 size-6 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
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
w : 013000 : 001001 : rec : Record Instance
result : 013000 : 001001 : integer : Primitive Instance
arg : 013000 : 001001 : string : Array Instance
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
: 009000 : 001001 : : Empty Scope
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
y : 001000 : 001001 : integer : Primitive Instance
x : 001000 : 001001 : character : Primitive Instance

View File

@ -0,0 +1,23 @@
001: (*
002: Testing the following type checks:
003: - integer : primitive
004: - character : primitive
005: - boolean : primitive
006:
007: - address (not included, special case)
008: *)
009:
010:
011:
012: type main: string -> integer
013: function entry: main
014:
015: entry (arg) := {
016: [integer: i; address: add; character: char; Boolean: bool]
017:
018: i := 3 + 2 * 8;
019: char := 'a';
020: bool := true;
021:
022: return 0;
023: }

View File

@ -1,19 +0,0 @@
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
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
bool : 015000 : 001001 : Boolean : Primitive Instance
char : 015000 : 001001 : character : Primitive Instance
add : 015000 : 001001 : address : Primitive Instance
i : 015000 : 001001 : integer : Primitive Instance
arg : 015000 : 001001 : string : Array Instance

View File

@ -0,0 +1,3 @@
001: type tom : [integer : x; integer: y]
002: type rec : [integer : x; tom : prev; character : c; character : d; Boolean: b; integer : y]
003: type tricky : [Boolean : b1; integer : k1; Boolean : b2; integer : k2]

View File

@ -1,29 +0,0 @@
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
tricky : 001001 : : Record Type : elements-4 size-16 bytes
rec : 001001 : : Record Type : elements-6 size-24 bytes
tom : 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
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
k2 : 003000 : 001001 : integer : Primitive Instance
b2 : 003000 : 001001 : Boolean : Primitive Instance
k1 : 003000 : 001001 : integer : Primitive Instance
b1 : 003000 : 001001 : Boolean : Primitive Instance
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
y : 002000 : 001001 : integer : Primitive Instance
b : 002000 : 001001 : Boolean : Primitive Instance
d : 002000 : 001001 : character : Primitive Instance
c : 002000 : 001001 : character : Primitive Instance
prev : 002000 : 001001 : tom : Record Instance
x : 002000 : 001001 : integer : Primitive Instance
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
y : 001000 : 001001 : integer : Primitive Instance
x : 001000 : 001001 : integer : Primitive Instance

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type rec: [integer: x; integer: y]
type main: rec -> integer
function test: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type main: string -> integer
function entry: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type main: string -> integer
function entry: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type main: string -> integer
function entry: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type rec: [character: x; integer: y]
type T2: rec -> integer

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type rec: [character: x; integer: y]
type T2: rec -> integer

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type main: string -> integer
type rec: [integer: x; integer: y]

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type main: string -> integer
function entry: main

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type rec: [character: x; integer: y]
type T2: rec -> integer

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
(*
Testing the following type checks:
- integer : primitive

View File

@ -1,3 +1,4 @@
(* TEST: [-asc -tc] *)
type tom : [integer : x; integer: y]
type rec : [integer : x; tom : prev; character : c; character : d; Boolean: b; integer : y]
type tricky : [Boolean : b1; integer : k1; Boolean : b2; integer : k2]