Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 394
    • Issues 394
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Merge requests
  • !298

Type patterns for records: use _dim_A_ and _shape_A_

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Jordy Aaldering requested to merge 2407-type-pattern-record-dim-shape into develop Apr 17, 2024
  • Overview 0
  • Commits 6
  • Changes 6

Closes #2407 (closed)

When type patterns are being applied to user-defined types we assume that dim and shape are overloaded for those types. We then apply those functions in the generated code, instead of the primitives _dim_A_ and _shape_A_ because these functions cannot exist for such user-defined types.

However in the case of records we actually expand these into their separate arguments, to which these primitive functions CAN be applied.

struct Foo { int x; int y; };

int bar(struct Foo[*] foos) {
    _shape_A_(foos);
}

Becomes:

struct Foo { int x; int y; };

int bar(int[*] foos_x, int[*] foos_y) {
    _shape_A_(foos_x);
}

So if we find a type pattern on a record, we should apply the primitive functions instead.

Edited Apr 18, 2024 by Jordy Aaldering
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: 2407-type-pattern-record-dim-shape