inferred leading comptime params
This commit is contained in:
@@ -23,7 +23,7 @@ task_list_init func(allocator mem.Allocator) TaskList {
|
||||
alloc_i32s func(allocator mem.Allocator, count usize) ?[]mut i32 {
|
||||
fallback [1]mut i32 = undefined
|
||||
failed bool = false
|
||||
values []mut i32 = mem.alloc(i32, allocator, count) catch |_| {
|
||||
values []mut i32 = mem.alloc(allocator, count) catch |_| {
|
||||
failed = true
|
||||
yield (&fallback).ptr[..0]
|
||||
}
|
||||
@@ -33,7 +33,7 @@ alloc_i32s func(allocator mem.Allocator, count usize) ?[]mut i32 {
|
||||
|
||||
free_i32s func(allocator mem.Allocator, values ?[]mut i32) void {
|
||||
if values |slice| {
|
||||
mem.free(i32, allocator, slice)
|
||||
mem.free(allocator, slice)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,12 +49,12 @@ typed_allocator_test func() i32 {
|
||||
|
||||
i32_fallback [1]mut i32 = undefined
|
||||
empty_failed bool = false
|
||||
empty []mut i32 = mem.alloc(i32, first_allocator, 0) catch |_| {
|
||||
empty []mut i32 = mem.alloc(first_allocator, 0) catch |_| {
|
||||
empty_failed = true
|
||||
yield (&i32_fallback).ptr[..0]
|
||||
}
|
||||
if (empty_failed or empty.len != 0 or first_calls[0] != 3) return 34
|
||||
mem.free(i32, first_allocator, empty)
|
||||
mem.free(first_allocator, empty)
|
||||
if (first_calls[0] != 3) return 33
|
||||
|
||||
zero_sized_fallback [1]mut [0]u8 = undefined
|
||||
@@ -70,7 +70,7 @@ typed_allocator_test func() i32 {
|
||||
|
||||
u64_fallback [1]mut u64 = undefined
|
||||
overflow_fallback_failed bool = false
|
||||
overflow_fallback []mut u64 = mem.alloc(u64, first_allocator, 0) catch |_| {
|
||||
overflow_fallback []mut u64 = mem.alloc(first_allocator, 0) catch |_| {
|
||||
overflow_fallback_failed = true
|
||||
yield (&u64_fallback).ptr[..0]
|
||||
}
|
||||
@@ -83,20 +83,20 @@ typed_allocator_test func() i32 {
|
||||
if (overflow_failed == false or first_calls[0] != 3) return 40
|
||||
|
||||
typed_failed bool = false
|
||||
typed []mut i32 = mem.alloc(i32, mem.c_allocator, 4) catch |_| {
|
||||
typed []mut i32 = mem.alloc(mem.c_allocator, 4) catch |_| {
|
||||
typed_failed = true
|
||||
yield (&i32_fallback).ptr[..0]
|
||||
}
|
||||
if (typed_failed) return 38
|
||||
defer mem.free(i32, mem.c_allocator, typed)
|
||||
defer mem.free(mem.c_allocator, typed)
|
||||
typed[0] = 10
|
||||
typed[3] = 20
|
||||
if (typed[0] + typed[3] != 30) return 39
|
||||
typed = mem.realloc(i32, mem.c_allocator, typed, 8) catch |_| {
|
||||
typed = mem.realloc(mem.c_allocator, typed, 8) catch |_| {
|
||||
return 41
|
||||
}
|
||||
if (typed.len != 8 or typed[0] != 10 or typed[3] != 20) return 42
|
||||
typed = mem.realloc(i32, mem.c_allocator, typed, 2) catch |_| {
|
||||
typed = mem.realloc(mem.c_allocator, typed, 2) catch |_| {
|
||||
return 43
|
||||
}
|
||||
if (typed.len != 2 or typed[0] != 10) return 44
|
||||
|
||||
Reference in New Issue
Block a user