Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ ChainRulesCore = "1.26"
ChainRulesTestUtils = "1"
ForwardDiff = "1.1"
InteractiveUtils = "1"
LinearAlgebra = "1"
MacroTools = "0.5.16"
OrdinaryDiffEq = "6, 7"
PreallocationTools = "1.2"
PrecompileTools = "1.2.1"
RecursiveArrayTools = "3.54, 4"
SafeTestsets = "0.1, 1"
SciMLBase = "2, 3"
SciMLTesting = "1"
SciMLTesting = "1.5"
StaticArrays = "1.9.18"
Test = "1"
julia = "1.10"
Expand Down
8 changes: 5 additions & 3 deletions src/LabelledArrays.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module LabelledArrays

using LinearAlgebra, StaticArrays, ArrayInterface
using LinearAlgebra: LinearAlgebra
using StaticArrays: StaticArrays, MArray, SArray, Size, SOneTo, StaticArray, StaticVector
using ArrayInterface: ArrayInterface
import RecursiveArrayTools, PreallocationTools, ForwardDiff

include("slarray.jl")
Expand All @@ -21,7 +23,7 @@ include("diffeqarray.jl")
end
end

using MacroTools
using MacroTools: MacroTools

struct PrintWrapper{T, N, F, X <: AbstractArray{T, N}} <: AbstractArray{T, N}
f::F
Expand Down Expand Up @@ -84,7 +86,7 @@ function PreallocationTools.get_tmp(
PreallocationTools.enlargediffcache!(dc, nelem)
end
_x = ArrayInterface.restructure(dc.du, reinterpret(T, view(dc.dual_du, 1:nelem)))
return LabelledArrays.LArray{T, N, D, Syms}(_x)
return LArray{T, N, D, Syms}(_x)
end

export SLArray, LArray, SLVector, LVector, @SLVector, @LArray, @LVector, @SLArray
Expand Down
6 changes: 3 additions & 3 deletions src/larray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ struct LAStyle{T, N, L} <: Broadcast.AbstractArrayStyle{N} end
LAStyle{T, N, L}(x::Val{i}) where {T, N, L, i} = LAStyle{T, N, L}()
Base.BroadcastStyle(::Type{LArray{T, N, D, L}}) where {T, N, D, L} = LAStyle{T, N, L}()
function Base.BroadcastStyle(
::LabelledArrays.LAStyle{T, N, L},
::LabelledArrays.LAStyle{E, N, L}
::LAStyle{T, N, L},
::LAStyle{E, N, L}
) where {T, E, N, L}
return LAStyle{promote_type(T, E), N, L}()
end
Expand Down Expand Up @@ -388,7 +388,7 @@ function SLArray(
end

function Base.vcat(x::LArray, y::LArray)
return LArray{(LabelledArrays.symnames(typeof(x))..., LabelledArrays.symnames(typeof(y))...)}(
return LArray{(symnames(typeof(x))..., symnames(typeof(y))...)}(
vcat(
x.__x,
y.__x
Expand Down
2 changes: 1 addition & 1 deletion src/precompilation.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PrecompileTools
using PrecompileTools: @setup_workload, @compile_workload

@setup_workload begin
@compile_workload begin
Expand Down
5 changes: 1 addition & 4 deletions src/slarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,6 @@ end
function Base.reshape(
x::SLArray{S, T, N, L, Syms},
ax::Tuple{SOneTo, Vararg{SOneTo}}
) where {
S <: Tuple, T, N, L, Syms,
SOneTo <: SOneTo,
}
) where {S <: Tuple, T, N, L, Syms}
return SLArray{S, T, N, L, Syms}(reshape(x.__x, ax))
end
9 changes: 4 additions & 5 deletions test/qa/Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
LabelledArrays = {path = "../.."}

[compat]
Aqua = "0.8"
JET = "0.9,0.10,0.11"
SafeTestsets = "0.1, 1"
SciMLTesting = "1.5"
Test = "1"
julia = "1.10"
64 changes: 42 additions & 22 deletions test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
using LabelledArrays
using Aqua
using JET
using Test
using SciMLTesting, LabelledArrays, Test

@testset "Aqua" begin
# ambiguities / unbound_args / undefined_exports / deps_compat disabled:
# genuine Aqua findings tracked in https://github.com/SciML/LabelledArrays.jl/issues/205
Aqua.test_all(
LabelledArrays;
# Aqua: ambiguities / unbound_args / undefined_exports are genuine pre-existing
# findings (method ambiguities, unbound type parameters, and the dead exports
# `@SLSliced`/`@LSliced`/`dimSymbols`/`rowSymbols`/`colSymbols`) tracked in
# https://github.com/SciML/LabelledArrays.jl/issues/205. JET likewise finds the
# `setfield!`-on-immutable-`LArray` dead branch in `setproperty!` (src/larray.jl)
# tracked in the same issue, so JET stays opt-out here (JET is not loaded). The
# remaining Aqua checks (incl. deps_compat) run and pass.
#
# ExplicitImports ignore-list (all_qualified_accesses_are_public): every entry is a
# non-public name from a dependency (or Base) that LabelledArrays must access by
# qualification because there is no public alternative — either a method-extension
# definition of a non-public function, or a non-public type/function used directly:
# @_propagate_inbounds_meta, print_array, dataids, BroadcastStyle, AbstractArrayStyle,
# Broadcasted -> Base / Base.Broadcast internals (broadcast + indexing machinery)
# @forward -> MacroTools (method forwarding)
# Dual -> ForwardDiff (DiffCache eltype)
# LU, size_tuple -> StaticArrays internals
# can_setindex, ismutable, restructure, undefmatrix -> ArrayInterface trait methods
# enlargediffcache! -> PreallocationTools internal
# The trailing four (@propagate_inbounds, OneTo, elsize, unsafe_convert) are Base names
# that are `public` on Julia 1.11+ but, because the `public` keyword predates the LTS,
# read as non-public to ExplicitImports on the 1.10 LTS — they are ignored only to keep
# the LTS QA lane green; on 1.11+ they are genuinely public.
run_qa(
LabelledArrays;
aqua_kwargs = (;
ambiguities = false,
unbound_args = false,
undefined_exports = false,
deps_compat = false,
)
@test_broken false # Aqua ambiguities: method ambiguities found — tracked in https://github.com/SciML/LabelledArrays.jl/issues/205
@test_broken false # Aqua unbound_args: unbound type parameters found — tracked in https://github.com/SciML/LabelledArrays.jl/issues/205
@test_broken false # Aqua undefined_exports: undefined exports found — tracked in https://github.com/SciML/LabelledArrays.jl/issues/205
@test_broken false # Aqua deps_compat: missing compat (deps + extras) — tracked in https://github.com/SciML/LabelledArrays.jl/issues/205
end

@testset "JET" begin
# JET finds setfield! on immutable LArray in setproperty!(::LArray, ::Symbol, ::Any).
# Tracked in https://github.com/SciML/LabelledArrays.jl/issues/205
@test_broken false # JET: setfield! immutable LArray in setproperty! (src/larray.jl:96) — tracked in https://github.com/SciML/LabelledArrays.jl/issues/205
end
),
explicit_imports = true,
ei_kwargs = (;
all_qualified_accesses_are_public = (;
ignore = (
Symbol("@_propagate_inbounds_meta"), Symbol("@forward"),
:AbstractArrayStyle, :BroadcastStyle, :Broadcasted, :Dual, :LU,
:can_setindex, :dataids, :enlargediffcache!, :ismutable, :print_array,
:restructure, :size_tuple, :undefmatrix,
# public on 1.11+, read as non-public on the 1.10 LTS only:
Symbol("@propagate_inbounds"), :OneTo, :elsize, :unsafe_convert,
),
),
),
)
Loading