Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False warning on example marching square #8218

Closed
lin-hitonami opened this issue Jun 25, 2023 · 0 comments · Fixed by #8217
Closed

False warning on example marching square #8218

lin-hitonami opened this issue Jun 25, 2023 · 0 comments · Fixed by #8217

Comments

@lin-hitonami
Copy link
Contributor

Describe the bug
It shouldn't raise warning because the code inside static_assert should be in static scope.

To Reproduce

~/taichi/python/taichi/examples/algorithm$ python marching_squares.py 

Log/Screenshots

$ python my_sample_code.py
/home/lin/taichi/python/taichi/_kernels.py:79: SyntaxWarning: Calling non-taichi function "len". Scope inside the function is not processed by the Taichi AST transformer. The function may not work as expected. Proceed with caution! Maybe you can consider turning it into a @ti.func?
  static_assert(len(img.shape) == 2)
@github-project-automation github-project-automation bot moved this to Untriaged in Taichi Lang Jun 25, 2023
@github-project-automation github-project-automation bot moved this from Untriaged to Done in Taichi Lang Jun 25, 2023
neozhaoliang pushed a commit that referenced this issue Jun 25, 2023
Issue: fix #8218 

### Brief Summary

<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at ec8cb2c</samp>

Add `static_assert` feature for compile-time assertions in Taichi.
Modify `ast_transformer.py` to handle the `static_assert` decorator.

### Walkthrough

<!--
copilot:walkthrough
-->
### <samp>🤖 Generated by Copilot at ec8cb2c</samp>

* Add support for `static_assert` decorator to enable compile-time
assertions
([link](https://github.com/taichi-dev/taichi/pull/8217/files?diff=unified&w=0#diff-3e22417ffade4af0564893b98dc5101d714b8ba6fd4423ab5bc5129e360fee8fL538-R538),
[link](https://github.com/taichi-dev/taichi/pull/8217/files?diff=unified&w=0#diff-3e22417ffade4af0564893b98dc5101d714b8ba6fd4423ab5bc5129e360fee8fR1119))
PGZXB pushed a commit to PGZXB/taichi that referenced this issue Jul 13, 2023
Issue: fix taichi-dev#8218 

### Brief Summary

<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at ec8cb2c</samp>

Add `static_assert` feature for compile-time assertions in Taichi.
Modify `ast_transformer.py` to handle the `static_assert` decorator.

### Walkthrough

<!--
copilot:walkthrough
-->
### <samp>🤖 Generated by Copilot at ec8cb2c</samp>

* Add support for `static_assert` decorator to enable compile-time
assertions
([link](https://github.com/taichi-dev/taichi/pull/8217/files?diff=unified&w=0#diff-3e22417ffade4af0564893b98dc5101d714b8ba6fd4423ab5bc5129e360fee8fL538-R538),
[link](https://github.com/taichi-dev/taichi/pull/8217/files?diff=unified&w=0#diff-3e22417ffade4af0564893b98dc5101d714b8ba6fd4423ab5bc5129e360fee8fR1119))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant