Skip to content

Add structs using dataclasses #607

Closed
@certik

Description

@certik

We need to support structs using the following syntax:

@dataclass
class A:
    x: i32
    y: f32

def f(a: A):
    print(a.x)
    print(a.y)

def g():
    x: A = A()
    x.x = 5
    x.y = 5.5
    f(x)

g()

I think this already works at the ASR level and in LLVM, so the tasks are:

  • Implement support for this at the AST->ASR level
  • LLVM tests
  • CPython tests
  • C tests

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