Skip to content

Conversation

@gbaraldi
Copy link
Member

@gbaraldi gbaraldi commented Dec 9, 2025

pr:
image

master:
image

Inspired by @jakobnissen's blog https://viralinstruction.com/posts/aoc2025/

Written with AI help

@topolarity topolarity self-requested a review December 9, 2025 23:41
Copy link
Member

@topolarity topolarity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a solid improvement to me. Thanks @gbaraldi !

if newstmt.head (:quote, :inert)
return newstmt
# Check if a union is small with concrete types (same logic as code_warntype's is_expected_union)
function is_expected_union(@nospecialize(u::Union))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of duplicating, we should move these into the Compiler printing utilities and have InteractiveUtils pull them in from there?

end

# Print with light_black if stable, normal otherwise
function print_styled(io::IO, @nospecialize(x), stable::Bool)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function print_styled(io::IO, @nospecialize(x), stable::Bool)
function print_nontype(io::IO, @nospecialize(x), stable::Bool)

Not a great name, but better than print_styled and printstyled floating around in the same function

# Convert Core.Argument to slot name symbol if available
function argument_name(codeinfo::CodeInfo, arg::Core.Argument)
slotnames = codeinfo.slotnames
if slotnames !== nothing && arg.n <= length(slotnames)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IR verifier seems to suggest that codeinfo.slotnames is always populated and the right length - Is that not true?

Copy link
Member Author

@gbaraldi gbaraldi Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do you see that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most uses I see do check it.

if codeinfo.slotnames !== nothing
io = IOContext(io, :SOURCE_SLOTNAMES => sourceinfo_slotnames(codeinfo))
# Colors for matching parentheses at different nesting levels
const PAREN_COLORS = (:blue, :yellow, :magenta, :cyan, :green)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not a fan of multi-colored parentheses personally

They really overload the maximum number of visual items I can track at a time. Do you think they're very helpful?

Comment on lines 527 to 531
if warn
printstyled(io, "Verifier warning #", no, ": "; color=Base.warn_color(), bold=true)
else
printstyled(io, "Verifier error #", no, ": "; color=Base.error_color(), bold=true)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if warn
printstyled(io, "Verifier warning #", no, ": "; color=Base.warn_color(), bold=true)
else
printstyled(io, "Verifier error #", no, ": "; color=Base.error_color(), bold=true)
end
printstyled(io, "Problem #", no, ": "; color=Base.warn_color(), bold=true)

The index is shared but these are counted separately, so changing between "error" / "warning" seems a bit confusing to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants