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

circshift(::Tuple{}, ::Int) throws DivideError instead of returning #54294

Open
nsajko opened this issue Apr 28, 2024 · 2 comments · May be fixed by #54295
Open

circshift(::Tuple{}, ::Int) throws DivideError instead of returning #54294

nsajko opened this issue Apr 28, 2024 · 2 comments · May be fixed by #54295
Labels
domain:collections Data structures holding multiple items, e.g. sets kind:bug Indicates an unexpected problem or unintended behavior

Comments

@nsajko
Copy link
Contributor

nsajko commented Apr 28, 2024

We should have circshift((), n::Int) == (), as with arrays.

julia> circshift((), 1)
ERROR: DivideError: integer division error
Stacktrace:
 [1] div
   @ ./int.jl:295 [inlined]
 [2] div
   @ ./div.jl:310 [inlined]
 [3] div
   @ ./div.jl:355 [inlined]
 [4] fld
   @ ./div.jl:321 [inlined]
 [5] mod
   @ ./int.jl:287 [inlined]
 [6] mod1
   @ ./operators.jl:875 [inlined]
 [7] circshift(x::Tuple{}, shift::Int64)
   @ Base ./tuple.jl:697
 [8] top-level scope
   @ REPL[1]:1

julia> versioninfo()
Julia Version 1.12.0-DEV.415
Commit aeac2891630 (2024-04-26 03:00 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

Fix incoming.

@nsajko nsajko added the kind:bug Indicates an unexpected problem or unintended behavior label Apr 28, 2024
nsajko added a commit to nsajko/julia that referenced this issue Apr 28, 2024
Fixes `circshift` for empty tuples.

Fixes JuliaLang#54294
@nsajko nsajko linked a pull request Apr 28, 2024 that will close this issue
@nsajko nsajko added the domain:collections Data structures holding multiple items, e.g. sets label Apr 28, 2024
@aravindh-krishnamoorthy
Copy link
Contributor

@nsajko Sorry for this bug 😥

@nsajko
Copy link
Contributor Author

nsajko commented Apr 29, 2024

@aravindh-krishnamoorthy everyone makes mistakes. Your PR had multiple reviewers, after all, and I only found the bug now.

nsajko added a commit to nsajko/julia that referenced this issue May 14, 2024
Fixes `circshift` for empty tuples.

Fixes JuliaLang#54294
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:collections Data structures holding multiple items, e.g. sets kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants