Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type restrictions to Array#concat #1091

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/array.cr
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class Array(T)
delete nil
end

def concat(other : Array)
def concat(other : Array(T))
other_length = other.length
new_length = length + other_length
if new_length > @capacity
Expand All @@ -407,7 +407,7 @@ class Array(T)
self
end

def concat(other : Enumerable)
def concat(other : Enumerable(T))
left_before_resize = @capacity - @length
len = @length
buf = @buffer + len
Expand Down