Skip to content

Precompilation fails with JuliaSyntax: unknown Kind name "core_@cmd" #928

@Sixzero

Description

@Sixzero

Problem

JuliaFormatter fails to precompile with the following error when using JuliaSyntax:

ERROR: LoadError: unknown Kind name "core_@cmd"
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:44
  [2] (::JuliaSyntax.var"#Kind##0#Kind##1"{SubString{String}})()
    @ JuliaSyntax ~/.julia/packages/JuliaSyntax/J00sR/src/kinds.jl:47
  [3] get
    @ ./dict.jl:526 [inlined]
  [4] Kind
    @ ~/.julia/packages/JuliaSyntax/J00sR/src/kinds.jl:46 [inlined]
  [5] #@KSet_str##0
    @ ./none:-1 [inlined]
  [6] iterate
    @ ./generator.jl:48 [inlined]
  [7] collect_to!
    @ ./array.jl:848 [inlined]
  [8] collect_to_with_first!(dest::Vector{JuliaSyntax.Kind}, v1::JuliaSyntax.Kind, itr::Base.Generator{Vector{SubString{String}}, JuliaSyntax.var"#@KSet_str##0#@KSet_str##1"}, st::Int64)
    @ Base ./array.jl:826
  [9] collect(itr::Base.Generator{Vector{SubString{String}}, JuliaSyntax.var"#@KSet_str##0#@KSet_str##1"})
    @ Base ./array.jl:800
 [10] var"@KSet_str"(__source__::LineNumberNode, __module__::Module, str::Any)
    @ JuliaSyntax ~/.julia/packages/JuliaSyntax/J00sR/src/kinds.jl:170
 [11] include(mapexpr::Function, mod::Module, _path::String)
    @ Base ./Base.jl:304
 [12] top-level scope
    @ ~/.julia/packages/JuliaFormatter/IqoSF/src/JuliaFormatter.jl:116
 [13] include(mod::Module, _path::String)
    @ Base ./Base.jl:303
 [14] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2991

Analysis

The error occurs because JuliaFormatter is trying to use a Kind named "core_@cmd" which doesn't exist in JuliaSyntax. Looking at the JuliaSyntax codebase, the available kinds include:

  • Basic tokens: "Comment", "Whitespace", "Identifier", etc.
  • Keywords: "begin", "end", "function", etc.
  • Operators: "+", "-", "*", etc.
  • Literals: "String", "Integer", "Float", etc.
  • Syntax kinds: "call", "block", "macrocall", etc.

However, there is no "core_@cmd" kind defined. The error suggests that JuliaFormatter is trying to create a KSet (using the @KSet_str macro) that includes this non-existent kind.

Possible Causes

  1. JuliaFormatter might be using an outdated or incorrect kind name
  2. There might be a version compatibility issue between JuliaSyntax and JuliaFormatter
  3. The kind name might need to be updated to match the current JuliaSyntax API

Environment

  • Julia version: 1.12
  • JuliaSyntax version: (from ~/.julia/packages/JuliaSyntax/J00sR/)
  • JuliaFormatter version: (from ~/.julia/packages/JuliaFormatter/IqoSF/)

Expected Behavior

JuliaFormatter should precompile successfully without errors.

Actual Behavior

JuliaFormatter fails to precompile due to the unknown kind name.

Suggested Fix

The JuliaFormatter codebase should be updated to use the correct kind names that exist in the current version of JuliaSyntax. The "core_@cmd" reference should be replaced with the appropriate existing kind name or removed if no longer needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions