Skip to content

Commit fce0a3c

Browse files
iamed2StefanKarpinski
authored andcommitted
Don't print type prefix for String array (#23644)
1 parent 96f64ce commit fce0a3c

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

base/show.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,8 @@ function array_eltype_show_how(X)
19131913
str = string(e)
19141914
end
19151915
# Types hard-coded here are those which are created by default for a given syntax
1916-
isleaftype(e), (!isempty(X) && (e===Float64 || e===Int || e===Char) ? "" : str)
1916+
(isleaftype(e),
1917+
(!isempty(X) && (e===Float64 || e===Int || e===Char || e===String) ? "" : str))
19171918
end
19181919

19191920
function show_vector(io::IO, v, opn, cls)

test/cmdlineargs.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ let exename = `$(Base.julia_cmd()) --sysimage-native-code=yes --startup-file=no`
269269
cp(testfile, joinpath(dir, ".juliarc.jl"))
270270

271271
withenv((Sys.iswindows() ? "USERPROFILE" : "HOME") => dir) do
272-
output = "String[\"foo\", \"-bar\", \"--baz\"]"
272+
output = "[\"foo\", \"-bar\", \"--baz\"]"
273273
@test readchomp(`$exename $testfile foo -bar --baz`) == output
274274
@test readchomp(`$exename $testfile -- foo -bar --baz`) == output
275275
@test readchomp(`$exename -L $testfile -e 'exit(0)' -- foo -bar --baz`) ==
@@ -283,7 +283,7 @@ let exename = `$(Base.julia_cmd()) --sysimage-native-code=yes --startup-file=no`
283283

284284
@test !success(`$exename --foo $testfile`)
285285
@test readchomp(`$exename -L $testfile -e 'exit(0)' -- foo -bar -- baz`) ==
286-
"String[\"foo\", \"-bar\", \"--\", \"baz\"]"
286+
"[\"foo\", \"-bar\", \"--\", \"baz\"]"
287287
end
288288
end
289289

@@ -330,7 +330,7 @@ let exename = `$(Base.julia_cmd()) --sysimage-native-code=yes --startup-file=no`
330330
end
331331

332332
# issue #10562
333-
@test readchomp(`$exename -e 'println(ARGS);' ''`) == "String[\"\"]"
333+
@test readchomp(`$exename -e 'println(ARGS);' ''`) == "[\"\"]"
334334

335335
# issue #12679
336336
@test readchomp(pipeline(ignorestatus(`$exename --startup-file=no --compile=yes -ioo`),

test/show.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ replstr(x) = sprint((io,x) -> show(IOContext(io, :limit => true, :displaysize =>
1313
struct T5589
1414
names::Vector{String}
1515
end
16-
@test replstr(T5589(Array{String,1}(100))) == "$(curmod_prefix)T5589(String[#undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef … #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef])"
16+
@test replstr(T5589(Array{String,1}(100))) == "$(curmod_prefix)T5589([#undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef … #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef, #undef])"
1717

1818
@test replstr(parse("mutable struct X end")) == ":(mutable struct X\n #= none:1 =#\n end)"
1919
@test replstr(parse("struct X end")) == ":(struct X\n #= none:1 =#\n end)"

0 commit comments

Comments
 (0)