[Chapel Merge] Fix a compiler seg-fault from infinite recursion

Branch: refs/heads/main
Revision: 943f9b5
Author: mppf
Log Message:

Merge pull request #18069 from mppf/fix-inf-rec-segv

Fix a compiler seg-fault from infinite recursion

Adds as tests two programs:

  • the first program in #12612
  • a program that @Yudhishthira1406 ran into during development that was
    causing a compiler crash

Then, adjusts the recursion handling for finding if a type is generic to
use a visited set rather than trying to mark the type, which was not
working in all cases.

Reviewed by @e-kayrakli - thanks!

  • [x] full local testing

    Modified Files:
    A test/classes/ferguson/recursive/issue-12612.chpl
    A test/classes/ferguson/recursive/issue-12612.good
    A test/classes/ferguson/recursive/waiter-bug.chpl
    A test/classes/ferguson/recursive/waiter-bug.good
    M compiler/AST/AggregateType.cpp
    M compiler/include/AggregateType.h

    Compare: Comparing 0ccbfcee70f2...943f9b5eba54 · chapel-lang/chapel · GitHub