Avoid `expected Int32, got Int64 value` error on CI

I have an odd error on github actions where my tests fail on x86 machines but pass on x64. Basically this:

Single Baseline Region: Error During Test at /home/runner/work/LandUse.jl/LandUse.jl/test/model_test.jl:1
385
  Got exception outside of a @test
386
  TypeError: in setfield!, expected Int32, got a value of type Int64

In the definition of the concerned data type, I changed all things like

x :: Int64

to

x :: Int

but to no avail. what am I missing?

Any chance you can link to the code?

unfortunately no. but you just got me onto the right lead I think. I use JSON.parse to read default param values into the data type. look what I found:

help?> JSON.parse
  parse{T<:Associative}(str::AbstractString;
                        dicttype::Type{T}=Dict,
                        inttype::Type{<:Real}=Int64,
                        allownan::Bool=true,
                        null=nothing)

that’s it right? How can I know the machine type , so that I can set inttype correctly?

You can just use Int I suppose.

good point. let me try that. for future reference, I thought also that this could work

JSON.parse(f,inttype = Sys.ARCH == :x86_64 ? Int64 : Int32)

but your idea is better I think.

Unless you want to ignore all non-Intel 64-bit platforms, I believe you wanted to check Sys.WORD_SIZE == 64, but Int is just much better. Sys.WORD_SIZE is defined depending on the size of Int:

I see! Thanks !