From dd65ba87b4365aa239b94e2b5eea69b0576c2326 Mon Sep 17 00:00:00 2001 From: Max B Date: Sun, 23 Aug 2026 21:33:05 +0200 Subject: [PATCH] fix: raise MAX_GENERIC_INSTANCES from 100 to 1000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The cap exists to detect POLYMORPHIC recursion (`f` calling `f`) that would diverge forever. A real-world program with deeply generic utility types (Drizzle ORM, Zod, tRPC) exhausts 100 instances during normal non-recursive specialization — the compiler stops mid-lowering and emits a diagnostic instead of a binary. 1000 is still a hard cap against runaway polymorphic recursion; it is simply high enough that a ~600-file application with heavy generic usage doesn't hit it spuriously. --- packages/compiler/src/frontend/lowering/lower-calls.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/compiler/src/frontend/lowering/lower-calls.ts b/packages/compiler/src/frontend/lowering/lower-calls.ts index 7d2a7fcec..3d99dbb87 100644 --- a/packages/compiler/src/frontend/lowering/lower-calls.ts +++ b/packages/compiler/src/frontend/lowering/lower-calls.ts @@ -67,7 +67,7 @@ export interface FnSig { * calling itself) converges, but POLYMORPHIC recursion (`f` calling * `f`) would request new instances forever — the cap turns that into a * diagnostic instead of a hang. */ -export const MAX_GENERIC_INSTANCES = 100; +export const MAX_GENERIC_INSTANCES = 1000; /** A generic function-like declaration, collected instead of an FnSig — * top-level generic function declarations, class GENERIC METHODS (own type