-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
strings"Strings!""Strings!"
Description
AnnotatedString is the only AbstractString subtype provided with an installation of Julia for which nextind, prevind have suboptimal inference. Script:
infer_return_type(f, S::Type) = Base.infer_return_type(f, Tuple{S, Vararg})
for S ∈ (Base.AnnotatedString, LazyString, String, SubString, SubstitutionString)
@show S
for f ∈ (nextind, prevind)
print(' '^4)
@show f
print(' '^8)
print("* ")
@show infer_return_type(f, S)
end
endOutput:
S = Base.AnnotatedString
f = nextind
* infer_return_type(f, S) = Any
f = prevind
* infer_return_type(f, S) = Any
S = LazyString
f = nextind
* infer_return_type(f, S) = Int64
f = prevind
* infer_return_type(f, S) = Int64
S = String
f = nextind
* infer_return_type(f, S) = Int64
f = prevind
* infer_return_type(f, S) = Int64
S = SubString
f = nextind
* infer_return_type(f, S) = Int64
f = prevind
* infer_return_type(f, S) = Int64
S = SubstitutionString
f = nextind
* infer_return_type(f, S) = Int64
f = prevind
* infer_return_type(f, S) = Int64
NB: the specific example shown above will be fixed when #57605 is fixed, however someone (maybe me, not sure) should probably look into the root cause in the AnnotatedString implementation.
Metadata
Metadata
Assignees
Labels
strings"Strings!""Strings!"