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

Twoti.dataclass member/method name collision #6652

Closed
YouJiacheng opened this issue Nov 17, 2022 · 0 comments · Fixed by #6737
Closed

Twoti.dataclass member/method name collision #6652

YouJiacheng opened this issue Nov 17, 2022 · 0 comments · Fixed by #6737
Assignees
Labels
potential bug Something that looks like a bug but not yet confirmed

Comments

@YouJiacheng
Copy link

import taichi as ti

@ti.dataclass
class foo:
    zoo: ti.f32

@ti.dataclass
class bar:
    @ti.func
    def zoo(self):
        return 0

ti.init()
foo() # instantiate struct with zoo as member first
bar() # then instantiate struct with zoo as method
[Taichi] version 1.2.1, llvm 10.0.0, commit 12ab828a, win, python 3.10.6
[Taichi] Starting on arch=x64
[W 11/18/22 02:45:47.215 7540] [C:/Users/Administrator/actions-runner/_work/taichi/taichi/taichi/runtime/llvm/llvm_offline_cache.cpp:load_meta_data@138] Lock C:/taichi_cache/ticache/llvm/metadata.lock failed
Traceback (most recent call last):
  File "C:\Users\...\code\ray_tracing\test.py", line 15, in <module>
    bar() # then instantiate struct with method
  File "C:\Users\...\mamba\envs\taichi\lib\site-packages\taichi\lang\struct.py", line 682, in __call__
    struct = self.cast(entries)
  File "C:\Users\...\mamba\envs\taichi\lib\site-packages\taichi\lang\struct.py", line 703, in cast
    return Struct(entries)
  File "C:\Users\...\mamba\envs\taichi\lib\site-packages\taichi\lang\struct.py", line 57, in __init__
    self._register_methods()
  File "C:\Users\...\mamba\envs\taichi\lib\site-packages\taichi\lang\struct.py", line 108, in _register_methods
  File "C:\Users\...\mamba\envs\taichi\lib\site-packages\taichi\lang\struct.py", line 57, in __init__
    self._register_methods()
  File "C:\Users\...\mamba\envs\taichi\lib\site-packages\taichi\lang\struct.py", line 108, in _register_methods
    setattr(self, name, MethodType(method, self))
  File "C:\Users\...\mamba\envs\taichi\lib\site-packages\taichi\lang\util.py", line 297, in wrapped
    return func(*args, **kwargs)
  File "C:\Users\...\mamba\envs\taichi\lib\site-packages\taichi\lang\struct.py", line 152, in setter
    self[key] = value
  File "C:\Users\...\mamba\envs\taichi\lib\site-packages\taichi\lang\struct.py", line 117, in __setitem__
    if isinstance(self.entries[key], SNodeHostAccess):
KeyError: 'zoo'
[W 11/18/22 02:49:30.911 18576] [taichi/util/offline_cache.h:run@185] Lock C:/taichi_cache/ticache/llvm/metadata.lock failed
@YouJiacheng YouJiacheng added the potential bug Something that looks like a bug but not yet confirmed label Nov 17, 2022
@taichi-gardener taichi-gardener moved this to Untriaged in Taichi Lang Nov 17, 2022
@PENGUINLIONG PENGUINLIONG moved this from Untriaged to Todo in Taichi Lang Nov 18, 2022
@strongoier strongoier moved this from Todo to In Progress in Taichi Lang Nov 25, 2022
Repository owner moved this from In Progress to Done in Taichi Lang Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential bug Something that looks like a bug but not yet confirmed
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants