Skip to content

Commit f3446e9

Browse files
oscardssmithKristofferC
authored andcommitted
CoreLogging: prevent some Annotated*-related instability (#59467)
Add some concrete `typeassert`s to increase the resistance of the sysimage to invalidation by helping inference within the method body. (cherry picked from commit bb51d56)
1 parent 9e05e95 commit f3446e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

base/logging/ConsoleLogger.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ function handle_message(logger::ConsoleLogger, level::LogLevel, message, _module
124124
# split into lines. This is specialised to improve type inference,
125125
# and reduce the risk of resulting method invalidations.
126126
message = string(message)
127-
msglines = if Base._isannotated(message) && !isempty(Base.annotations(message))
128-
message = Base.AnnotatedString(String(message), Base.annotations(message))
127+
msglines = if Base._isannotated(message) && !isempty(Base.annotations(message)::Vector{Base.RegionAnnotation})
128+
message = Base.AnnotatedString(String(message)::String, Base.annotations(message)::Vector{Base.RegionAnnotation})
129129
@NamedTuple{indent::Int, msg::Union{SubString{Base.AnnotatedString{String}}, SubString{String}}}[
130130
(indent=0, msg=l) for l in split(chomp(message), '\n')]
131131
else

0 commit comments

Comments
 (0)