about summary refs log tree commit diff stats
path: root/js/baba-yaga/dev/vscode/type-modes-test.baba
blob: 93b8963f54fb799ec8796c0fb547727af18f30fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Baba Yaga Type Hints Test File
// Test all three type hint modes: none, inline, above

// Function definitions
add : Int -> Int -> Int;
add(x, y) : x + y;

multiply : Int -> Int -> Int;
multiply(x, y) : x * y;

// Basic expressions - should show type hints
result : add(5, 3);
product : multiply(4, 6);

// String operations - should show type hints  
name : "World";
greeting : str.concat("Hello, ", name);
length : str.length(greeting);

// Math operations - should show type hints
value : math.sqrt(16);
rounded : math.round(3.14159);

// List operations - should show type hints
numbers : [1, 2, 3, 4, 5];
doubled : map(x -> x * 2, numbers);
evens : filter(x -> x % 2 = 0, doubled);

// Pattern matching - should show type hints
check_result : when result is
  8 then Ok("correct")
  _ then Err("wrong");

// Result handling - should show type hints
success : Ok("success");
failure : Err("failure");

// Comments should NOT show type hints
// This is a comment with add(1, 2) and str.concat("test", "test")
// No type hints should appear here

// IO operations - should show type hints
io.out("Testing type hints");
user_input : io.in();