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

feat: Implement arrays of structs #1068

Merged
merged 2 commits into from
Mar 30, 2023
Merged

feat: Implement arrays of structs #1068

merged 2 commits into from
Mar 30, 2023

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Mar 29, 2023

Related issue(s)

Resolves #none

Description

Summary of changes

Implements arrays of structs by converting them into structs of arrays during monomorphization.

This PR has 1 issue / TODO that I will create a separate issue for and fix in a later PR if this is merged. It is that during the SOA conversion, some elements of the Ast are cloned naively without regard as to whether cloning them may cause side-effects to be re-evaluated. This issue should be rare as it should only occur if e.g. array elements contain a constrain or mutate values, which they would need to contain a BlockExpression for.

Dependency additions / changes

Test additions / changes

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.

We can remove the note in our documentation that one cannot define arrays of structs as it is now possible. Crucially however, we still cannot have arrays of arrays (nested arrays), or arrays of structs where the structs themselves contain arrays.

Additional context

@kevaundray kevaundray added this pull request to the merge queue Mar 30, 2023
Merged via the queue into master with commit f607150 Mar 30, 2023
@kevaundray kevaundray deleted the jf/struct-arrays branch March 30, 2023 10:52
TomAFrench added a commit that referenced this pull request Apr 3, 2023
* master:
  chore: handle public parameters and return values separately in evaluator (#1062)
  chore(ssa): Rename ObjectType::Pointer to ObjectType::ArrayPointer (#1077)
  chore(ssa): indent NumericType into ObjectType (#810)
  chore: apply spelling fixes (#1073)
  feat: Implement `std::unsafe::zeroed` (#1048)
  fix: crash when typechecking fields that don't exist (#1070)
  feat: Implement arrays of structs (#1068)
  feat(nargo): split `nargo` into core and cli packages (#1065)
  chore: split wasm crate into submodules (#1066)
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.

2 participants