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

Member-wise constructor generation with visibility control #5107

Draft
wants to merge 132 commits into
base: master
Choose a base branch
from

Conversation

kaizhangNV
Copy link
Contributor

Rebased version of PR #4854.

NOTE: This is a draft

Key Changes:
1. Initializer lists call into constructors (and no longer hack around per element)
2. we auto-generate member-wise constructors for varying visibility of members (public, public-internal, public-internal-private)
3. Implements visibility and member-wise constructor rules described in shader-slang#3406
4. Reorders and reformats how we auto-generate constructors along with adding support for member-wise constructors ('visitStruct' and 'visitAggTypeDecl').
    * This was changed since currently Slang (if no constructors are found) falls back to initializer list syntax for non initializer list constructor code. Since we add a non-default-ctor this fallback logic never happens causing failures now.
5. initialization-list logic for struct objects has been reordered and reformatted due to previous logical incompatibilities.
1. fix breaking tests which cannot be fixed by adding 'old style slang array init-list syntax' support, specifically for constructing a struct without an explicit '{}'
2. clean up tests
1. resolve generics which are associated to a struct instance during init list evaluation
2. fix autodiff test with incorrect init-list
…rrent limitations."

Revert because it will break code, instead just check more generally for 0, if we don't want the "everything does an 'init'" logic this can be changes later.
…iures

remove all null default-ctor's like before, instead though redesign the hacky overload resolution into ctor such that it works:
1. resolveInvoke properly culls useless overloads
2. This stops spirious generation of empty init's (side-effect if we generate a real ctor)
3. This stops lots of warnings since we don't have a ctor that init's nothing
1. allow a more formalized init-list logic for flattened init-lists's
2. fixing invalid tests
1. clean-up documentation tests 2. fix recursive type crash with uninitialized value checks 3. fully disallow synth object printing rather than partially for auto-documentation code.
…ness bug

Adding 2 things:
1. add no_diff to synth'ed ctor if param is no_diff
2. Fix bug where DifferentialType 'ownedScope' is not setup to track the associated contained (causes 'ThisExpr' to resolve incorrectly)
@kaizhangNV kaizhangNV marked this pull request as draft September 18, 2024 17:40
@kaizhangNV kaizhangNV added the pr: breaking change PRs with breaking changes label Sep 18, 2024
@kaizhangNV
Copy link
Contributor Author

Just try to run the CI now to see everything is fine after rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: breaking change PRs with breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants