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

Tighter constructor definition for Dict #12451

Closed
rened opened this issue Aug 4, 2015 · 1 comment
Closed

Tighter constructor definition for Dict #12451

rened opened this issue Aug 4, 2015 · 1 comment

Comments

@rened
Copy link
Member

rened commented Aug 4, 2015

On current master the following throws unhelpful errors:

julia> Dict(1)
ERROR: BoundsError
 in call at ./dict.jl:389
 in call at dict.jl:435

julia> Dict([1,2,3])
ERROR: BoundsError
 in call at dict.jl:389
 in call at dict.jl:435

The solution is to make the type of kv in dict.jl:435:

Dict(kv) = dict_with_eltype(kv, eltype(kv))

tighter. Don't know enough about what parameter values are acceptable for a Dict constructor to do it myself...

@simonster
Copy link
Member

I don't think the constructor can be tightened if we still want it to accept any iterator that yields pairs, but it could throw a better error message.

rened pushed a commit to rened/julia that referenced this issue Aug 4, 2015
rened pushed a commit to rened/julia that referenced this issue Aug 4, 2015
rened pushed a commit to rened/julia that referenced this issue Aug 4, 2015
rened pushed a commit to rened/julia that referenced this issue Aug 4, 2015
StefanKarpinski added a commit that referenced this issue Aug 12, 2015
fix #12451 by providing a better error message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants