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

[Lang] [bug] Fix support property decorator for data_oriented class #3052

Merged
merged 6 commits into from
Oct 8, 2021
Merged

[Lang] [bug] Fix support property decorator for data_oriented class #3052

merged 6 commits into from
Oct 8, 2021

Conversation

yihong0618
Copy link
Collaborator

@yihong0618 yihong0618 commented Sep 30, 2021

Related issue = #3019

Because the @Portery decorator can not use getattribute in this case it will mark as a porterty class with fset fset and somehing else.
I use a tricky to support it.

@netlify
Copy link

netlify bot commented Sep 30, 2021

✔️ Deploy Preview for jovial-fermat-aa59dc ready!

🔨 Explore the source changes: 8381611

🔍 Inspect the deploy log: https://app.netlify.com/sites/jovial-fermat-aa59dc/deploys/615f975c27a9040008574c7b

😎 Browse the preview: https://deploy-preview-3052--jovial-fermat-aa59dc.netlify.app

@yihong0618
Copy link
Collaborator Author

yihong0618 commented Sep 30, 2021

@strongoier @ltt1598 can you help me to check, I am not sure if it may cause other problems or not.

Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing! This solution looks very promising - just a few nits :-)

@property
@ti.kernel
def test(self) -> ti.i32:
return 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return 0
return 24

return 0

a = Test()
print(a.test)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print(a.test)
assert a.test == 24

Let's make it a real test :-)

Comment on lines +782 to +783
if is_property:
return ret()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a test case to cover this code path?

@yihong0618
Copy link
Collaborator Author

Thanks for contributing! This solution looks very promising - just a few nits :-)

Done, also change the test class name

@yihong0618
Copy link
Collaborator Author

some ci failed seems the upstream repo not found problem

tests/python/test_oop.py Outdated Show resolved Hide resolved
@k-ye
Copy link
Member

k-ye commented Oct 5, 2021

/format

@yihong0618 yihong0618 requested a review from k-ye October 8, 2021 01:07
Copy link
Member

@k-ye k-ye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx!

@strongoier strongoier merged commit b701736 into taichi-dev:master Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants