Skip to content

Commit

Permalink
Don't print type prefix for String array (#23644)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamed2 authored and StefanKarpinski committed Sep 10, 2017
1 parent 96f64ce commit fce0a3c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,8 @@ function array_eltype_show_how(X)
str = string(e)
end
# Types hard-coded here are those which are created by default for a given syntax
isleaftype(e), (!isempty(X) && (e===Float64 || e===Int || e===Char) ? "" : str)
(isleaftype(e),
(!isempty(X) && (e===Float64 || e===Int || e===Char || e===String) ? "" : str))
end

function show_vector(io::IO, v, opn, cls)
Expand Down
6 changes: 3 additions & 3 deletions test/cmdlineargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ let exename = `$(Base.julia_cmd()) --sysimage-native-code=yes --startup-file=no`
cp(testfile, joinpath(dir, ".juliarc.jl"))

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

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

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

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

# issue #12679
@test readchomp(pipeline(ignorestatus(`$exename --startup-file=no --compile=yes -ioo`),
Expand Down
2 changes: 1 addition & 1 deletion test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ replstr(x) = sprint((io,x) -> show(IOContext(io, :limit => true, :displaysize =>
struct T5589
names::Vector{String}
end
@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])"
@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])"

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

3 comments on commit fce0a3c

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

@KristofferC
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not sure about these results.

Please sign in to comment.