Skip to content

Julia: parametric type definitions (struct Box{T}, abstract type Shape{T}) are dropped #4128

Description

@rajatnagda45

Version / commit

v0.9.77 (v8 @ 5c7b847)

Environment

macOS, Python 3.13, clean checkout of v8.

What happens

A parametric type declaration is dropped from the graph entirely — no node, and for the subtyping form no inherits edge either. The non-parametric forms (struct Box, abstract type Shape, Dog <: Animal) all work; only the {...} parameter list breaks it. Parametric types are the backbone of generic Julia.

Minimal reproduction

# params.jl
struct Box{T}
    value::T
end
abstract type Shape{T} end
struct Sq{T} <: Shape{T}
end
from graphify.extract import extract_julia
r = extract_julia("params.jl")
print([n["label"] for n in r["nodes"]])
# -> ['params.jl']   # Box, Shape, Sq all missing

Expected vs actual

  • Expected: Box, Shape, and Sq nodes, with Sq --inherits--> Shape.
  • Actual: none of the three types appear.

Root cause

The type-head reader only recognises a plain identifier. A parametric head is a parametrized_type_expression (its leading identifier is the real name), which matched neither the bare nor the binary_expression (subtyping) branch, so the name came back None and the type was skipped.

A clean checkout of v8 reproduces it. Fix PR to follow.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions