Skip to content

Conversation

@kaihsin
Copy link
Collaborator

@kaihsin kaihsin commented Nov 25, 2025

This PR expand the capability for lowering of kernel with type hint of something with:

@basic
    def main(x: str | float | int):
        return x

    main.print()

    tps = main.arg_types

    assert len(tps) == 1
    assert tps[0] == types.Union([types.String, types.Float, types.Int])

Note that before this PR, only Binding can allow this semantic, but will error if one trying to do that for kernel program

@kaihsin
Copy link
Collaborator Author

kaihsin commented Nov 25, 2025

This should be non-breaking as its an (optional) enhancement

@github-actions
Copy link
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
11734 10470 89% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/kirin/lowering/python/dialect.py 91% 🟢
TOTAL 91% 🟢

updated for commit: 9c24ea6 by action🐍

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

PR Preview Action v1.6.3
Preview removed because the pull request was closed.
2025-11-25 07:44 UTC

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kaihsin kaihsin merged commit 9188954 into main Nov 25, 2025
12 of 13 checks passed
@kaihsin kaihsin deleted the khwu/typehint_union branch November 25, 2025 07:43
kaihsin added a commit that referenced this pull request Nov 25, 2025
This PR expand the capability for lowering of kernel with type hint of
something with:

```python

@basic
    def main(x: str | float | int):
        return x

    main.print()

    tps = main.arg_types

    assert len(tps) == 1
    assert tps[0] == types.Union([types.String, types.Float, types.Int])

```

Note that before this PR, only Binding can allow this semantic, but will
error if one trying to do that for kernel program
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants