Skip to content

Feature Request: Extend LiteralDict lowering support #211

@m-akhil-reddy

Description

@m-akhil-reddy

Summary

Recently, minimal lowering support for astx.LiteralDict was added to LLVMLiteIRVisitor (PR #175).

The current implementation intentionally supports only a small subset of cases:

  • Empty dictionaries.
  • Dictionaries with homogeneous constant key/value pairs.

For other cases (e.g., heterogeneous types or non-constant elements), the implementation currently raises a TypeError to keep the scope minimal.

Motivation

To make LiteralDict more useful, it would be helpful to extend support to additional scenarios.

Possible Extensions

Some potential follow-ups could include:

  • Support for heterogeneous key/value types.
  • Support for non-constant elements.
  • Lowering using runtime construction (e.g., alloca + stores).
  • Handling dictionary mutability or updates.
  • Alignment with how other literal containers (e.g., lists/tuples) are lowered.

Goal

Gradually extend LiteralDict lowering while keeping the implementation consistent with the existing IR generation patterns in LLVMLiteIRVisitor.

Additional Information

NOTE :-
this issue is the extention of isuue #30 and PR #174

Code of Conduct

  • I agree to follow the Code of Conduct

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