Skip to content

strings/annotated test relies on that StyledStrings have been loaded #54561

Open
@KristofferC

Description

@KristofferC

This is a reduction of a test in test/strings/annotated.jl that avoids loading StyledStrings (which now gets loaded when loading Test.jl):

str1 = Base.AnnotatedString("test", [(1:4, :label => 5)])
str2 = Base.AnnotatedString("case", [(2:3, :label => "oomph")])
@assert join([str1, str1], ' ') ==
    Base.AnnotatedString("test test",
                 [(1:4, :label => 5),
                  (6:9, :label => 5)])

Running this fails with:

ERROR: LoadError: AssertionError: join([str1, str1], ' ') == Base.AnnotatedString("test test", [(1:4, :label => 5), (6:9, :label => 5)])

However, if we add

using StyledStrings

to the top, the assert does not fire.

The reason for this is type piracy in StyledStrings: JuliaLang/StyledStrings.jl#61.

It is weird that things like join on base types give different results depending on if an stdlib has been (transitively) loaded.
The rendering of StyledStrings should probably move to Base to fix this.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions