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

NTuple{N}(v) silently truncates when length(v) > N #52963

Closed
tpapp opened this issue Jan 18, 2024 · 1 comment
Closed

NTuple{N}(v) silently truncates when length(v) > N #52963

tpapp opened this issue Jan 18, 2024 · 1 comment
Labels
collections Data structures holding multiple items, e.g. sets duplicate Indicates similar issues or pull requests

Comments

@tpapp
Copy link
Contributor

tpapp commented Jan 18, 2024

julia> NTuple{3}(zeros(4))
(0.0, 0.0, 0.0)

Is this intentional? I expected an error message. Cf eg

julia> NTuple{3}((1,2,3,4))
ERROR: MethodError: Cannot `convert` an object of type 
  NTuple{4, Int64} to an object of type 
  Tuple{T, T, T} where T

(tested on 1.10 and master, but this is not a regression, also the same in previous versions I checked)

@nsajko
Copy link
Contributor

nsajko commented Jan 18, 2024

Dup of #52657

@nsajko nsajko closed this as completed Jan 18, 2024
@nsajko nsajko added the duplicate Indicates similar issues or pull requests label Jan 18, 2024
@nsajko nsajko closed this as completed Jan 23, 2025
@nsajko nsajko added the collections Data structures holding multiple items, e.g. sets label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collections Data structures holding multiple items, e.g. sets duplicate Indicates similar issues or pull requests
Projects
None yet
Development

No branches or pull requests

2 participants