Skip to content

PowerShell enum members use contains instead of case_of #4091

Description

@rajatnagda45

Version / commit

v8 @ 35adf43 (v0.9.76)

What happens

A PowerShell enum links its members to the enum with a contains edge, the same relation used for real declared members. Every other language that has enums emits a case_of edge per member — Java (#1719), C#, Swift, Rust, and VB.NET (#4054). PowerShell is now one of the last extractors still using contains for enum members.

Minimal reproduction

# status.ps1
enum Status {
    Active
    Paused
    Closed
}
from graphify.extractors import extract_powershell
r = extract_powershell("status.ps1")
for e in r["edges"]:
    if e["relation"] in ("case_of", "contains"):
        print(e["relation"], e["source"], "->", e["target"])

Expected

Status -> Active/Paused/Closed as case_of.

Actual

Status -> Active/Paused/Closed as contains.

Why it matters

case_of targets are deliberately excluded from constructor binding (_member_nids in extract.py), so an enum member whose name collides with a type can currently be mistaken for a constructable member. It also breaks the cross-language invariant downstream consumers rely on to tell enum cases apart from declared members.

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