Skip to content

Commit b4af81d

Browse files
authored
remove promote_rule for strings. fixes #26200. (#26495)
1 parent bd0123d commit b4af81d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

base/strings/basic.jl

-2
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ Symbol(s::AbstractString) = Symbol(String(s))
194194
convert(::Type{T}, s::T) where {T<:AbstractString} = s
195195
convert(::Type{T}, s::AbstractString) where {T<:AbstractString} = T(s)
196196

197-
promote_rule(::Type{<:AbstractString}, ::Type{<:AbstractString}) = String
198-
199197
## string & character concatenation ##
200198

201199
"""

test/strings/basic.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,10 @@ end
271271

272272
@test length(gstr, 1, 2) == 2
273273

274-
# tests promote_rule
274+
# no string promotion
275275
let svec = [s"12", GenericString("12"), SubString("123", 1, 2)]
276-
@test all(x -> x === "12", svec)
276+
@test all(x -> x == "12", svec)
277+
@test svec isa Vector{AbstractString}
277278
end
278279
end
279280

0 commit comments

Comments
 (0)