Open
Description
Describe the bug 🐞
The example for @static_unpack
in v0.15
release notes (see NEWS.md) fails.
Expected behavior
Straight from the NEWS.md:
julia> x = ComponentArray(a=5, b=[4, 1], c = [1 2; 3 4], d=(e=2, f=[6, 30.0]));
julia> @static_unpack a, b, c, d = x;
julia> a
5.0
julia> b
2-element SVector{2, Float64} with indices SOneTo(2):
4.0
1.0
julia> c
2×2 SMatrix{2, 2, Float64, 4} with indices SOneTo(2)×SOneTo(2):
1.0 2.0
3.0 4.0
julia> d
ComponentVector{Float64,SubArray...}(e = 2.0, f = [6.0, 30.0])
Minimal Reproducible Example 👇
This is what I get:
julia> x = ComponentArray(a=5, b=[4, 1], c = [1 2; 3 4], d=(e=2, f=[6, 30.0]));
julia> @static_unpack a, b, c, d = x;
ERROR: MethodError: no method matching (StaticArraysCore.SVector{2})(::SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true})
The type `StaticArraysCore.SVector{2}` exists, but no method is defined for this combination of argument types when trying to construct it.
Stacktrace:
[1] _maybe_SArray(x::SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, ::Val{2}, ::FlatAxis)
@ ComponentArrays ~/.julia/packages/ComponentArrays/7tm5j/src/compat/static_arrays.jl:5
[2] macro expansion
@ ./abstractarray.jl:0 [inlined]
[3] static_getproperty(ca::ComponentVector{Float64, Vector{Float64}, Tuple{Axis{…}}}, ::Val{:b})
@ ComponentArrays ~/.julia/packages/ComponentArrays/7tm5j/src/compat/static_arrays.jl:9
[4] top-level scope
@ REPL[50]:1
Some type information was truncated. Use `show(err)` to see complete types.
Environment (please complete the following information):
- Output of
using Pkg; Pkg.status()
Status `/private/var/folders/hx/kbmkkbqd0rxbwlgymb6hfkmh0000gn/T/jl_4YHy5n/Project.toml`
[b0b7db55] ComponentArrays v0.15.19
[a0c0ee7d] DifferentiationInterface v0.6.27
[f6369f11] ForwardDiff v0.10.38
- Output of
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
Status `/private/var/folders/hx/kbmkkbqd0rxbwlgymb6hfkmh0000gn/T/jl_4YHy5n/Manifest.toml`
[47edcb42] ADTypes v1.11.0
[79e6a3ab] Adapt v4.1.1
[4fba245c] ArrayInterface v7.17.1
[d360d2e6] ChainRulesCore v1.25.0
[bbf7d656] CommonSubexpressions v0.3.1
[f70d9fcc] CommonWorldInvalidations v1.0.0
[34da2185] Compat v4.16.0
[b0b7db55] ComponentArrays v0.15.19
[187b0558] ConstructionBase v1.5.8
[163ba53b] DiffResults v1.1.0
[b552c78f] DiffRules v1.15.1
[a0c0ee7d] DifferentiationInterface v0.6.27
[ffbed154] DocStringExtensions v0.9.3
[f6369f11] ForwardDiff v0.10.38
[d9f16b24] Functors v0.5.2
[615f187c] IfElse v0.1.1
[92d709cd] IrrationalConstants v0.2.2
[692b3bcd] JLLWrappers v1.6.1
[2ab3a3ac] LogExpFunctions v0.3.28
[1914dd2f] MacroTools v0.5.13
[77ba4419] NaNMath v1.0.2
[aea7be01] PrecompileTools v1.2.1
[21216c6a] Preferences v1.4.3
[ae029012] Requires v1.3.0
[276daf66] SpecialFunctions v2.4.0
[aedffcd0] Static v1.1.1
[0d7ed370] StaticArrayInterface v1.8.0
[1e83bf80] StaticArraysCore v1.4.3
[efe28fd5] OpenSpecFun_jll v0.5.5+0
[0dad84c5] ArgTools v1.1.2
[56f22d72] Artifacts v1.11.0
[2a0f44e3] Base64 v1.11.0
[ade2ca70] Dates v1.11.0
[f43a241f] Downloads v1.6.0
[7b1f6079] FileWatching v1.11.0
[b27032c2] LibCURL v0.6.4
[76f85450] LibGit2 v1.11.0
[8f399da3] Libdl v1.11.0
[37e2e46d] LinearAlgebra v1.11.0
[56ddb016] Logging v1.11.0
[d6f4376e] Markdown v1.11.0
[ca575930] NetworkOptions v1.2.0
[44cfe95a] Pkg v1.11.0
[de0858da] Printf v1.11.0
[9a3f8284] Random v1.11.0
[ea8e919c] SHA v0.7.0
[fa267f1f] TOML v1.0.3
[a4e569a6] Tar v1.10.0
[cf7118a7] UUIDs v1.11.0
[4ec0a83e] Unicode v1.11.0
[e66e0078] CompilerSupportLibraries_jll v1.1.1+0
[deac9b47] LibCURL_jll v8.6.0+0
[e37daf67] LibGit2_jll v1.7.2+0
[29816b5a] LibSSH2_jll v1.11.0+1
[c8ffd9c3] MbedTLS_jll v2.28.6+0
[14a3606d] MozillaCACerts_jll v2023.12.12
[4536629a] OpenBLAS_jll v0.3.27+1
[05823500] OpenLibm_jll v0.8.1+2
[83775a58] Zlib_jll v1.2.13+1
[8e850b90] libblastrampoline_jll v5.11.0+0
[8e850ede] nghttp2_jll v1.59.0+0
[3f19e933] p7zip_jll v17.4.0+2
- Output of
versioninfo()
Julia Version 1.11.2
Commit 5e9a32e7af2 (2024-12-01 20:02 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin24.0.0)
CPU: 10 × Apple M1 Pro
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Activity