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

Add type assertion to Symbol method. Fix #242 #243

Merged
merged 2 commits into from Jul 11, 2016

Conversation

cstjean
Copy link
Contributor

@cstjean cstjean commented Jun 30, 2016

@yuyichao @nalimilan Tested DataFrames, PyCall and SciktiLearn on Julia 0.4.5, all tests passed.

@@ -1160,6 +1160,8 @@ if VERSION ≥ v"0.4.0-dev+3732"
@test Symbol("a_", 2) === :a_2
@test Symbol('c') === :c
@test Symbol(1) === Symbol("1")
# Behaviour on 0.5 might change JuliaLang/julia#7258
@test keytype([Symbol(k) => v for (k,v) in Dict{Any, Any}(:x=>3)]) == Symbol
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should have this test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing things without any way of checking they don't break again doesn't sound like a good idea. We could limit it to 0.4 if you're afraid of it breaking because of changes in Julia.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically checking undefined behavior that happens to work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it's not going to change on 0.4 at this point, as it would be a breaking change.

Copy link
Contributor

@yuyichao yuyichao Jun 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, it is actually perfectly fine to add the test on 0.5 after JuliaLang/julia#16622. Before that, we really can't have any guarantee what the type is. To see how sensitive it is,

julia> Base.Symbol(a::Float64) = symbol(a)
Symbol

julia> Base.Symbol(a::Int) = symbol(a)
Symbol

julia> Base.Symbol(a::AbstractString) = symbol(a)
Symbol

julia> Base.Symbol(s::Symbol) = s
Symbol

julia> [Symbol(k) => v for (k,v) in Dict{Any, Any}(:x=>3)]
Dict{Any,Any} with 1 entry:
  :x => 3

And this is totally sensible thing to do if we need to slightly tweak how Symbol behaves (such that they don't exactly match symbol on 0.4).

I'm OK with leaving the test in given that we'll delete it if it breaks. I don't see the point of the test in that case though.

@tkelman
Copy link
Contributor

tkelman commented Jul 11, 2016

Bump. This doesn't hurt anything, does it?

@yuyichao
Copy link
Contributor

This lgtm, was mainly hoping to get a passing ci (which should be ok now?)

@tkelman tkelman merged commit 679b0ec into JuliaLang:master Jul 11, 2016
@tkelman
Copy link
Contributor

tkelman commented Jul 11, 2016

I think there are other issues but they're being worked on in different PR's.

@tkelman
Copy link
Contributor

tkelman commented Jul 11, 2016

We can maybe add the test back once the comprehensions thing merges to 0.5.

@cstjean cstjean deleted the pull-request/a7585509 branch July 11, 2016 18:53
dpsanders pushed a commit to dpsanders/Compat.jl that referenced this pull request Feb 1, 2017
* Add type assertion to `Symbol` method. Fix JuliaLang#242

* Remove comprehension type inference test
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

Successfully merging this pull request may close these issues.

None yet

4 participants