-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Compat interfers with dictionary type inference #242
Comments
Dup of JuliaLang/julia#7258 Not really fixable. |
@yuyichao But why would |
Any method definition can change this. Type inference was just being nice about guessing |
The problem comes from this line. On Julia 0.4.5, |
No. The whole point of that line is to add method to |
Maybe we could add methods with more specific signatures? On 0.4, only the default |
More specifically, of the defined methods on 0.5, 0.4 already has the first. We only need to add the others: Symbol(s::String) at coreimg.jl:52
Symbol(a::Array{UInt8,1}) at coreimg.jl:53
Symbol(s::AbstractString) at strings/basic.jl:77
Symbol(x...) at sysimg.jl:74 |
No. As I said, the whole point is to add methods to Symbol (so that it matches the signature of Symbol on 0.5). For this particular one, you can add a type assertion but the issue of adding method inferring with type inf is not fixable in Compat. |
And therefore we added |
Replacing the compat definition with
fixes the inference bug. It's ugly and might have other consequences, so I don't know if it's appropriate... |
It's not a bug.
It does
We shouldn't do that. And as I said,
|
Alright, alright. Thank you for the explanation. |
It's clearly a bug, as in "not intended, nor documented, and annoying". It may or may not be fixable/workaround-able, but that's a separate question. Why do you think we shouldn't do that? |
The bug is JuliaLang/julia#7258 and yes we should fix it. |
We won't fix it in 0.4 though, so the bug is in Compat. |
As a fact, adding any method makes type inference worse when the input is not inferenced as leaf type. If this counts as a bug in |
What's the problem with the workaround suggested by @cstjean? |
It's the wrong workaround (try
|
Let's add a type assertion then? |
That's what I'm saying. Note that you might get complaint if someone extends |
Extending |
* Add type assertion to `Symbol` method. Fix JuliaLang#242 * Remove comprehension type inference test
On 0.4, the Dict key-type is wrong after using Compat
The text was updated successfully, but these errors were encountered: