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

these signatures are not matched correctly #344

Closed
JeffBezanson opened this issue Jan 17, 2012 · 1 comment
Closed

these signatures are not matched correctly #344

JeffBezanson opened this issue Jan 17, 2012 · 1 comment
Assignees
Labels
kind:bug Indicates an unexpected problem or unintended behavior

Comments

@JeffBezanson
Copy link
Sponsor Member

Stefan found this a while ago. These two signatures:

assign{K,V}(h::HashTable{K,V}, v::V, key::K)
assign{K,V}(h::HashTable{K,V}, v, k) = assign(h, convert(V,v), convert(K,k))

are not dispatched correctly. I believe the second one called itself.

The root of the problem is that jl_type_match doesn't handle invariant vs. covariant contexts correctly, unlike type intersection.

@ghost ghost assigned JeffBezanson Jan 17, 2012
@JeffBezanson
Copy link
Sponsor Member Author

As part of commit 7d0c9e1 I made these sort correctly, so I consider this fixed to the extent possible.
The remaining issue is that HashTable{Any,Any} will not match the first signature since the container's element type is never the same as the argument's type. But for the time being this is the intended behavior.

StefanKarpinski pushed a commit that referenced this issue Feb 8, 2018
Support unsafe_trunc(::Type{<:Integer}, ::Integer)
cmcaine added a commit to cmcaine/julia that referenced this issue Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant