scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

i22587 Divergence check for Match Types

Open Lluc24 opened this issue 1 week ago • 2 comments

Closes #22587: Implement Divergence Checking for Match Types

  • Addresses the issue where match type reduction relies on catching StackOverflowError to handle infinite recursion, which is unsafe and slow.
  • Adapts the "Open Implicits" divergence checking algorithm (from SIP-31) to ApplyTypes and MatchTypes.
  • Introduces a new Property in the Context to track the history of types currently being reduced.
  • Enforces termination by verifying that arguments of the Match Type do not increase in size compared to previous reductions in the history.
  • Returns a standard Error Type when divergence is detected.

Lluc24 avatar Dec 04 '25 09:12 Lluc24