Skip to content

fix diff for 32bit arrays - #21

Open
dpinol wants to merge 1 commit into
ssfrr:masterfrom
dpinol:fix/diff32bits
Open

fix diff for 32bit arrays#21
dpinol wants to merge 1 commit into
ssfrr:masterfrom
dpinol:fix/diff32bits

Conversation

@dpinol

@dpinol dpinol commented Jul 22, 2021

Copy link
Copy Markdown

Fixes #20

@Teo-ShaoWei Teo-ShaoWei left a comment

Copy link
Copy Markdown

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...

Comment thread src/TestSetExtensions.jl
Comment on lines +65 to +68
if e.head === :ref && isa(e.args, Vector)
return true
end
return false

Copy link
Copy Markdown

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

Suggested change
if e.head === :ref && isa(e.args, Vector)
return true
end
return false
return e.head === :ref

@ReubenJ

ReubenJ commented May 8, 2025

Copy link
Copy Markdown

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 Meta.parseing that string, the result is an expression of type :ref, too:

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

Comment thread src/TestSetExtensions.jl
if e.head === :vect
return true
end
#Float32 or Int32 arrays get here as Ref's to Vector

Copy link
Copy Markdown

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 Refs.

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.

diff between arrays of Int32 or Float32 shows "nothing"

3 participants