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

Fix String.concat ignoring the len parameter #2723

Merged
merged 4 commits into from
May 30, 2018
Merged
Changes from 1 commit
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: 3 additions & 1 deletion packages/builtin/string.pony
Original file line number Diff line number Diff line change
Expand Up @@ -880,12 +880,14 @@ actor Main

n = 0

while n < len do
while (n < len) or (len == USize(-1)) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the len == USize(-1) case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, i went and looked at the surrounding code. given that len == -1 is the default, i suspect the ordering should be reversed. if -1 is the most common, we should test for that first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default value of len is -1, meaning the amount of values to read should not be limited.
but now that you say it, being unsigned, this could be omitted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah right. sorry. sick and not quite with it today.

if iter.has_next() then
push(iter.next()?)
else
return
end

n = n + 1
end
end

Expand Down