close some gaps in the type system
This commit is contained in:
@@ -38,6 +38,10 @@ fixed_len func($T type, $N usize, value @Fixed(T, N)) usize {
|
||||
return value.values.len
|
||||
}
|
||||
|
||||
same_type func($Expected, $Actual type, _ Actual) bool {
|
||||
return $(Expected == Actual)
|
||||
}
|
||||
|
||||
take_i32 func(value i32) i32 {
|
||||
return value
|
||||
}
|
||||
@@ -87,5 +91,12 @@ main func() i32 {
|
||||
_ = assigned
|
||||
_ = take_i32(zero())
|
||||
_ = return_zero()
|
||||
optional ?u32 = none
|
||||
if !same_type(?u32, optional) {
|
||||
return 8
|
||||
}
|
||||
if same_type(?u16, optional) {
|
||||
return 9
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -85,6 +85,11 @@ vif_defer func() i32 {
|
||||
return r # 5
|
||||
}
|
||||
|
||||
vif_expression func(old_entries []u8) usize {
|
||||
new_size :: if (old_entries.len > 0) old_entries.len * 2 else 8
|
||||
return new_size
|
||||
}
|
||||
|
||||
# --- value loops (milestone 20.5) --------------------------------------------
|
||||
|
||||
# Labeled `for` used as a value: `yield :blk i` exits early with a value, the
|
||||
@@ -306,6 +311,8 @@ main func() i32 {
|
||||
if (vif_reassign(0) != 7) return 110
|
||||
if (vif_reassign(9) != 9) return 111
|
||||
if (vif_defer() != 5) return 112
|
||||
if (vif_expression("") != 8) return 136
|
||||
if (vif_expression("abc") != 6) return 137
|
||||
|
||||
if (loop_search() != 0) return 113
|
||||
if (loop_none() != 0) return 114
|
||||
|
||||
Reference in New Issue
Block a user