New Issue: [Bug]: Internal error on resolving generics cycle

28127, "jabraham17", "[Bug]: Internal error on resolving generics cycle", "2025-12-04T17:20:37Z"

A user recently hit an issue while developing a new feature for UnitTest: [Feature Request]: assertClose() method for UnitTest · Issue #28099 · chapel-lang/chapel · GitHub. Inadvertently, they had mad UnitTest.Test generic, which caused the compiler to hit an internal error. The following code is a minimal reproducer of the issue, outside of UnitTest

record R { type T; }

proc testSignature(test: borrowed C) throws { }
var tempFcf = testSignature;
type argType = tempFcf.type;

class C {
  var x: R(argType);
  param p: real = 10.0; // comment this out to resolve the issue
}

proc main () {
  writeln(argType:string);
}

The problem occurs while resolving argType, which depends on the type of testSignature, which depends on the type of C, which depends on the type of argType. The compiler seems to have no problem breaking this cycle normally, but when param p is added it breaks. Note that if param p has no default value the compiler gives a nicer user facing error about generics in first class functions.