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

Type Patterns

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Jordy Aaldering requested to merge type-extension-shape-relations into develop Oct 19, 2023
  • Overview 23
  • Commits 272
  • Changes 82

Implementation of type patterns for function arguments and return types, along with a notation for specifying arbitrarily complex conditions. Also works for external functions. Type patterns are not supported for specializations, or type definitions outside of function signatures.

Selection example using type patterns:

inline
int[d:shp] sel (int[vlen] idx, int[vlen:vshp,d:shp] array)
    | all (0 <= idx), all (idx < vshp)
{
    res = with {
              (0*shp <= iv < shp)
                  : array[idx ++ iv];
          } : genarray (shp, 0);
    return res;
}

The type pattern pipeline is split into multiple steps/files:

  • filter_fundef_constraints
  • type_pattern_analyse
  • type_pattern_resolve_(fundefs,externals)
    • type_pattern_constraints
    • type_pattern_guard
  • strip_type_pattern_checks
  • type_pattern_statistics
Edited Nov 01, 2023 by Jordy Aaldering
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: type-extension-shape-relations