diff --git a/stdlib/LinearAlgebra/src/svd.jl b/stdlib/LinearAlgebra/src/svd.jl index 7a88c4a6e14c4..a3017f336992a 100644 --- a/stdlib/LinearAlgebra/src/svd.jl +++ b/stdlib/LinearAlgebra/src/svd.jl @@ -206,8 +206,10 @@ function getproperty(F::SVD, d::Symbol) end end -Base.propertynames(F::SVD, private::Bool=false) = - private ? (:V, fieldnames(typeof(F))...) : (:U, :S, :V, :Vt) +Base.propertynames(F::SVD, private::Bool=false) = begin + fldnames = fieldnames(typeof(F)) + private ? (:V, fldnames...) : fldnames +end """ svdvals!(A) diff --git a/stdlib/LinearAlgebra/test/svd.jl b/stdlib/LinearAlgebra/test/svd.jl index 9e8b5d5cda7d2..7f942d6269414 100644 --- a/stdlib/LinearAlgebra/test/svd.jl +++ b/stdlib/LinearAlgebra/test/svd.jl @@ -78,7 +78,8 @@ aimg = randn(n,n)/2 @test_throws FieldError usv.Z b = rand(eltya,n) @test usv\b ≈ a\b - @test Base.propertynames(usv) == (:U, :S, :V, :Vt) + @test Base.propertynames(usv) == (:U, :S, :Vt) + @test Base.propertynames(usv, true) == (:V, :U, :S, :Vt) @test size(usv) == size(a) if eltya <: BlasFloat svdz = svd!(Matrix{eltya}(undef,0,0))