You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When reassigning a variable/vector with a different type, the original type does not change, this may lead to confusion as people are easier to think taichi works similar to python (but not C)
➜ TaichiSLAM git:(main) ✗ python tests/test.py
[Taichi] version 0.9.3, llvm 10.0.0, commit c902db62, linux, python 3.8.10
[Taichi] Starting on arch=x64
[W 03/30/22 22:38:51.391 3010] [type_check.cpp:visit@145] [$183] Local store may lose precision (target = i32, value = f32), at
183
[W 03/30/22 22:38:51.391 3010] [type_check.cpp:visit@145] [$185] Local store may lose precision (target = i32, value = f32), at
185
[W 03/30/22 22:38:51.391 3010] [type_check.cpp:visit@145] [$187] Local store may lose precision (target = i32, value = f32), at
187
[W 03/30/22 22:38:51.391 3010] [type_check.cpp:visit@145] [$202] Local store may lose precision (target = i32, value = f32), at
202
[W 03/30/22 22:38:51.391 3010] [type_check.cpp:visit@145] [$204] Local store may lose precision (target = i32, value = f32), at
204
[W 03/30/22 22:38:51.391 3010] [type_check.cpp:visit@145] [$206] Local store may lose precision (target = i32, value = f32), at
206
[W 03/30/22 22:38:51.391 3010] [type_check.cpp:visit@145] [$217] Local store may lose precision (target = i32, value = f32), at
217
[1, 2, 3]
interlop [4, 4, 3]
reassign to float [1, 2, 3]
1
1.5 1
Additional comments
My suggestion is to either of:
Gives a clear warning or error indication that the line has Implicit converting. now we can't find which line the error is on.
Convert lvalue to the type of rvalue (like Python)
The text was updated successfully, but these errors were encountered:
Thanks for your suggestion! Taichi is a statically-typed language, so option 1 is preferred. #4840 makes source code info available in warnings. Your code snippet illustrates another bug in type check for local stores, and I will send another PR to fix that.
Describe the bug
When reassigning a variable/vector with a different type, the original type does not change, this may lead to confusion as people are easier to think taichi works similar to python (but not C)
To Reproduce
Log/Screenshots
Additional comments
My suggestion is to either of:
The text was updated successfully, but these errors were encountered: