Skip to content

Commit 6487522

Browse files
committed
Make dump print const before const fields
This provides more information to the user when dumping types, and also makes the output of dump slightly more similar to the type definition syntax. Before: ``` julia> dump(BitSet) BitSet <: AbstractSet{Int64} bits::Vector{UInt64} offset::Int64 ``` After: ``` julia> dump(BitSet) BitSet <: AbstractSet{Int64} const bits::Vector{UInt64} offset::Int64 ```
1 parent 35cb8a5 commit 6487522

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

base/show.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3007,7 +3007,9 @@ function dump(io::IOContext, x::DataType, n::Int, indent)
30073007
fieldtypes = datatype_fieldtypes(x)
30083008
for idx in 1:length(fields)
30093009
println(io)
3010-
print(io, indent, " ", fields[idx])
3010+
print(io, indent, " ")
3011+
isconst(x, idx) && print(io, "const ")
3012+
print(io, fields[idx])
30113013
if isassigned(fieldtypes, idx)
30123014
print(io, "::")
30133015
print(tvar_io, fieldtypes[idx])

0 commit comments

Comments
 (0)