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

Possible boundary condition in Array.slice #892

Closed
dterhorst opened this Issue Aug 6, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@dterhorst

dterhorst commented Aug 6, 2017

Version

$ elm repl
---- elm-repl 0.18.0 -----------------------------------------------------------
 :help for help, :exit to exit, more at <https://github.com/elm-lang/elm-repl>
--------------------------------------------------------------------------------

Code

> import Array
> Array.repeat 32 0 |> Array.slice 0 33

Expected Result

Array.fromList [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
    : Array.Array number

Actual Result

TypeError: Cannot read property 'height' of undefined

Note

Array.repeat 31 0 |> Array.slice 0 33 works.
Array.repeat 32 0 |> Array.slice 0 33 fails.
Array.repeat 33 0 |> Array.slice 0 33 works.

Array.repeat 33 0 |> Array.slice 0 34 fails.

Given Array.repeat length 0 |> Array.slice 0 limit,
the problem seems to occur any time 32 <= length < limit.


A similar problem occurs with Array.fromList:

> List.repeat 33 0 |> Array.fromList |> Array.slice 0 34
TypeError: Cannot read property 'height' of undefined

However, it only occurs when the length of the list
is 33 <= length < limit as opposed to 32,
so there is something slightly different about that case.

@process-bot

This comment has been minimized.

Show comment
Hide comment
@process-bot

process-bot Aug 6, 2017

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot commented Aug 6, 2017

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@Skinney

This comment has been minimized.

Show comment
Hide comment
@Skinney

Skinney Aug 6, 2017

Contributor

This should be fixed in Elm 0.19

Contributor

Skinney commented Aug 6, 2017

This should be fixed in Elm 0.19

@dterhorst

This comment has been minimized.

Show comment
Hide comment
@dterhorst

dterhorst Aug 6, 2017

Thanks. 👍

dterhorst commented Aug 6, 2017

Thanks. 👍

@dterhorst dterhorst closed this Aug 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment