Skip to content

Objective-C: C-style enum (and typedef enum) declarations are dropped #4095

Closed

Description

@rajatnagda45

Version / commit

v8 @ 35adf43 (v0.9.76)

What happens

The Objective-C extractor emits @interface, @implementation and @protocol type nodes, but plain enum and typedef enum definitions are dropped entirely — the enum type and all of its members are missing from the graph. Every other language with enums emits a type node plus a case_of edge per member (Java #1719, C++ #3939, Swift).

Minimal reproduction

// Color.m
#import <Foundation/Foundation.h>
enum Color { Red, Green, Blue };
typedef enum { North, South } Direction;
from graphify.extractors import extract_objc
r = extract_objc("Color.m")
print([n["label"] for n in r["nodes"]])

Expected

Color and Direction type nodes, each with case_of edges to its members.

Actual

Neither the enum types nor their members appear; only the file node (and any classes) are emitted.

Why it matters

ObjC enums are everywhere in real codebases; a [Color]-typed field or a switch over an enum has no type to point at. Unlike C (whose class_types is empty by design), the ObjC extractor is object-oriented and already models named types, so enums are an inconsistency within its own model.

Note

The NS_ENUM/NS_OPTIONS macro spelling is a separate matter: tree-sitter-objc parses it into an ERROR subtree, so it has no clean AST and is out of scope here. This is about the plain C-style enum / typedef enum forms, which parse cleanly.

Activity

  1. github-actions commented on Oct 5, 2026

    @github-actions

    Thanks for opening this issue, @rajatnagda45. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. safishamsi commented on Oct 5, 2026

    @safishamsi
    Member

    Resolved by #4096 (thanks @rajatnagda45), shipped in v0.9.77. Closing as fixed.

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