Skip to content

Commit

Permalink
Merge pull request #1346 from Unrealf1/master
Browse files Browse the repository at this point in the history
Fix misleading error in some built in array functions
  • Loading branch information
borisbat authored Oct 31, 2024
2 parents c46a2f5 + 1949a37 commit 4228c90
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/builtin/builtin.das
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def resize_and_init(var Arr:array<auto(numT)>;newSize:int; initValue:numT)
Arr[i] := initValue


[unused_argument(Arr, newSize)]
def resize_no_init(var Arr:array<auto(numT)>;newSize:int)
static_if typeinfo(is_raw type<numT>)
static_if typeinfo(need_lock_check type<numT>)
Expand All @@ -97,6 +98,7 @@ def reserve(var Arr:array<auto(numT)>;newSize:int)
def pop(var Arr:array<auto(numT)>)
unsafe(resize(Arr, length(Arr)-1)) // resize will throw if negative

[unused_argument(Arr, value)]
def push(var Arr:array<auto(numT)>;value:numT-# const;at:int)
static_if typeinfo(can_copy value)
static_if typeinfo(need_lock_check type<numT>)
Expand All @@ -105,6 +107,7 @@ def push(var Arr:array<auto(numT)>;value:numT-# const;at:int)
else
concept_assert(false,"can't push value, which can't be copied")

[unused_argument(Arr, value)]
def push(var Arr:array<auto(numT)>;value:numT-# const)
static_if typeinfo(can_copy value)
static_if typeinfo(need_lock_check type<numT>)
Expand All @@ -113,6 +116,7 @@ def push(var Arr:array<auto(numT)>;value:numT-# const)
else
concept_assert(false,"can't push value, which can't be copied")

[unused_argument(Arr, value)]
def push(var Arr:array<auto(numT)>; varr:array<numT>-#)
static_if typeinfo(can_copy type<numT>)
static_if typeinfo(need_lock_check type<numT>)
Expand All @@ -122,6 +126,7 @@ def push(var Arr:array<auto(numT)>; varr:array<numT>-#)
else
concept_assert(false,"can't push value, which can't be copied")

[unused_argument(Arr, value)]
def push(var Arr:array<auto(numT)>; varr:numT[]-#)
static_if typeinfo(can_copy type<numT>)
static_if typeinfo(need_lock_check type<numT>)
Expand All @@ -131,6 +136,7 @@ def push(var Arr:array<auto(numT)>; varr:numT[]-#)
else
concept_assert(false,"can't push value, which can't be copied")

[unused_argument(Arr, value)]
def push(var Arr:array<auto(numT)[]>; varr:numT[]-#)
static_if typeinfo(can_copy type<numT>)
static_if typeinfo(sizeof Arr[0])==typeinfo(sizeof varr)
Expand Down

0 comments on commit 4228c90

Please sign in to comment.