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 402
    • Issues 402
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #2513
Closed
Open
Created Nov 05, 2025 by Sven-Bodo Scholz@sbsOwner

partially applied fold and type pattern check fails

When compiling

int minIdx (int[n] a, int i, int j)
{
    return i;
}

int minPos( int[n] x)
{
    return with {
             ([0] <= [i] < [n]) : i;
           } : fold (minIdx (x), 0);

}

int main () {
    return minPos( [1,2,0,3,4,5]);
}

with sac2c -check p using

sac2c 2.0.0-Tintigny-187-ge8af
build-type: RELEASE

we get

./bug.sac:11:16: error:
  10.              ([0] <= [i] < [n]) : i;
  11.            } : fold (minIdx (x), 0);
                     ↑
  12.
  13. }

  No definition found for a function "_MAIN::minIdx" that expects 2
  arguments
  and yields 1 return value
Compilation failed while Converting to static single assignment form, 1 error(s).

When compiling with sac2c all is fine.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking