Skip to content

AnnotatedString constructor too restrictive #55245

@aplavin

Description

@aplavin
julia> anns = [:x => "a", :y => 1]

# this works:
julia> Base.AnnotatedString("abc def", [(i:i, anns[i]) for i in 1:2])
"abc def"

# but after replacing 2 with 0 doesn't:
julia> Base.AnnotatedString("abc def", [(i:i, anns[i]) for i in 1:0])
ERROR: MethodError: no method matching Base.AnnotatedString(::String, ::Vector{Tuple{UnitRange{Int64}, Any}})

I think the constructor type constraints are too restrictive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions