Skip to content

Commit 20c5d07

Browse files
authored
Merge pull request #49 from saolof/patch-2
Made Constructor work with Symbol input without explicitly specified {T}
2 parents 278e31c + 4493ac9 commit 20c5d07

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/base.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ end
113113

114114
ShortString{T}(s::ShortString{T}) where {T} = s
115115

116-
ShortString(s::Symbol) where {T} = ShortString{T}(String(s))
116+
ShortString(s::Symbol) = ShortString(String(s))
117+
ShortString{T}(s::Symbol) where {T} = ShortString{T}(String(s))
117118

118119
function ShortString{T}(s::ShortString{S}) where {T, S}
119120
sz = sizeof(s)

test/runtests.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ end
136136

137137
@test_throws ErrorException ShortString("foobar", 3)
138138
@test_throws ErrorException ss"foobar"b3
139+
140+
141+
@test ShortString(:abcde) == "abcde"
142+
@test ShortString(:abcde) isa ShortString7
143+
@test ShortString15(:abcde) == "abcde"
144+
@test ShortString15(:abcde) isa ShortString15
139145

140146

141147
@test ShortString7(Test.GenericString("abcde")) == "abcde"

0 commit comments

Comments
 (0)