diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-09-04 13:20:05 -0400 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-09-04 13:20:05 -0400 |
commit | 30a16a2fdfd527e89a83f49f53cb448aafcb4e9a (patch) | |
tree | 284a664cee7b5e53bdaf1fe560c1a80e950f058c /check | |
parent | 7e29eae526f7a5014934b92a239923dd30835afd (diff) | |
parent | 4fced0fc39d3aeacb3c6d434aeeb622468a857cc (diff) |
Merge branch 'type_checking' into func-array_info
Diffstat (limited to 'check')
34 files changed, 194 insertions, 6 deletions
diff --git a/check/for.p b/check/for.p index 694f9a5..5391c8c 100644 --- a/check/for.p +++ b/check/for.p @@ -1,14 +1,9 @@ program main ( input, output ); - var a, b: integer; - var x,y,z: real; - var ai :array [1..10] of integer; + var a, b,c: integer; begin -{ TEST } a := 1; - x := 3.14; - b := a + 35; (* test *) for c := 0 to 10 do begin for a:= 10 downto 0 do b := a - c diff --git a/check/type/addop/fail-int.p b/check/type/addop/fail-int.p new file mode 100644 index 0000000..0d75b0d --- /dev/null +++ b/check/type/addop/fail-int.p @@ -0,0 +1,4 @@ +program main ( input, output ); +begin + 1 + 1.1 +end. diff --git a/check/type/addop/fail-real.p b/check/type/addop/fail-real.p new file mode 100644 index 0000000..865f0fc --- /dev/null +++ b/check/type/addop/fail-real.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: integer; +begin + a := 1.1 + 1 +end. diff --git a/check/type/addop/pass-int.p b/check/type/addop/pass-int.p new file mode 100644 index 0000000..8a65883 --- /dev/null +++ b/check/type/addop/pass-int.p @@ -0,0 +1,4 @@ +program main ( input, output ); +begin + 1 + 1 +end. diff --git a/check/type/addop/pass-real.p b/check/type/addop/pass-real.p new file mode 100644 index 0000000..7cf1450 --- /dev/null +++ b/check/type/addop/pass-real.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: real; +begin + a := 3.1 + 0.04 +end. diff --git a/check/type/arrray/fail-access.p b/check/type/arrray/fail-access.p new file mode 100644 index 0000000..c77aee3 --- /dev/null +++ b/check/type/arrray/fail-access.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: array [1..10] of integer; +begin + a[3.2] := 1 +end. diff --git a/check/type/arrray/fail-int.p b/check/type/arrray/fail-int.p new file mode 100644 index 0000000..672f798 --- /dev/null +++ b/check/type/arrray/fail-int.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: array [1..10] of integer; +begin + a[3] := 1.1 +end. diff --git a/check/type/arrray/fail-real.p b/check/type/arrray/fail-real.p new file mode 100644 index 0000000..993dbf9 --- /dev/null +++ b/check/type/arrray/fail-real.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: array [1..10] of real; +begin + a[3] := 1 +end. diff --git a/check/type/arrray/pass-access.p b/check/type/arrray/pass-access.p new file mode 100644 index 0000000..a6af0ec --- /dev/null +++ b/check/type/arrray/pass-access.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: array [1..10] of integer; +begin + a[3] := 1 +end. diff --git a/check/type/arrray/pass-int.p b/check/type/arrray/pass-int.p new file mode 100644 index 0000000..a6af0ec --- /dev/null +++ b/check/type/arrray/pass-int.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: array [1..10] of integer; +begin + a[3] := 1 +end. diff --git a/check/type/arrray/pass-real.p b/check/type/arrray/pass-real.p new file mode 100644 index 0000000..582bbdb --- /dev/null +++ b/check/type/arrray/pass-real.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: array [1..10] of real; +begin + a[3] := 1.1 +end. diff --git a/check/type/assign/fail-int.p b/check/type/assign/fail-int.p new file mode 100644 index 0000000..d17bc1c --- /dev/null +++ b/check/type/assign/fail-int.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: integer; +begin + a := 1.1 +end. diff --git a/check/type/assign/fail-real.p b/check/type/assign/fail-real.p new file mode 100644 index 0000000..47fde34 --- /dev/null +++ b/check/type/assign/fail-real.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: real; +begin + a := 1 +end. diff --git a/check/type/assign/pass-int.p b/check/type/assign/pass-int.p new file mode 100644 index 0000000..5f150c8 --- /dev/null +++ b/check/type/assign/pass-int.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: integer; +begin + a := 1 +end. diff --git a/check/type/assign/pass-real.p b/check/type/assign/pass-real.p new file mode 100644 index 0000000..13db838 --- /dev/null +++ b/check/type/assign/pass-real.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: real; +begin + a := 1.1 +end. diff --git a/check/type/bool/.pass-bool.c.swp b/check/type/bool/.pass-bool.c.swp Binary files differnew file mode 100644 index 0000000..e18746d --- /dev/null +++ b/check/type/bool/.pass-bool.c.swp diff --git a/check/type/bool/fail-and.p b/check/type/bool/fail-and.p new file mode 100644 index 0000000..124de1f --- /dev/null +++ b/check/type/bool/fail-and.p @@ -0,0 +1,7 @@ + +program main ( input, output ); + var a: integer; +begin + a := 1; + (a = 1) and 1 +end. diff --git a/check/type/bool/fail-bool.p b/check/type/bool/fail-bool.p new file mode 100644 index 0000000..4cf0b6e --- /dev/null +++ b/check/type/bool/fail-bool.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: integer; +begin + not 1.1 +end. diff --git a/check/type/bool/fail-if.p b/check/type/bool/fail-if.p new file mode 100644 index 0000000..17126d6 --- /dev/null +++ b/check/type/bool/fail-if.p @@ -0,0 +1,9 @@ +program main ( input, output ); + var a: integer; +begin + if (1) + then + a:= 1 + else + a:= 0 +end. diff --git a/check/type/bool/fail-int.p b/check/type/bool/fail-int.p new file mode 100644 index 0000000..3eb4866 --- /dev/null +++ b/check/type/bool/fail-int.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: integer; +begin + 1 <> 1.1 +end. diff --git a/check/type/bool/fail-or.p b/check/type/bool/fail-or.p new file mode 100644 index 0000000..a48cdf3 --- /dev/null +++ b/check/type/bool/fail-or.p @@ -0,0 +1,6 @@ +program main ( input, output ); + var a: integer; +begin + a := 1; + (a = 1) or 1.1 +end. diff --git a/check/type/bool/fail-real.p b/check/type/bool/fail-real.p new file mode 100644 index 0000000..7c7d00d --- /dev/null +++ b/check/type/bool/fail-real.p @@ -0,0 +1,4 @@ +program main ( input, output ); +begin + 1.1 <> 1 +end. diff --git a/check/type/bool/fail-while.p b/check/type/bool/fail-while.p new file mode 100644 index 0000000..b02048d --- /dev/null +++ b/check/type/bool/fail-while.p @@ -0,0 +1,7 @@ +program main ( input, output ); + var a: integer; +begin + while (1) + do + a:= 0 +end. diff --git a/check/type/bool/pass-bool.p b/check/type/bool/pass-bool.p new file mode 100644 index 0000000..3701bcb --- /dev/null +++ b/check/type/bool/pass-bool.p @@ -0,0 +1,7 @@ +program main ( input, output ); + var a: integer; +begin + not (1.1 = 1.1); + (1.1 = 1.1) or (1 = 2); + (1.1 = 1.1) and (1 = 2) +end. diff --git a/check/type/bool/pass-if.p b/check/type/bool/pass-if.p new file mode 100644 index 0000000..30e5abf --- /dev/null +++ b/check/type/bool/pass-if.p @@ -0,0 +1,9 @@ +program main ( input, output ); + var a: integer; +begin + if ((1 = 1) ) + then + a:= 1 + else + a:= 0 +end. diff --git a/check/type/bool/pass-int.p b/check/type/bool/pass-int.p new file mode 100644 index 0000000..da2bc97 --- /dev/null +++ b/check/type/bool/pass-int.p @@ -0,0 +1,10 @@ +program main ( input, output ); + var a: integer; +begin + 1 = 1; + 1 <= 1; + 1 >= 1; + 1 < 1; + 1 > 1; + 1 <> 1 +end. diff --git a/check/type/bool/pass-real.p b/check/type/bool/pass-real.p new file mode 100644 index 0000000..67e8b99 --- /dev/null +++ b/check/type/bool/pass-real.p @@ -0,0 +1,10 @@ +program main ( input, output ); + var a: integer; +begin + 1.1 = 1.1; + 1.1 <= 1.1; + 1.1 >= 1.1; + 1.1 < 1.1; + 1.1 > 1.1; + 1.1 <> 1.1 +end. diff --git a/check/type/bool/pass-while.p b/check/type/bool/pass-while.p new file mode 100644 index 0000000..160c187 --- /dev/null +++ b/check/type/bool/pass-while.p @@ -0,0 +1,7 @@ +program main ( input, output ); + var a: integer; +begin + while ((1 = 1) ) + do + a:= 1 +end. diff --git a/check/type/fail-if.p b/check/type/fail-if.p new file mode 100644 index 0000000..17126d6 --- /dev/null +++ b/check/type/fail-if.p @@ -0,0 +1,9 @@ +program main ( input, output ); + var a: integer; +begin + if (1) + then + a:= 1 + else + a:= 0 +end. diff --git a/check/type/mulop/fail-int.p b/check/type/mulop/fail-int.p new file mode 100644 index 0000000..fdd83e3 --- /dev/null +++ b/check/type/mulop/fail-int.p @@ -0,0 +1,6 @@ +program main ( input, output ); + var a: integer; +begin + a := 1 * 1.1; + a := 1.1 +end. diff --git a/check/type/mulop/fail-real.p b/check/type/mulop/fail-real.p new file mode 100644 index 0000000..8975458 --- /dev/null +++ b/check/type/mulop/fail-real.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: integer; +begin + a := 1.1 * 1 +end. diff --git a/check/type/mulop/pass-int.p b/check/type/mulop/pass-int.p new file mode 100644 index 0000000..5f1f327 --- /dev/null +++ b/check/type/mulop/pass-int.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: integer; +begin + a := 1 * 1 +end. diff --git a/check/type/mulop/pass-real.p b/check/type/mulop/pass-real.p new file mode 100644 index 0000000..d03ee76 --- /dev/null +++ b/check/type/mulop/pass-real.p @@ -0,0 +1,5 @@ +program main ( input, output ); + var a: real; +begin + a := 3.1 * 0.04 +end. diff --git a/check/type/pass-if.p b/check/type/pass-if.p new file mode 100644 index 0000000..30e5abf --- /dev/null +++ b/check/type/pass-if.p @@ -0,0 +1,9 @@ +program main ( input, output ); + var a: integer; +begin + if ((1 = 1) ) + then + a:= 1 + else + a:= 0 +end. |