Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`show` of `GeneratedKernelError{Msg}` throws for an unbound `Msg`

Open Beginner friendly
#897 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active

Research direction

The show method for GeneratedKernelError is defined in src/macros.jl, and the reporter's two reproductions are which(show, (IO, Type{G{:x}})) and show(stdout, G{TypeVar(:Msg)}). Start by running those lines to see the UndefVarError, then look at how the method's Msg static parameter is matched when the type argument is a TypeVar. Done means both reproductions print a readable type name without throwing, and printing a normal GeneratedKernelError{:msg} type still shows the message as before.

Written by the indexing model from the issue text.

Description

The show method for GeneratedKernelError types (src/macros.jl) throws when the type parameter is not bound to a value. That happens whenever the method's own signature is printed, e.g. by which or methods, or in a stack frame:

julia> using KernelAbstractions

julia> const G = KernelAbstractions.GeneratedKernelError;

julia> which(show, (IO, Type{G{:x}}))
ERROR: UndefVarError: `Msg` not defined in static parameter matching

julia> show(stdout, G{TypeVar(:Msg)})
ERROR: UndefVarError: `Msg` not defined in static parameter matching

function Base.show(io::IO, ::Type{GeneratedKernelError{Msg}}) where {Msg} also matches GeneratedKernelError{T} for a TypeVar T, but Msg is then not a static parameter value. Restricting the method to a bound message fixes it, for example:

function Base.show(io::IO, T::Type{<:GeneratedKernelError})
    T isa DataType && T.parameters[1] isa Symbol ||
        return invoke(show, Tuple{IO, Type}, io, T)
    msg = T.parameters[1]
    ...
end

Seen with KernelAbstractions 0.10.0 on Julia 1.12.7, where it broke the printing of some stack frames.

Dominant language
Julia
Stars
529
Forks
87
Avg merge
1d 2h
Merged PRs (30d)
65

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from JuliaGPU/KernelAbstractions.jl

All issues in JuliaGPU/KernelAbstractions.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.