-
Notifications
You must be signed in to change notification settings - Fork 14
fix diff for 32bit arrays #21
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be hesitant to add in a specific hack for vectors. Effectively :(variable_name[index])
is Expr(:ref, :variable_name, index)
and so there's a potential regression point. Most importantly, we will open a can of worms as we now need to cater for vectors of different container types but same inner values...
if e.head === :ref && isa(e.args, Vector) | ||
return true | ||
end | ||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since e::Expr
, we have isa(e.args, Vector)
to always be true. So the following suffice
if e.head === :ref && isa(e.args, Vector) | |
return true | |
end | |
return false | |
return e.head === :ref |
Just a note: this fix is for arrays of any type that is not listed here—not just 32bit arrays. For example: julia> string([true, true])
"Bool[1, 1]" When julia> Meta.parse(string([true, false]))
:(Bool[1, 0])
julia> Meta.parse(string([true, false])).head
:ref
julia> Meta.parse(string([true, false])).args
3-element Vector{Any}:
:Bool
1
0 |
if e.head === :vect | ||
return true | ||
end | ||
#Float32 or Int32 arrays get here as Ref's to Vector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this is not quite true. The arrays get here with the same syntax as a Ref
, but they're not actually a ref to a vector. Just a bit of a confusing overlap in the display of vectors and the syntax for Ref
s.
Fixes #20