aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-06 19:20:07 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-06 19:20:07 -0400
commit1d2e55f53dfab5153dbfd0c03f28cd9daedb3b77 (patch)
treeaa1c21191800467abe0b3d16cb6c2a0c2e4587f9 /test
parentbc93dea8186168aa015b05a615bc1873173393b5 (diff)
Allow uninitialized variables when there's a sensible empty value
(defaults to empty/zero value)
Diffstat (limited to 'test')
-rw-r--r--test/arrays.tm6
-rw-r--r--test/defer.tm2
-rw-r--r--test/import.tm4
-rw-r--r--test/iterators.tm2
-rw-r--r--test/reductions.tm2
5 files changed, 10 insertions, 6 deletions
diff --git a/test/arrays.tm b/test/arrays.tm
index f2ed2c7a..8122106c 100644
--- a/test/arrays.tm
+++ b/test/arrays.tm
@@ -4,6 +4,10 @@ func main()
= []
do
+ >> nums : [Num32]
+ = []
+
+ do
>> arr := [10, 20, 30]
= [10, 20, 30]
@@ -104,7 +108,7 @@ func main()
>> heap := @[(i * 1337) mod 37 for i in 10]
>> heap.heapify()
>> heap
- heap_order : @[Int] = @[]
+ heap_order : @[Int]
repeat
heap_order.insert(heap.heap_pop() or stop)
>> heap_order[] == heap_order.sorted()
diff --git a/test/defer.tm b/test/defer.tm
index e5033075..6c204851 100644
--- a/test/defer.tm
+++ b/test/defer.tm
@@ -1,6 +1,6 @@
func main()
x := 123
- nums : @[Int] = @[]
+ nums : @[Int]
do
defer
nums.insert(x)
diff --git a/test/import.tm b/test/import.tm
index a6a6fa16..0686190b 100644
--- a/test/import.tm
+++ b/test/import.tm
@@ -8,11 +8,11 @@ func returns_imported_type(->ImportedType)
return get_value() # Imported from ./use_import.tm
func main()
- >> empty : [vectors.Vec2] = []
+ >> empty : [vectors.Vec2]
>> returns_vec()
= Vec2(x=1, y=2)
- >> imported : [ImportedType] = []
+ >> imported : [ImportedType]
>> returns_imported_type()
= ImportedType("Hello")
diff --git a/test/iterators.tm b/test/iterators.tm
index 1816fd7a..08382cff 100644
--- a/test/iterators.tm
+++ b/test/iterators.tm
@@ -25,7 +25,7 @@ func main()
= ["AB", "BC", "CD"]
do
- result : @[Text] = @[]
+ result : @[Text]
for foo in pairwise(values)
result.insert("$(foo.x)$(foo.y)")
>> result[]
diff --git a/test/reductions.tm b/test/reductions.tm
index 2666e1a9..3ec2ef5e 100644
--- a/test/reductions.tm
+++ b/test/reductions.tm
@@ -4,7 +4,7 @@ func main()
>> (+: [10, 20, 30])
= 60?
- >> empty_ints : [Int] = []
+ >> empty_ints : [Int]
>> (+: empty_ints)
= none