-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
strange array element assignment error #3167
Comments
I will fix this. But, that is one hell of an array type. At that point I would recommend using |
Agreed. I didn't create it manually. I had just stripped out a bunch of code from where the problem was really occurring to manually recreate the bug as concisely as possible. (The object of that type actually came from the JSON package.) Thanks. |
Ah, that makes sense! I filed a pull request with |
I can't reproduce. Was this fixed? @vtjnash @JeffBezanson |
this wasn't fixed. see comments on my patch. |
This problem no longer manifests, ergo fixed. If you have a failing case, please post it and reopen. |
Does my comment above that describes how inference is working around this (by splitting Union types) count? |
No, I'm having trouble extracting a test case from that comment. I agree the change to |
From memory (and iPhone), the failing case took the form: The type intersection says we should use abs(::Number) -- aka abs(::Union{Int64,Float64}, aka what invoke should call -- but the runtime should actually be either abs(::Int64) or abs(::Float64). |
That's not how it works; we take the intersection with all methods, not just pick one that matches the inferred type:
|
Could that be written correctly: |
Those types are equal (although the algorithm we use currently doesn't know it). One is not more correct than the other. |
OK, but would that work around this problem as well (i.e. is the problem really that the currently algorithm doesn't know that |
Thanks! 👍 |
It's possible that this is not repeatable, but on my machine with Julia Version 0.2.0-1644.rb3c30f37, Commit b3c30 f373b 2013-05-21 05:03:45, there is the following issue. I believe the function foo below should behave like "convert(Array{typeof(x[1]), 1}, x)" (for some inputs x at least). However, the code:
gives non-deterministic, incorrect results like
sometimes and also the error
corresponding to the line
The foo code seems to work fine in a global context and convert(Array{typeof(x[1]), 1}, x) seems to work fine.
The text was updated successfully, but these errors were encountered: