cutile-python icon indicating copy to clipboard operation
cutile-python copied to clipboard

[FEA]: Support `AnnAssign` AST node

Open XOR-op opened this issue 4 weeks ago • 0 comments

Is this a new feature, an improvement, or a change to existing functionality?

Improvement

How would you describe the priority of this feature request?

Medium

Please provide a clear description of problem this feature solves

Allow developers to add type annotations for expressions. This helps improve code clarity and reduce LSP warning/error given that current function signatures have multiple possible return types.

Feature Description

@ct.kernel
def foo(x: ct.Array, y: ct.Array):
    # ...
    x_exp = ct.exp2(x) # Currently returns ct.Tile | int | float | ScalarProtocol 
   # Or
   x_exp: ct.Tile = ct.exp2(x) # cuda.tile._exception.TileSyntaxError: Unsupported syntax <class 'ast.AnnAssign'>

Describe your ideal solution

Given the type annotation is optional and not enforced at runtime, it's acceptable to treat ast.AnnAssign as an ordinary ast.Assign.

Describe any alternatives you have considered

No response

Additional context

No response

Contributing Guidelines

  • [x] I agree to follow cuTile Python's contributing guidelines
  • [x] I have searched the open feature requests and have found no duplicates for this feature request

XOR-op avatar Dec 29 '25 03:12 XOR-op