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
  • !261

Enable conformity checks for type patterns

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Jordy Aaldering requested to merge 2364-ecc-for-type-patterns into develop Dec 13, 2023
  • Overview 2
  • Commits 2
  • Changes 2

Insertion of conformity checks was disabled for the generated type pattern code, this should be enabled again.

Consider the checks generated for the selection function:

int[d:shp] sel (int[n] idx, int[n:outer,d:shp] arr)

If idx has length 3, but arr is only of dim 2 we have:

n = shape (idx)[0];                     // n = 3
outer = take (n, shape (arr));
d = dim (arr) - n;                      // d = 2 - 3 = -1
shp = take (d, drop (n, shape (arr)));  // we try to take -1

This would generate erroneous code. To avoid this, we need to ensure that conformity checks are inserted for these functions. No (significant) code duplication should occur because of this, because type pattern checks apply to the conformity of type patterns, whereas conformity checks apply to the conformity of primitive functions.

Closes #2364 (closed)

Edited Dec 15, 2023 by Jordy Aaldering
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: 2364-ecc-for-type-patterns