aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-06-24 15:38:29 +0200
committerBad Diode <bd@badd10de.dev>2024-06-24 15:38:29 +0200
commitec7faebe81c6d4aad7f2927962fae5c9f414eb66 (patch)
tree7a382c8ddf815f1623a9bade35e68b63dbdf7797 /tests
parent5d3bd237db051902161a919a2efb6ca25de449d9 (diff)
downloadbdl-ec7faebe81c6d4aad7f2927962fae5c9f414eb66.tar.gz
bdl-ec7faebe81c6d4aad7f2927962fae5c9f414eb66.zip
Add funcall typechecking
Diffstat (limited to 'tests')
-rw-r--r--tests/semantics.bad60
1 files changed, 34 insertions, 26 deletions
diff --git a/tests/semantics.bad b/tests/semantics.bad
index 3305222..3479915 100644
--- a/tests/semantics.bad
+++ b/tests/semantics.bad
@@ -1,23 +1,31 @@
1; let a:f32 = (1.0 + 2.0 * 2.0) / 2.0 1fun add10(a: int, b: str): int {
2 2 a + 10
3let annotated:int = (1 + 2 * 2) / 2
4let numbers = 1
5let symbols = numbers
6let arith = 1 + 2 * 4
7let cmp = 1 <= 2
8let logic = !true && false || (1 <= 2)
9let bits = 0xff & 0b00001111
10let block = {
11 let a = 1 + 2
12 a + 3
13} 3}
14 4
15let maybe = if (1 == 2) { 5fun foo(): int {
16 32 6 add10(1, "hello")
17} else {
18 44
19} 7}
20 8
9; let a:f32 = (1.0 + 2.0 * 2.0) / 2.0
10
11; let annotated:int = (1 + 2 * 2) / 2
12; let numbers = 1
13; let symbols = numbers
14; let arith = 1 + 2 * 4
15; let cmp = 1 <= 2
16; let logic = !true && false || (1 <= 2)
17; let bits = 0xff & 0b00001111
18; let block = {
19; let a = 1 + 2
20; a + 3
21; }
22
23; let maybe = if (1 == 2) {
24; 32
25; } else {
26; 44
27; }
28
21; let single = if (true) { 29; let single = if (true) {
22; 123 30; 123
23; } 31; }
@@ -112,16 +120,16 @@ fun nested(): int {
112; let c = 1 120; let c = 1
113; 1 + 1 + c 121; 1 + 1 + c
114; } 122; }
115fun foo(a: int b: str): (f64, f64) { 123; fun foo(a: int b: str): (f64, f64) {
116 fun bar(): nil { 124; fun bar(): nil {
117 println("ding") 125; println("ding")
118 } 126; }
119 if (a == 1) { 127; if (a == 1) {
120 ; return("test", b) 128; ; return("test", b)
121 return(3.0, 4.0) 129; return (3.0, 4.0)
122 } 130; }
123 return(1.0, 2.0) 131; return (1.0, 2.0)
124} 132; }
125 133
126; let b = a 134; let b = a
127; let a = a 135; let a = a