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

Vector convenience functions cause errors on nightly Julia builds #28

Open
dingraha opened this issue Jan 3, 2024 · 0 comments
Open

Comments

@dingraha
Copy link
Collaborator

dingraha commented Jan 3, 2024

When I try to create eg a vector of Section structs with nightly builds of Julia, like this:

(jl_DjwQyJ) pkg> using CCBlade
ERROR: `using` is not a recognized command. Type ? for help with available commands

julia> using CCBlade

julia> radii = range(0.1, 1.0; length=10)
0.1:0.1:1.0

julia> chord = similar(radii)
10-element Vector{Float64}:
 6.9368548214818e-310
 6.9369127073666e-310
 6.93690470785607e-310
 6.93685482148497e-310
 6.9369056525649e-310
 6.93685482148813e-310
 6.9368548214913e-310
 6.93691005160844e-310
 6.9369127073666e-310
 6.9369057171642e-310

julia> theta = similar(radii)
10-element Vector{Float64}:
 5.4e-323
 5.0e-324
 5.0e-323
 4.4e-323
 4.0e-323
 3.5e-323
 2.5e-323
 3.0e-323
 2.0e-323
 1.5e-323

julia> sections = Section.(radii, chord, theta, alpha->(1.0, 1.0))
ERROR: type Section has no field ref
Stacktrace:
  [1] _broadcast_getindex_evalf
    @ ./broadcast.jl:677 [inlined]
  [2] _broadcast_getindex
    @ ./broadcast.jl:650 [inlined]
  [3] getindex
    @ ./broadcast.jl:604 [inlined]
  [4] copy
    @ ./broadcast.jl:910 [inlined]
  [5] materialize
    @ ./broadcast.jl:871 [inlined]
  [6] getproperty(obj::Vector{Section{Float64, var"#7#8"}}, sym::Symbol)
    @ CCBlade ~/.julia/packages/CCBlade/5jTbo/src/CCBlade.jl:91
  [7] dataids(A::Vector{Section{Float64, var"#7#8"}})
    @ Base ./abstractarray.jl:1555
  [8] mightalias
    @ Base ./abstractarray.jl:1530 [inlined]
  [9] unalias
    @ Base ./abstractarray.jl:1495 [inlined]
 [10] broadcast_unalias
    @ Base.Broadcast ./broadcast.jl:945 [inlined]
 [11] preprocess
    @ Base.Broadcast ./broadcast.jl:952 [inlined]
 [12] preprocess_args (repeats 2 times)
    @ Base.Broadcast ./broadcast.jl:954 [inlined]
 [13] preprocess
    @ Base.Broadcast ./broadcast.jl:951 [inlined]
 [14] copyto!
    @ Base.Broadcast ./broadcast.jl:968 [inlined]
 [15] copyto!
    @ Base.Broadcast ./broadcast.jl:924 [inlined]
 [16] copy
    @ Base.Broadcast ./broadcast.jl:896 [inlined]
 [17] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, Type{Section}, Tuple{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Vector{Float64}, Vector{Float64}, Base.RefValue{var"#7#8"}}})
    @ Base.Broadcast ./broadcast.jl:871
 [18] top-level scope
    @ REPL[8]:1

julia> versioninfo()
Julia Version 1.11.0-DEV.1187
Commit ca0a266e4f6 (2024-01-03 13:34 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
  WORD_SIZE: 64
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)
Environment:
  JULIA_PKG_SERVER = us-east.pkg.julialang.org

(jl_DjwQyJ) pkg> st
Status `/tmp/jl_DjwQyJ/Project.toml`
  [e1828068] CCBlade v0.2.5

(jl_DjwQyJ) pkg> 

I get an error that appears to be related to the convenience functions used to access individual fields of a Vector{<:Section}:

function Base.getproperty(obj::AbstractVector{<:Section}, sym::Symbol)

If I remove that function, then the error goes away:

shell> nvr ./dev/CCBlade/src/CCBlade.jl # Remove Base.getproperty(obj::AbstractVector{<:Section}, sym::Symbol)

julia> using CCBlade
Precompiling CCBlade
  1 dependency successfully precompiled in 3 seconds. 59 already precompiled.

julia> radii = range(0.1, 1.0; length=10)
0.1:0.1:1.0

julia> chord = similar(radii)
10-element Vector{Float64}:
 6.9321471006254e-310
 6.9321549093946e-310
 6.93215490939933e-310
 6.93215490940407e-310
 6.9321471855873e-310
 6.93214830413057e-310
 6.93215490940723e-310
 6.9321549094104e-310
 6.93215490941356e-310
 6.9321549094167e-310

julia> theta = similar(radii)
10-element Vector{Float64}:
 0.0
 1.390671161567e-309
 0.0
 0.0
 1.390671161567e-309
 0.0
 0.0
 1.265e-321
 0.0
 0.0

julia> sections = Section.(radii, chord, theta, alpha->(1.0, 1.0))
10-element Vector{Section{Float64, var"#7#8"}}:
 Section{Float64, var"#7#8"}(0.1, 6.9321471006254e-310, 0.0, var"#7#8"())
 Section{Float64, var"#7#8"}(0.2, 6.9321549093946e-310, 1.390671161567e-309, var"#7#8"())
 Section{Float64, var"#7#8"}(0.3, 6.93215490939933e-310, 0.0, var"#7#8"())
 Section{Float64, var"#7#8"}(0.4, 6.93215490940407e-310, 0.0, var"#7#8"())
 Section{Float64, var"#7#8"}(0.5, 6.9321471855873e-310, 1.390671161567e-309, var"#7#8"())
 Section{Float64, var"#7#8"}(0.6, 6.93214830413057e-310, 0.0, var"#7#8"())
 Section{Float64, var"#7#8"}(0.7, 6.93215490940723e-310, 0.0, var"#7#8"())
 Section{Float64, var"#7#8"}(0.8, 6.9321549094104e-310, 1.265e-321, var"#7#8"())
 Section{Float64, var"#7#8"}(0.9, 6.93215490941356e-310, 0.0, var"#7#8"())
 Section{Float64, var"#7#8"}(1.0, 6.9321549094167e-310, 0.0, var"#7#8"())

julia> versioninfo()
Julia Version 1.11.0-DEV.1187
Commit ca0a266e4f6 (2024-01-03 13:34 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
  WORD_SIZE: 64
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)
Environment:
  JULIA_PKG_SERVER = us-east.pkg.julialang.org

julia> 

I know CCBlade doesn't use Julia nightly builds for testing, but I recently ran into this and thought I'd bring it up. The error doesn't occur with any of the stable Julia builds—I checked 1.9.4 and 1.10.0 today.

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

No branches or pull requests

1 participant